Am 3. Februar 2025 18:42:00 MEZ schrieb Simon Glass <s...@chromium.org>: >Provide a -A flag to select ARM instead of x86. For now, only the app >is supported and only for 64-bit ARM. > >Signed-off-by: Simon Glass <s...@chromium.org> >--- > > scripts/build-efi.py | 49 +++++++++++++++++++++++++++++++------------- > 1 file changed, 35 insertions(+), 14 deletions(-) > >diff --git a/scripts/build-efi.py b/scripts/build-efi.py >index 3a1bf180ade..1ba37e86e88 100755 >--- a/scripts/build-efi.py >+++ b/scripts/build-efi.py >@@ -48,6 +48,8 @@ def parse_args(): > epilog='Script for running U-Boot as an EFI app/payload') > parser.add_argument('-a', '--app', action='store_true', > help='Package up the app') >+ parser.add_argument('-A', '--arm', action='store_true',
Why have a flag per EFI architecture? Please add a parameterized flag instead. --arch i386 --arch x64 --arch arm --arch aarch64 --arch riscv64 and get rid of the bitness parameter. >+ help='Run on ARM architecture') > parser.add_argument('-B', '--no-build', action='store_true', > help="Don't build (an existing build must be present") > parser.add_argument('-k', '--kernel', action='store_true', >@@ -131,26 +133,43 @@ class BuildEfi: > """ > extra = [] > efi_dir = self.get_setting("efi_dir") >- if bitness == 64: >- qemu = 'qemu-system-x86_64' >- bios = 'OVMF-pure-efi.x64.fd' >- else: >- qemu = 'qemu-system-i386' >- bios = 'OVMF-pure-efi.i386.fd' >+ if self.args.arm: >+ qemu_arch = 'aarch64' >+ extra += ['--machine', 'virt', '-cpu', 'max'] >+ bios = os.path.join(efi_dir, 'OVMF-pure-efi.aarch64.fd.64m') >+ var_store = os.path.join(efi_dir, 'varstore.img') >+ extra += [ >+ '-drive', f'if=pflash,format=raw,file={bios},readonly=on', >+ '-drive', f'if=pflash,format=raw,file={var_store}' >+ ] >+ extra += ['-drive', >+ f'id=hd0,file={self.img},if=none,format=raw', >+ '-device', 'virtio-blk-device,drive=hd0'] >+ else: # x86 >+ if bitness == 64: >+ qemu_arch = 'x86_64' >+ bios = 'OVMF-pure-efi.x64.fd' Not a filename used by EDK II or by QEMU. Best regards Heinrich >+ else: >+ qemu_arch = 'i386' >+ bios = 'OVMF-pure-efi.i386.fd' >+ extra += ['-bios', os.path.join(efi_dir, bios)] >+ extra += ['-drive', f'id=disk,file={self.img},if=none,format=raw'] >+ extra += ['-device', 'ahci,id=ahci'] >+ extra += ['-device', 'ide-hd,drive=disk,bus=ahci.0'] >+ qemu = f'qemu-system-{qemu_arch}' > if serial_only: >- extra = ['-display', 'none', '-serial', 'mon:stdio'] >+ extra += ['-display', 'none', '-serial', 'mon:stdio'] > serial_msg = ' (Ctrl-a x to quit)' > else: >- extra = ['-serial', 'mon:stdio'] >+ if self.args.arm: >+ extra += ['-device', 'virtio-gpu-pci'] >+ extra += ['-serial', 'mon:stdio'] > serial_msg = '' > print(f'Running {qemu}{serial_msg}') > > # Use 512MB since U-Boot EFI likes to have 256MB to play with >- cmd = [qemu, '-bios', os.path.join(efi_dir), bios)] >+ cmd = [qemu] > cmd += '-m', '512' >- cmd += '-drive', f'id=disk,file={self.img},if=none,format=raw' >- cmd += '-device', 'ahci,id=ahci' >- cmd += '-device', 'ide-hd,drive=disk,bus=ahci.0' > cmd += '-nic', 'none' > cmd += extra > command.run(*cmd) >@@ -229,6 +248,7 @@ class BuildEfi: > command.output(*cmd) > except command.CommandExc: > time.sleep(0.5) >+ cmd = 'sudo', 'kpartx', '-d', self.img > command.output(*cmd) > > def do_build(self, build): >@@ -244,15 +264,16 @@ class BuildEfi: > """This does all the work""" > args = self.args > bitness = 32 if args.word else 64 >+ arch = 'arm' if args.arm else 'x86' > build_type = 'payload' if args.payload else 'app' > self.tmp = f'{self.build_dir}/efi{bitness}{build_type}' >- build = f'efi-x86_{build_type}{bitness}' >+ build = f'efi-{arch}_{build_type}{bitness}' > > if not args.no_build: > self.do_build(build) > > if args.old and bitness == 32: >- build = f'efi-x86_{build_type}' >+ build = f'efi-{arch}_{build_type}' > > self.setup_files(build, build_type) >