qemu/run: add support for EFI boot
This add support for EFI boot in pmb qemu, it can be enabled by specifying the --efi option. Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org> Reviewed-by: Caleb Connolly <kc@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230316192838.21431-3-clayton@craftyguy.net%3E
This commit is contained in:
parent
6c66bfb8aa
commit
d957710b49
|
@ -161,9 +161,13 @@ def command_qemu(args, arch, img_path, img_path_2nd=None):
|
||||||
command += ["-L", rootfs_native + "/usr/share/qemu/"]
|
command += ["-L", rootfs_native + "/usr/share/qemu/"]
|
||||||
|
|
||||||
command += ["-nodefaults"]
|
command += ["-nodefaults"]
|
||||||
command += ["-kernel", kernel]
|
# Only boot a kernel/initramfs directly when not doing EFI boot. This
|
||||||
command += ["-initrd", rootfs + "/boot/initramfs" + flavor_suffix]
|
# allows us to load/execute an EFI application on boot, and support
|
||||||
command += ["-append", shlex.quote(cmdline)]
|
# a wide variety of boot loaders.
|
||||||
|
if not args.efi:
|
||||||
|
command += ["-kernel", kernel]
|
||||||
|
command += ["-initrd", rootfs + "/boot/initramfs" + flavor_suffix]
|
||||||
|
command += ["-append", shlex.quote(cmdline)]
|
||||||
|
|
||||||
command += ["-smp", str(ncpus)]
|
command += ["-smp", str(ncpus)]
|
||||||
|
|
||||||
|
@ -200,6 +204,10 @@ def command_qemu(args, arch, img_path, img_path_2nd=None):
|
||||||
raise RuntimeError(f"Architecture {arch} not supported by this command"
|
raise RuntimeError(f"Architecture {arch} not supported by this command"
|
||||||
" yet.")
|
" yet.")
|
||||||
|
|
||||||
|
if args.efi:
|
||||||
|
command += ["-drive",
|
||||||
|
"if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF.fd"]
|
||||||
|
|
||||||
# Kernel Virtual Machine (KVM) support
|
# Kernel Virtual Machine (KVM) support
|
||||||
native = pmb.config.arch_native == args.deviceinfo["arch"]
|
native = pmb.config.arch_native == args.deviceinfo["arch"]
|
||||||
if args.qemu_kvm and native and os.path.exists("/dev/kvm"):
|
if args.qemu_kvm and native and os.path.exists("/dev/kvm"):
|
||||||
|
@ -304,6 +312,9 @@ def install_depends(args, arch):
|
||||||
depends.remove("qemu-hw-display-virtio-vga")
|
depends.remove("qemu-hw-display-virtio-vga")
|
||||||
depends.remove("qemu-ui-opengl")
|
depends.remove("qemu-ui-opengl")
|
||||||
|
|
||||||
|
if args.efi:
|
||||||
|
depends.append("ovmf")
|
||||||
|
|
||||||
pmb.chroot.apk.install(args, depends)
|
pmb.chroot.apk.install(args, depends)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue