Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion scripts/qemu_runner.py
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -23,7 +30,7 @@
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 = ""

Expand Down
Loading