Skip to content

Commit 413321c

Browse files
sixseventysixarihant2math
authored andcommitted
check for llvm and rust objcopy binaries
1 parent 4f91fe8 commit 413321c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/qemu_runner.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
#!/usr/bin/env python3
22

33
import argparse
4+
import shutil
45
import subprocess
56

7+
def find_objcopy():
8+
for candidate in ["aarch64-none-elf-objcopy", "llvm-objcopy", "rust-objcopy"]:
9+
if shutil.which(candidate):
10+
return candidate
11+
raise FileNotFoundError("No objcopy found. Install gcc-aarch64-embedded or llvm.")
12+
613
parser = argparse.ArgumentParser(description="QEMU runner")
714

815
parser.add_argument("elf_executable", help="Location of compiled ELF executable to run")
@@ -23,7 +30,7 @@
2330
elf_executable = args.elf_executable
2431
bin_executable_location = elf_executable.replace(".elf", "") + ".bin"
2532
# Convert the ELF executable to a binary format
26-
subprocess.run(["aarch64-none-elf-objcopy", "-O", "binary", elf_executable, bin_executable_location], check=True)
33+
subprocess.run([find_objcopy(), "-O", "binary", elf_executable, bin_executable_location], check=True)
2734

2835
append_args = ""
2936

0 commit comments

Comments
 (0)