pmb.qemu.run: workaround for new mkinitfs requirements (MR 2138)

It's been 3 months since we switched to new mkinitfs
and we are still fixing consequences.

linux-lts and linux-virt used by qemu-amd64 device package
install vmlinuz-lts (vmlinuz-virt). And qemu run cmdline
passed -kernel vmlinuz which makes it impossible to run
qemu without this change.

With this change proper kernel arg is passed to qemu.

Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
Signed-off-by: Alexey Min <alexeymin@postmarketos.org>
This commit is contained in:
Alexey Min 2021-11-01 15:20:43 +03:00 committed by Oliver Smith
parent 7541a0ca36
commit 0664a38190
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 8 additions and 1 deletions

View File

@ -104,6 +104,13 @@ def command_qemu(args, arch, img_path, img_path_2nd=None):
if pmaports_cfg.get("supported_mkinitfs_without_flavors", False):
flavor_suffix = ""
# Alpine kernels always have the flavor appended to /boot/vmlinuz
kernel = f"{rootfs}/boot/vmlinuz{flavor_suffix}"
if not os.path.exists(kernel):
kernel = f"{kernel}-{flavor}"
if not os.path.exists(kernel):
raise RuntimeError("failed to find the proper vmlinuz path")
ncpus = os.cpu_count()
# QEMU mach-virt's max CPU count is 8, limit it so it will work correctly
@ -154,7 +161,7 @@ def command_qemu(args, arch, img_path, img_path_2nd=None):
command += ["-L", rootfs_native + "/usr/share/qemu/"]
command += ["-nodefaults"]
command += ["-kernel", rootfs + "/boot/vmlinuz" + flavor_suffix]
command += ["-kernel", kernel]
command += ["-initrd", rootfs + "/boot/initramfs" + flavor_suffix]
command += ["-append", shlex.quote(cmdline)]