Revert "Merge branch 'alpine-qemu' into 'master'"

This reverts merge request !1612
This commit is contained in:
Oliver Smith 2018-07-05 17:25:14 +00:00
parent 918f51b6b0
commit 6e21c44342
22 changed files with 6 additions and 1051 deletions

View file

@ -102,6 +102,7 @@ def command_qemu(args, arch, device, img_path, spice_enabled):
"""
Generate the full qemu command with arguments to run postmarketOS
"""
qemu_bin = which_qemu(args, arch)
deviceinfo = pmb.parse.deviceinfo(args, device=device)
cmdline = deviceinfo["kernel_cmdline"]
if args.cmdline:
@ -117,24 +118,7 @@ def command_qemu(args, arch, device, img_path, spice_enabled):
flavor = args.flavor
else:
flavor = pmb.chroot.other.kernel_flavors_installed(args, suffix)[0]
if args.host_qemu:
qemu_bin = which_qemu(args, arch)
env = {}
command = [qemu_bin]
else:
rootfs_native = args.work + "/chroot_native"
env = {"QEMU_MODULE_PATH": rootfs_native + "/usr/lib/qemu",
"GBM_DRIVERS_PATH": rootfs_native + "/usr/lib/xorg/modules/dri",
"LIBGL_DRIVERS_PATH": rootfs_native + "/usr/lib/xorg/modules/dri"}
command = [rootfs_native + "/lib/ld-musl-" +
args.arch_native + ".so.1"]
command += ["--library-path=" + rootfs_native + "/lib:" +
rootfs_native + "/usr/lib"]
command += [rootfs_native + "/usr/bin/qemu-system-" + arch]
command += ["-L", rootfs_native + "/usr/share/qemu/"]
command = [qemu_bin]
command += ["-kernel", rootfs + "/boot/vmlinuz-" + flavor]
command += ["-initrd", rootfs + "/boot/initramfs-" + flavor]
command += ["-append", '"' + cmdline + '"']
@ -198,7 +182,7 @@ def command_qemu(args, arch, device, img_path, spice_enabled):
command += ["-vga", "virtio"]
command += ["-display", args.qemu_display]
return (command, env)
return command
def resize_image(args, img_size_new, img_path):
@ -243,17 +227,6 @@ def sigterm_handler(number, frame):
" and killed the Qemu VM it was running.")
def install_depends(args, arch):
"""
Install any necessary qemu dependencies in native chroot
"""
depends = ["qemu", "qemu-system-" + arch, "qemu-ui-sdl", "qemu-ui-gtk",
"mesa-gl", "mesa-egl", "mesa-dri-ati", "mesa-dri-freedreno",
"mesa-dri-intel", "mesa-dri-nouveau", "mesa-dri-swrast",
"mesa-dri-virtio", "mesa-dri-vmwgfx"]
pmb.chroot.apk.install(args, depends)
def run(args):
"""
Run a postmarketOS image in qemu
@ -264,13 +237,12 @@ def run(args):
arch = pmb.parse.arch.uname_to_qemu(args.arch)
device = pmb.parse.arch.qemu_to_pmos_device(arch)
img_path = system_image(args, device)
install_depends(args, arch)
logging.info("Running postmarketOS in QEMU VM (" + arch + ")")
# Get the Qemu and spice commands
spice = command_spice(args)
spice_enabled = True if spice else False
qemu, env = command_qemu(args, arch, device, img_path, spice_enabled)
qemu = command_qemu(args, arch, device, img_path, spice_enabled)
# Workaround: Qemu runs as local user and needs write permissions in the
# system image, which is owned by root
@ -294,10 +266,9 @@ def run(args):
process = None
try:
signal.signal(signal.SIGTERM, sigterm_handler)
process = pmb.helpers.run.user(args, qemu,
background=spice_enabled, env=env)
process = pmb.helpers.run.user(args, qemu, background=spice_enabled)
if spice:
pmb.helpers.run.user(args, spice, env=env)
pmb.helpers.run.user(args, spice)
except KeyboardInterrupt:
# Don't show a trace when pressing ^C
pass