check for llvm and rust objcopy binaries

This commit is contained in:
samarth
2026-06-10 11:15:54 +05:30
committed by Ashwin Naren
parent 4f91fe87d6
commit 413321c747

View File

@@ -1,8 +1,15 @@
#!/usr/bin/env python3
import argparse
import shutil
import subprocess
def find_objcopy():
for candidate in ["aarch64-none-elf-objcopy", "llvm-objcopy", "rust-objcopy"]:
if shutil.which(candidate):
return candidate
raise FileNotFoundError("No objcopy found. Install gcc-aarch64-embedded or llvm.")
parser = argparse.ArgumentParser(description="QEMU runner")
parser.add_argument("elf_executable", help="Location of compiled ELF executable to run")
@@ -23,7 +30,7 @@ args = parser.parse_args()
elf_executable = args.elf_executable
bin_executable_location = elf_executable.replace(".elf", "") + ".bin"
# Convert the ELF executable to a binary format
subprocess.run(["aarch64-none-elf-objcopy", "-O", "binary", elf_executable, bin_executable_location], check=True)
subprocess.run([find_objcopy(), "-O", "binary", elf_executable, bin_executable_location], check=True)
append_args = ""