2022-01-02 21:38:21 +00:00
|
|
|
# Copyright 2022 Pablo Castellano, Oliver Smith
|
2020-02-20 20:07:28 +00:00
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2017-08-09 20:26:40 +00:00
|
|
|
import logging
|
|
|
|
import os
|
2017-09-15 15:41:40 +00:00
|
|
|
import re
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
import signal
|
2018-07-09 20:50:20 +00:00
|
|
|
import shlex
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
import shutil
|
2017-08-09 20:26:40 +00:00
|
|
|
|
|
|
|
import pmb.build
|
|
|
|
import pmb.chroot
|
|
|
|
import pmb.chroot.apk
|
|
|
|
import pmb.chroot.other
|
|
|
|
import pmb.chroot.initfs
|
2017-09-03 14:01:21 +00:00
|
|
|
import pmb.config
|
2021-09-01 17:07:06 +00:00
|
|
|
import pmb.config.pmaports
|
2017-08-09 20:26:40 +00:00
|
|
|
import pmb.helpers.run
|
|
|
|
import pmb.parse.arch
|
2020-10-01 21:55:23 +00:00
|
|
|
import pmb.parse.cpuinfo
|
2017-08-09 20:26:40 +00:00
|
|
|
|
|
|
|
|
2020-03-05 21:59:29 +00:00
|
|
|
def system_image(args):
|
2017-08-09 20:26:40 +00:00
|
|
|
"""
|
2018-07-15 21:41:31 +00:00
|
|
|
Returns path to rootfs for specified device. In case that it doesn't
|
2017-08-09 20:26:40 +00:00
|
|
|
exist, raise and exception explaining how to generate it.
|
|
|
|
"""
|
2021-05-19 18:44:28 +00:00
|
|
|
path = f"{args.work}/chroot_native/home/pmos/rootfs/{args.device}.img"
|
2017-08-09 20:26:40 +00:00
|
|
|
if not os.path.exists(path):
|
2018-07-15 21:41:31 +00:00
|
|
|
logging.debug("Could not find rootfs: " + path)
|
2020-03-05 21:59:29 +00:00
|
|
|
raise RuntimeError("The rootfs has not been generated yet, please "
|
|
|
|
"run 'pmbootstrap install' first.")
|
2017-08-09 20:26:40 +00:00
|
|
|
return path
|
|
|
|
|
|
|
|
|
2020-12-14 17:48:09 +00:00
|
|
|
def create_second_storage(args):
|
|
|
|
"""
|
|
|
|
Generate a second storage image if it does not exist.
|
|
|
|
:returns: path to the image or None
|
|
|
|
"""
|
|
|
|
path = f"{args.work}/chroot_native/home/pmos/rootfs/{args.device}-2nd.img"
|
|
|
|
pmb.helpers.run.root(args, ["touch", path])
|
|
|
|
pmb.helpers.run.root(args, ["chmod", "a+w", path])
|
|
|
|
resize_image(args, args.second_storage, path)
|
|
|
|
return path
|
|
|
|
|
|
|
|
|
2021-09-20 10:00:13 +00:00
|
|
|
def which_qemu(arch):
|
2017-08-09 20:26:40 +00:00
|
|
|
"""
|
2017-08-10 23:58:28 +00:00
|
|
|
Finds the qemu executable or raises an exception otherwise
|
2017-08-09 20:26:40 +00:00
|
|
|
"""
|
|
|
|
executable = "qemu-system-" + arch
|
2017-08-10 23:58:28 +00:00
|
|
|
if shutil.which(executable):
|
2017-08-09 20:26:40 +00:00
|
|
|
return executable
|
2017-08-10 23:58:28 +00:00
|
|
|
else:
|
2017-08-09 20:26:40 +00:00
|
|
|
raise RuntimeError("Could not find the '" + executable + "' executable"
|
|
|
|
" in your PATH. Please install it in order to"
|
|
|
|
" run qemu.")
|
|
|
|
|
|
|
|
|
2019-02-08 18:23:17 +00:00
|
|
|
def create_gdk_loader_cache(args):
|
|
|
|
"""
|
|
|
|
Create a gdk loader cache that can be used for running GTK UIs outside of
|
|
|
|
the chroot.
|
|
|
|
"""
|
|
|
|
gdk_cache_dir = "/usr/lib/gdk-pixbuf-2.0/2.10.0/"
|
|
|
|
custom_cache_path = gdk_cache_dir + "loaders-pmos-chroot.cache"
|
|
|
|
rootfs_native = args.work + "/chroot_native"
|
|
|
|
if os.path.isfile(rootfs_native + custom_cache_path):
|
|
|
|
return rootfs_native + custom_cache_path
|
|
|
|
|
|
|
|
cache_path = gdk_cache_dir + "loaders.cache"
|
|
|
|
if not os.path.isfile(rootfs_native + cache_path):
|
|
|
|
raise RuntimeError("gdk pixbuf cache file not found: " + cache_path)
|
|
|
|
|
|
|
|
pmb.chroot.root(args, ["cp", cache_path, custom_cache_path])
|
|
|
|
cmd = ["sed", "-i", "-e",
|
2021-05-19 18:44:28 +00:00
|
|
|
f"s@\"{gdk_cache_dir}@\"{rootfs_native}{gdk_cache_dir}@",
|
2019-02-08 18:23:17 +00:00
|
|
|
custom_cache_path]
|
|
|
|
pmb.chroot.root(args, cmd)
|
|
|
|
return rootfs_native + custom_cache_path
|
|
|
|
|
|
|
|
|
2020-12-14 17:48:09 +00:00
|
|
|
def command_qemu(args, arch, img_path, img_path_2nd=None):
|
2017-08-09 20:26:40 +00:00
|
|
|
"""
|
|
|
|
Generate the full qemu command with arguments to run postmarketOS
|
|
|
|
"""
|
2020-03-05 21:59:29 +00:00
|
|
|
cmdline = args.deviceinfo["kernel_cmdline"]
|
2017-08-09 20:26:40 +00:00
|
|
|
if args.cmdline:
|
|
|
|
cmdline = args.cmdline
|
2020-03-05 22:59:40 +00:00
|
|
|
|
|
|
|
if "video=" not in cmdline:
|
|
|
|
cmdline += " video=" + args.qemu_video
|
|
|
|
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
logging.debug("Kernel cmdline: " + cmdline)
|
2017-08-09 20:26:40 +00:00
|
|
|
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
port_ssh = str(args.port)
|
2017-09-03 14:01:21 +00:00
|
|
|
|
2020-03-05 21:59:29 +00:00
|
|
|
suffix = "rootfs_" + args.device
|
2017-10-26 19:19:42 +00:00
|
|
|
rootfs = args.work + "/chroot_" + suffix
|
2021-08-18 23:31:59 +00:00
|
|
|
flavor = pmb.chroot.other.kernel_flavor_installed(args, suffix)
|
2021-09-01 17:07:06 +00:00
|
|
|
flavor_suffix = f"-{flavor}"
|
|
|
|
# Backwards compatibility with old mkinitfs (pma#660)
|
|
|
|
pmaports_cfg = pmb.config.pmaports.read_config(args)
|
|
|
|
if pmaports_cfg.get("supported_mkinitfs_without_flavors", False):
|
|
|
|
flavor_suffix = ""
|
|
|
|
|
2021-11-01 12:20:43 +00:00
|
|
|
# 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")
|
|
|
|
|
2020-10-01 21:55:23 +00:00
|
|
|
ncpus = os.cpu_count()
|
2018-07-06 19:50:59 +00:00
|
|
|
|
2021-04-04 17:57:57 +00:00
|
|
|
# QEMU mach-virt's max CPU count is 8, limit it so it will work correctly
|
|
|
|
# on systems with more than 8 CPUs
|
2021-10-16 16:33:27 +00:00
|
|
|
if arch != pmb.config.arch_native and ncpus > 8:
|
2021-04-04 17:57:57 +00:00
|
|
|
ncpus = 8
|
|
|
|
|
2018-07-06 19:50:59 +00:00
|
|
|
if args.host_qemu:
|
2021-09-20 10:00:13 +00:00
|
|
|
qemu_bin = which_qemu(arch)
|
2018-07-06 19:50:59 +00:00
|
|
|
env = {}
|
|
|
|
command = [qemu_bin]
|
|
|
|
else:
|
|
|
|
rootfs_native = args.work + "/chroot_native"
|
2021-05-19 18:44:28 +00:00
|
|
|
env = {"QEMU_MODULE_DIR": f"{rootfs_native}/usr/lib/qemu",
|
|
|
|
"GBM_DRIVERS_PATH": f"{rootfs_native}/usr/lib/xorg/modules/dri",
|
|
|
|
"LIBGL_DRIVERS_PATH": f"{rootfs_native}"
|
|
|
|
"/usr/lib/xorg/modules/dri"}
|
2018-07-06 19:50:59 +00:00
|
|
|
|
2019-02-08 18:23:17 +00:00
|
|
|
if "gtk" in args.qemu_display:
|
|
|
|
gdk_cache = create_gdk_loader_cache(args)
|
|
|
|
env.update({"GTK_THEME": "Default",
|
|
|
|
"GDK_PIXBUF_MODULE_FILE": gdk_cache,
|
|
|
|
"XDG_DATA_DIRS": rootfs_native + "/usr/local/share:" +
|
|
|
|
rootfs_native + "/usr/share"})
|
|
|
|
|
2020-10-01 21:55:23 +00:00
|
|
|
command = []
|
2021-10-16 16:33:27 +00:00
|
|
|
if pmb.config.arch_native in ["aarch64", "armv7"]:
|
2021-05-19 18:44:28 +00:00
|
|
|
# Workaround for QEMU failing on aarch64 asymetric multiprocessor
|
|
|
|
# arch (big/little architecture
|
|
|
|
# https://en.wikipedia.org/wiki/ARM_big.LITTLE) see
|
|
|
|
# https://bugs.linaro.org/show_bug.cgi?id=1443
|
2020-10-01 21:55:23 +00:00
|
|
|
ncpus_bl = pmb.parse.cpuinfo.arm_big_little_first_group_ncpus()
|
|
|
|
if ncpus_bl:
|
|
|
|
ncpus = ncpus_bl
|
|
|
|
logging.info("QEMU will run on big/little architecture on the"
|
|
|
|
f" first {ncpus} cores (from /proc/cpuinfo)")
|
|
|
|
command += [rootfs_native + "/lib/ld-musl-" +
|
2021-10-16 16:33:27 +00:00
|
|
|
pmb.config.arch_native + ".so.1"]
|
2020-10-01 21:55:23 +00:00
|
|
|
command += [rootfs_native + "/usr/bin/taskset"]
|
|
|
|
command += ["-c", "0-" + str(ncpus - 1)]
|
|
|
|
|
|
|
|
command += [rootfs_native + "/lib/ld-musl-" +
|
2021-10-16 16:33:27 +00:00
|
|
|
pmb.config.arch_native + ".so.1"]
|
2018-07-06 19:50:59 +00:00
|
|
|
command += ["--library-path=" + rootfs_native + "/lib:" +
|
2019-12-07 00:11:22 +00:00
|
|
|
rootfs_native + "/usr/lib:" +
|
|
|
|
rootfs_native + "/usr/lib/pulseaudio"]
|
2018-07-06 19:50:59 +00:00
|
|
|
command += [rootfs_native + "/usr/bin/qemu-system-" + arch]
|
|
|
|
command += ["-L", rootfs_native + "/usr/share/qemu/"]
|
|
|
|
|
2020-03-05 22:35:50 +00:00
|
|
|
command += ["-nodefaults"]
|
2021-11-01 12:20:43 +00:00
|
|
|
command += ["-kernel", kernel]
|
2021-09-01 17:07:06 +00:00
|
|
|
command += ["-initrd", rootfs + "/boot/initramfs" + flavor_suffix]
|
2018-07-09 20:50:20 +00:00
|
|
|
command += ["-append", shlex.quote(cmdline)]
|
2020-03-05 22:06:29 +00:00
|
|
|
|
2020-10-01 21:55:23 +00:00
|
|
|
command += ["-smp", str(ncpus)]
|
|
|
|
|
2017-08-09 20:26:40 +00:00
|
|
|
command += ["-m", str(args.memory)]
|
2020-03-05 22:35:50 +00:00
|
|
|
|
|
|
|
command += ["-serial", "stdio"]
|
2020-12-14 17:48:09 +00:00
|
|
|
|
2020-03-05 22:35:50 +00:00
|
|
|
command += ["-drive", "file=" + img_path + ",format=raw,if=virtio"]
|
2020-12-14 17:48:09 +00:00
|
|
|
if img_path_2nd:
|
|
|
|
command += ["-drive", "file=" + img_path_2nd + ",format=raw,if=virtio"]
|
|
|
|
|
2020-03-05 22:49:33 +00:00
|
|
|
if args.qemu_tablet:
|
|
|
|
command += ["-device", "virtio-tablet-pci"]
|
|
|
|
else:
|
|
|
|
command += ["-device", "virtio-mouse-pci"]
|
2020-03-05 22:35:50 +00:00
|
|
|
command += ["-device", "virtio-keyboard-pci"]
|
|
|
|
command += ["-nic",
|
|
|
|
"user,model=virtio-net-pci,"
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
"hostfwd=tcp::" + port_ssh + "-:22,"
|
2017-09-03 14:01:21 +00:00
|
|
|
]
|
2017-08-09 20:26:40 +00:00
|
|
|
|
|
|
|
if arch == "x86_64":
|
pmb.qemu: always use virtio-gpu (!1886)
So far we tried to configure virtio-gpu using "-vga virtio" only
when the target architecture matches the host architecture.
But that's actually not what it depends on.
virtio-gpu and virgl can be also used when emulating a foreign
architecture. In fact, we already force usage of virtio-gpu for
aarch64 through "-device virtio-gpu-pci".
However, the "-vga virtio" parameter does not exist on aarch64,
no matter if we run QEMU natively on aarch64 or emulate it on x86_64.
(Apparently, -vga is mainly about legacy VGA framebuffer stuff that
we don't necessarily need. This is quite visible since the display
stays uninitialized on aarch64 until the kernel driver loads,
whereas on x86_64 it is initialized by the BIOS...)
In other words, "-vga virtio" belongs to the parameters specific to x86_64.
Now that we have removed the setup question for the Mesa driver to use
(since it was ineffective), it would still be nice to have some way to
choose if you want to use virtio-gpu/virgl or not.
But actually virtio-gpu can be also used with swrast, without virgl.
This happens automatically when QEMU is started without GL support.
We already have a --display parameter for this, so it is possible to
force swrast by using "--display sdl" (instead of the default sdl,gl=on).
Overall this allows simplifying the QEMU package setup because there is
only a single GPU driver in use (virtio-gpu) instead of the 3 we had before
(virtio, qxl, bochs).
2020-03-05 21:01:12 +00:00
|
|
|
command += ["-vga", "virtio"]
|
2017-08-09 20:26:40 +00:00
|
|
|
elif arch == "aarch64":
|
|
|
|
command += ["-M", "virt"]
|
|
|
|
command += ["-cpu", "cortex-a57"]
|
|
|
|
command += ["-device", "virtio-gpu-pci"]
|
|
|
|
else:
|
2021-05-19 18:44:28 +00:00
|
|
|
raise RuntimeError(f"Architecture {arch} not supported by this command"
|
|
|
|
" yet.")
|
2017-08-09 20:26:40 +00:00
|
|
|
|
|
|
|
# Kernel Virtual Machine (KVM) support
|
2021-10-16 16:33:27 +00:00
|
|
|
native = pmb.config.arch_native == args.deviceinfo["arch"]
|
2020-03-10 15:06:56 +00:00
|
|
|
if args.qemu_kvm and native and os.path.exists("/dev/kvm"):
|
2017-08-09 20:26:40 +00:00
|
|
|
command += ["-enable-kvm"]
|
2020-03-10 15:14:50 +00:00
|
|
|
command += ["-cpu", "host"]
|
2017-08-09 20:26:40 +00:00
|
|
|
else:
|
2019-07-03 21:01:56 +00:00
|
|
|
logging.info("WARNING: QEMU is not using KVM and will run slower!")
|
2017-08-09 20:26:40 +00:00
|
|
|
|
2020-03-10 15:14:50 +00:00
|
|
|
if args.qemu_cpu:
|
|
|
|
command += ["-cpu", args.qemu_cpu]
|
|
|
|
|
2020-03-05 21:36:06 +00:00
|
|
|
display = args.qemu_display
|
|
|
|
if display != "none":
|
|
|
|
display += ",gl=" + ("on" if args.qemu_gl else "off")
|
|
|
|
|
2021-05-02 11:43:51 +00:00
|
|
|
# Separate -show-cursor option is deprecated. If your host qemu fails here,
|
|
|
|
# it's old (#1995).
|
|
|
|
command += ["-display", f"{display},show-cursor=on"]
|
2017-09-26 20:52:00 +00:00
|
|
|
|
2019-12-07 00:11:22 +00:00
|
|
|
# Audio support
|
2020-01-13 09:05:26 +00:00
|
|
|
if args.qemu_audio:
|
|
|
|
command += ["-audiodev", args.qemu_audio + ",id=audio"]
|
|
|
|
command += ["-soundhw", "hda"]
|
2019-12-07 00:11:22 +00:00
|
|
|
|
2018-07-06 19:50:59 +00:00
|
|
|
return (command, env)
|
2017-08-09 20:26:40 +00:00
|
|
|
|
|
|
|
|
2017-09-15 15:41:40 +00:00
|
|
|
def resize_image(args, img_size_new, img_path):
|
|
|
|
"""
|
2020-12-14 18:15:03 +00:00
|
|
|
Truncates an image to a specific size. The value must be larger than the
|
|
|
|
current image size, and it must be specified in MiB or GiB units (powers of
|
|
|
|
1024).
|
2017-09-15 15:41:40 +00:00
|
|
|
|
|
|
|
:param img_size_new: new image size in M or G
|
2020-12-14 18:15:03 +00:00
|
|
|
:param img_path: the path to the image
|
2017-09-15 15:41:40 +00:00
|
|
|
"""
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
# Current image size in bytes
|
2017-09-15 15:41:40 +00:00
|
|
|
img_size = os.path.getsize(img_path)
|
|
|
|
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
# Make sure we have at least 1 integer followed by either M or G
|
2017-09-15 15:41:40 +00:00
|
|
|
pattern = re.compile("^[0-9]+[M|G]$")
|
|
|
|
if not pattern.match(img_size_new):
|
2020-12-14 18:15:03 +00:00
|
|
|
raise RuntimeError("IMAGE_SIZE must be in [M]iB or [G]iB, e.g. 2048M"
|
|
|
|
" or 2G")
|
2017-09-15 15:41:40 +00:00
|
|
|
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
# Remove M or G and convert to bytes
|
2017-09-15 15:41:40 +00:00
|
|
|
img_size_new_bytes = int(img_size_new[:-1]) * 1024 * 1024
|
|
|
|
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
# Convert further for G
|
2017-09-15 15:41:40 +00:00
|
|
|
if (img_size_new[-1] == "G"):
|
|
|
|
img_size_new_bytes = img_size_new_bytes * 1024
|
|
|
|
|
|
|
|
if (img_size_new_bytes >= img_size):
|
2020-12-14 18:15:03 +00:00
|
|
|
logging.info(f"Resize image to {img_size_new}: {img_path}")
|
2017-09-15 15:41:40 +00:00
|
|
|
pmb.helpers.run.root(args, ["truncate", "-s", img_size_new, img_path])
|
|
|
|
else:
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
# Convert to human-readable format
|
2021-05-19 18:44:28 +00:00
|
|
|
# NOTE: We convert to M here, and not G, so that we don't have to
|
|
|
|
# display a size like 1.25G, since decimal places are not allowed by
|
|
|
|
# truncate.
|
2017-09-15 15:41:40 +00:00
|
|
|
# We don't want users thinking they can use decimal numbers, and so in
|
2021-05-19 18:44:28 +00:00
|
|
|
# this example, they would need to use a size greater then 1280M
|
|
|
|
# instead.
|
2017-09-15 15:41:40 +00:00
|
|
|
img_size_str = str(round(img_size / 1024 / 1024)) + "M"
|
|
|
|
|
2020-12-14 18:15:03 +00:00
|
|
|
raise RuntimeError(f"IMAGE_SIZE must be {img_size_str} or greater")
|
2017-09-15 15:41:40 +00:00
|
|
|
|
|
|
|
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
def sigterm_handler(number, frame):
|
|
|
|
raise RuntimeError("pmbootstrap was terminated by another process,"
|
2019-07-03 21:01:56 +00:00
|
|
|
" and killed the QEMU VM it was running.")
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
|
|
|
|
|
2018-07-06 19:50:59 +00:00
|
|
|
def install_depends(args, arch):
|
|
|
|
"""
|
|
|
|
Install any necessary qemu dependencies in native chroot
|
|
|
|
"""
|
2020-12-16 22:08:50 +00:00
|
|
|
depends = [
|
|
|
|
"mesa-dri-classic",
|
|
|
|
"mesa-dri-gallium",
|
|
|
|
"mesa-egl",
|
|
|
|
"mesa-gl",
|
|
|
|
"qemu",
|
|
|
|
"qemu-audio-alsa",
|
|
|
|
"qemu-audio-pa",
|
|
|
|
"qemu-audio-sdl",
|
2020-12-16 22:14:15 +00:00
|
|
|
"qemu-hw-display-virtio-gpu",
|
|
|
|
"qemu-hw-display-virtio-gpu-pci",
|
|
|
|
"qemu-hw-display-virtio-vga",
|
2020-12-16 22:08:50 +00:00
|
|
|
"qemu-system-" + arch,
|
|
|
|
"qemu-ui-gtk",
|
2020-12-16 22:14:15 +00:00
|
|
|
"qemu-ui-opengl",
|
2020-12-16 22:08:50 +00:00
|
|
|
"qemu-ui-sdl",
|
|
|
|
]
|
2021-01-02 10:19:03 +00:00
|
|
|
|
|
|
|
# QEMU packaging isn't split up as much in 3.12
|
|
|
|
channel_cfg = pmb.config.pmaports.read_config_channel(args)
|
|
|
|
if channel_cfg["branch_aports"] == "3.12-stable":
|
|
|
|
depends.remove("qemu-hw-display-virtio-gpu")
|
|
|
|
depends.remove("qemu-hw-display-virtio-gpu-pci")
|
|
|
|
depends.remove("qemu-hw-display-virtio-vga")
|
|
|
|
depends.remove("qemu-ui-opengl")
|
|
|
|
|
2018-07-06 19:50:59 +00:00
|
|
|
pmb.chroot.apk.install(args, depends)
|
|
|
|
|
|
|
|
|
2017-08-09 20:26:40 +00:00
|
|
|
def run(args):
|
|
|
|
"""
|
|
|
|
Run a postmarketOS image in qemu
|
|
|
|
"""
|
2020-03-05 21:59:29 +00:00
|
|
|
if not args.device.startswith("qemu-"):
|
|
|
|
raise RuntimeError("'pmbootstrap qemu' can be only used with one of "
|
|
|
|
"the QEMU device packages. Run 'pmbootstrap init' "
|
|
|
|
"and select the 'qemu' vendor.")
|
|
|
|
arch = pmb.parse.arch.alpine_to_qemu(args.deviceinfo["arch"])
|
|
|
|
|
|
|
|
img_path = system_image(args)
|
2020-12-14 17:48:09 +00:00
|
|
|
img_path_2nd = None
|
|
|
|
if args.second_storage:
|
|
|
|
img_path_2nd = create_second_storage(args)
|
|
|
|
|
2018-09-01 11:14:52 +00:00
|
|
|
if not args.host_qemu:
|
|
|
|
install_depends(args, arch)
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
logging.info("Running postmarketOS in QEMU VM (" + arch + ")")
|
|
|
|
|
2020-12-14 17:48:09 +00:00
|
|
|
qemu, env = command_qemu(args, arch, img_path, img_path_2nd)
|
2017-08-09 20:26:40 +00:00
|
|
|
|
2019-07-03 21:01:56 +00:00
|
|
|
# Workaround: QEMU runs as local user and needs write permissions in the
|
2018-07-15 21:41:31 +00:00
|
|
|
# rootfs, which is owned by root
|
2017-08-09 20:26:40 +00:00
|
|
|
if not os.access(img_path, os.W_OK):
|
|
|
|
pmb.helpers.run.root(args, ["chmod", "666", img_path])
|
|
|
|
|
2018-07-15 21:41:31 +00:00
|
|
|
# Resize the rootfs (or show hint)
|
2017-09-15 15:41:40 +00:00
|
|
|
if args.image_size:
|
|
|
|
resize_image(args, args.image_size, img_path)
|
|
|
|
else:
|
|
|
|
logging.info("NOTE: Run 'pmbootstrap qemu --image-size 2G' to set"
|
2018-07-15 21:41:31 +00:00
|
|
|
" the rootfs size when you run out of space!")
|
2017-09-15 15:41:40 +00:00
|
|
|
|
2020-03-06 11:22:46 +00:00
|
|
|
# SSH/serial hints
|
|
|
|
logging.info("Connect to the VM:")
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
logging.info("* (ssh) ssh -p {port} {user}@localhost".format(**vars(args)))
|
2020-03-06 11:22:46 +00:00
|
|
|
logging.info("* (serial) in this console (stdout/stdin)")
|
2017-09-26 20:52:00 +00:00
|
|
|
|
2020-03-05 13:23:17 +00:00
|
|
|
# Run QEMU and kill it together with pmbootstrap
|
Close #453: Support mesa-dri-virtio in Qemu (#861)
The mesa driver, which ends up in the installation image, needs to be known
before the installation is done (in other words: when running the qemu action,
it is to late as the image has already been generated). That's why one can
choose the Qemu mesa driver in `pmbootstrap init` now:
```
Device [qemu-amd64]:
Which mesa driver do you prefer for your Qemu device? Only select something other
than the default if you are having graphical problems (such as glitches).
Mesa driver (dri-swrast/dri-virtio) [dri-virtio]:
```
It is still possible to select `dri-swrast`, because `dri-virtio` may not work
in all cases, and that way we could easily debug it or experiment with other
mesa drivers (e.g. the "vmware" one, which is supported by mesa and Qemu).
Other changes:
* `pmbootstrap qemu` accepts a `--display` variable now, which passes the value
directly to `qemu`'s `display` option. It defaults to `sdl,gl=on` (@PureTryOut
reported that to work best with plasma mobile on his PC). `--display` and
`--spice` (which is still working) are mutually exclusive.
* Removed obsolete telnet port pass-through: We only use the debug telnet port
since osk-sdl has been merged.
* Add show-cursor to the Qemu command line, so it shows a cursor in X11
* Refactored the spice code (`command_spice` only returns the spice command,
because it has all necessary information already) and the spice port can be
specified on the commandline now (previously it was hardcoded in one place and
then always looked up from there).
* Start comments with capital letters.
* Keep the log on the screen a bit shorter (e.g. Qemu command is written to the
"pmbootstrap log" anyway, so there's no need to display it again).
* linux-postmarketos-stable: Adjust kernel configs
x86_64, armhf: enable as modules:
CONFIG_DRM_VIRTIO_GPU, CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_BALLOON
aarch64: all 3 options were already enabled as built-in (no change)
* Set '-vga virtio' for mesa-dri-virtio
2017-11-05 13:48:49 +00:00
|
|
|
process = None
|
2017-09-26 20:52:00 +00:00
|
|
|
try:
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
signal.signal(signal.SIGTERM, sigterm_handler)
|
2020-03-12 18:28:31 +00:00
|
|
|
process = pmb.helpers.run.user(args, qemu, output="tui", env=env)
|
2017-09-26 20:52:00 +00:00
|
|
|
except KeyboardInterrupt:
|
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)
* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
built before running tests (otherwise tests would hang without any output
while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
plasma-mobile currently, easy to extend), runs it via Qemu and checks the
running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
our source tree, so we don't need to clone their git repo anymore. Now it
is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.
* Various fixes
* Build device-packages for the device arch and don't raise an
exception, but print a note if --ignore-depends is not specified
and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
|
|
|
# Don't show a trace when pressing ^C
|
2017-09-26 20:52:00 +00:00
|
|
|
pass
|
|
|
|
finally:
|
|
|
|
if process:
|
|
|
|
process.terminate()
|