summaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
Commit message (Collapse)AuthorAgeFilesLines
* runqemu: match .rootfs. in addition to -image- for rootfsMikko Rapeli2024-01-041-1/+1
| | | | | | | | | | | | | | | | | Also change path.exists() and !path.isdir() to a single path.isfile() which should be equal. Enables running tests against image recipes which are not called "bla-image" but plain "bla". Currently they fail with do_testimage/runqemu error: runqemu - ERROR - Unknown path arg /home/builder/src/base/build/tmp_qemuarm64/deploy/images/qemuarm64/img-qemuarm64.rootfs.wic Suggested-by: Richard Purdie <richard.purdie@linuxfoundation.org> (From OE-Core rev: 107d0db3dc3678e6f0ae4035f4c0b86c6b421168) Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/runqemu: fix regex escape sequencesTrevor Gamblin2024-01-021-4/+4
| | | | | | | | | | | | | | | | | | | When invoking runqemu with Python 3.12, the following warning is encountered: |SyntaxWarning: invalid escape sequence '\.' This is because the interpreter scans the string before it is processed by the regex module, and it interprets the backslash as part of an escape sequence, but not a standard one. This will be registered as an error rather than a warning in future Python versions. To avoid the it, simply add an extra backslash so that Python doesn't misinterpret the string, while the regex parser still sees an escaped '.' character. (From OE-Core rev: 0e8a4142bb90a92d175df6b2537d24a372356f98) Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: add qmp socket supportRoss Burton2023-12-151-0/+11
| | | | | | | | | | Add support for qmp sockets and defaults to unix:qmp.sock if unspecified (From OE-Core rev: 380631797f0d63124a8c21efa93ab672dbd79283) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Eilís 'pidge' Ní Fhlannagáin <pidge@baylibre.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Add squashfs filesystem typesLogan Gunthorpe2023-10-231-1/+3
| | | | | | | | | | | | | When using a squashfs filesystem type, runqemu requires specifying the full path to the image because it doesn't list squashfs types in its fstypes variable. Add them to provide the same support as other filesystem types. (From OE-Core rev: c9c9a077e85b56f495f09187483548149f142a8d) Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu/qemurunner: Use nodelay with tcp serial connectionsRichard Purdie2023-10-101-2/+2
| | | | | | | | | This disables Nagle's algorithm for our tcp serial connections which may be causing data transfer issues. (From OE-Core rev: f8eff4c427881a98333fdf7c42f66ed6603e4f03) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scritps/runqemu: Ensure we only have two serial portsRichard Purdie2023-10-041-4/+13
| | | | | | | | | | | | | | | | | | | I have a theory that some of the console boot issues we're seeing are due to starting images with three serial ports yet only starting gettys on two of them. This means that occasionally, depending on the port numbering we may not get a login prompt on the console we expect it on. To fix this, change the runqemu code so that if serial ports are passed in on the commandline (as is the case in automated testing), we don't add any other GUI serial consoles. We do need to make sure we do have at least two serial ports since we don't want getty timeout warnings. (From OE-Core rev: 1b0348535dce3b776efbcf26406b94730a51eb85) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: check permissions of available render nodes as well as their presenceAlexander Kanavin2023-09-091-2/+12
| | | | | | | | | | | | | | | | | | | | | qemu itself is not helpful when render nodes exist, but can't be opened: qemu-system-x86_64: egl: render node init failed To fix this, users likely need to * modprobe vgem (presence when physical graphic card is absent or has a driver without support for render nodes, such as many older cards found in server machines) * add their user to "render" group to write to /dev/dri/renderD* (permissions) With this change runqemu should print hints for the above as appropriate from probing the nodes. (From OE-Core rev: acd85925cb197b7a31a25b60e8de762e2c3697ef) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemuboot/runqemu: Fix 6.2 and later kernel network device namingRichard Purdie2023-08-091-1/+1
| | | | | | | | | | | | | With kernel 6.2 and later network devices are renamed by systemd. This does not match with the current network device naming assumed in our configuration. We may or may not change that naming but for now, pass the right kernel commandline so things work as expected with newer kernels and removing a blocker on upgrading to the 6.4 kernel by default. (From OE-Core rev: 9e9c33d51e401fe2b4a632db74ccb3449e4b23ee) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: drop uid parameter for ifdownAdrian Freihofer2023-06-281-1/+1
| | | | | | (From OE-Core rev: 5f6f8f399b146615eeea8c2590f1588a8c150d13) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Fix automated call to runqemu-ifupAlejandro Hernandez Samaniego2023-06-281-1/+1
| | | | | | | | | | | | | | | | | | | When runqemu tries to call runqemu-ifup to create tap devices, it checks the output of runqemu-ifup to get the newly created tap device. The behavior of runqemu-ifup was recently modified along with its output, it no longer expects the uid parameter to be passed and it prints out a warning if it was, since this warning was now part of the output runqemu tries to parse it and convert it to an int() which proved impossible. Pass the correct arguments to the runqemu-ifup call and echo the warning to stderr instead to make sure its not being parsed and used by runqemu in any case. (From OE-Core rev: ce3a2f4cec28290c8e530989f17243f1ada4e3bd) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Stop using warn() since its been deprecatedAlejandro Hernandez Samaniego2023-06-281-2/+2
| | | | | | | | | logger.warn() has been deprecated, logger.warning() should be used instead. (From OE-Core rev: 9263497880b3154d65ed713498749f906534a055) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: configurable tap namesAdrian Freihofer2023-06-241-2/+6
| | | | | | | | | | Support the new environment variable OE_TAP_NAME. (From OE-Core rev: 6795dddb4074274279b7ff7b9639d15786f06a40) Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Stop passing bindir to the runqemu-ifup callAlejandro Hernandez Samaniego2023-06-211-1/+1
| | | | | | | | | | | | | | | | | | Since https://git.yoctoproject.org/poky/commit/?id=51063c1e6ac we need to pass exactly 2 arguments to runqemu-ifup, otherwise the script will return an error since bindir is no longer being used. However the call to runqemu-ifup from runqemu is still passing bindir as an argument resulting in the error mentioned above, remove the bindir argument to fix this issue. [YOCTO #15150] (From OE-Core rev: b9ef82727e719389b6d8ca2e9f642bfb328219b7) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandro@enedino.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/runqemu: allocate unfsd ports in a way that doesn't race or clash ↵Alexander Kanavin2023-06-151-11/+8
| | | | | | | | | | | | | | | | | | with unrelated processes There is already a neat check_free_port() function for finding an available port atomically, so use that and make two additional tweaks: - no need to allocate two separate ports; per unfsd documentation they can be the same - move lockfile release until after unfsd has been shut down and the port(s) used has been freed [YOCTO #15077] (From OE-Core rev: dee96e82fb04ea99ecd6c25513c7bd368df3bd37) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/runqemu: split lock dir creation into a reusable functionAlexander Kanavin2023-06-151-16/+13
| | | | | | | (From OE-Core rev: 004d6bcb067ecf1d796801fa43a98820c4efd3c7) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/runqemu: Add possibility to disable networkPavel Zhukov2023-04-201-1/+6
| | | | | | | | | | | | | | | Default network configuration requires tun/tap module and while being usable it conflicts with tap devices created by VPN clients sometimes and requires root permissions to use . While it's possible to work this around it's not always feasible if network is not required Add nonetwork option which can be specified if the network connectivity is not needed and SDL/serial is enough to communicate with the image. (From OE-Core rev: d4073dedbb234ff3c6bbebafc836fedf90d96569) Signed-off-by: Pavel Zhukov <pazhukov@suse.de> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: respect IMAGE_LINK_NAMEMartin Jansa2023-04-041-18/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | * when searching for qemuboot.conf * don't assume that IMAGE_LINK_NAME is always <rootfs>-<machine> (with <rootfs>-<machine>.qemuboot.conf) * runqemu: use IMAGE_LINK_NAME set by testimage.bbclass or query with bitbake -e * testimage.bbclass was setting DEPLOY_DIR which I don't see used anywhere else, so I assume it was supposed to be DEPLOY_DIR_IMAGE as mentioned in corresponding runqemu code, do the same with IMAGE_LINK_NAME variable * add virtual/kernel as bitbake -e target in run_bitbake_env to make sure IMAGE_LINK_NAME is defined (kernel-artifact-names.bbclass inherits image-artifact-names.bbclass as well) * improve .qemuboot.conf search 1st search for file matching the rootfs and only when not found try again with .rootfs suffix removed [YOCTO #12937] (From OE-Core rev: 716eb55bb963db7b02d985849cb025898aabc855) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Revert "runqemu: Add workaround for APIC hang on pre 4.15 kernels on qemux86"Khem Raj2023-03-301-5/+0
| | | | | | | | | | | | | | | | This reverts commit 82e67b82ea8e12aa0b7b9db1d84fec0436dec71b. It was commited as part of https://bugzilla.yoctoproject.org/show_bug.cgi?id=12301 for kernels < 4.15, as of now oldest builder kernel we have is 4.15 on ubuntu 18.04 so we should not require this workaround. Moreover, this fixes an smp problem with qemux86 where no matter what -smp <x> option is used, qemu always starts with single core. (From OE-Core rev: fa8a7c0608fc800c48d0ff1cd832ad63c51eeab1) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Fix TypeError when command failsJoshua Watt2023-03-251-5/+5
| | | | | | | | | | | | | | | | | | The commands passed to subprocess are tuples which when passed to a % format are treated as multiple format arguments instead of a single argument to be coerced by "%s". This results in a TypeError being raised with python claiming that not all arguments were consumed. Fix this by wrapping the command tuple in a str() call, as is done for the logging strings [YOCTO #15078] (From OE-Core rev: 3e5d04d9ebbee4e11fb39bf353b6d4c3133e166a) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Do not remove the -m option for loongarch64Jialing Zhang2023-03-231-1/+1
| | | | | | | | | (From OE-Core rev: 6f3583675d31b74a3ae1c7fae450ea1624acc2e7) Signed-off-by: Jialing Zhang <zhangjialing@loongson.cn> Signed-off-by: Qizheng Zhu <zhuqizheng@loongson.cn> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: direct mesa to use its own drivers, rather than ones provided by ↵Alexander Kanavin2023-03-221-24/+10
| | | | | | | | | | | | | | | | | host distro With mesa 23.0, it is not longer possible to use the host drivers, as mesa upstream has added strict checks for matching builds between drivers and libraries that load them. Add a check and a hint to runqemu so that there is a helpful error when there is no native/nativesdk opengl/virgl support. (From OE-Core rev: f0946844df7270fe368858d8929e6b380675b78b) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: get_first_file() rename cmd* to glob*Martin Jansa2023-03-221-18/+18
| | | | | | | | | | | | | | | | | | * to better indicate how it's used in get_first_file * cmd* is used in other places for actual shell commands to execute * RunQemuError('KERNEL not found: %s, %s or %s' % cmds) also looked weird to me, but that works (to my python-noob surprise) [YOCTO #12937] (From OE-Core rev: 7c26e9dcc999a7d6a365831c39d25d98890be6d0) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: add an option to enable guest-agent virtio deviceClément Péron2023-03-141-0/+14
| | | | | | | | | | | | Add support to the runqemu script for a new option, 'guestagent', that enables the virtio serial port for host-to-guest communication. (From OE-Core rev: 21a1e52079089c5bbeee8ffc9c504471f4a8732a) Signed-off-by: Brenda Streiff <brenda.streiff@ni.com> Signed-off-by: Clément Péron <peron.clem@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/runqemu: move render nodes check to runqemu from selftestAlexander Kanavin2023-02-271-0/+10
| | | | | | | | | | | | | | | | | | This will produce a more useful hint for those setting up or testing virgl headless: runqemu - ERROR - No render nodes found in /dev/dri: ['by-path', 'card0']. If /dev/dri/renderD* is absent due to lack of suitable GPU, 'modprobe vgem' will create one suitable for mesa llvmpipe software renderer. as qemu itself isn't helpful: alex@Zen2:/srv/storage/alex/yocto/build-64-alt$ qemu-system-x86_64 -display egl-headless qemu-system-x86_64: egl: no drm render node available qemu-system-x86_64: egl: render node init failed (From OE-Core rev: cbbada6a6c9b0a2e97f7395117dad986555f2db9) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: kill qemu if it hangsMikko Rapeli2023-02-231-9/+15
| | | | | | | | | | | | qemu doesn't always behave well and can hang too. kill it with force if it was still alive. Move clean up commands into cleanup() function. (From OE-Core rev: 079c2935d2f585ce49e1c7daab2155fcf0094c48) Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* base: add support for loongarch64Xiaotian Wu2023-02-041-1/+3
| | | | | | | (From OE-Core rev: 759baaceb4dd623d5da12ba0d01540fa080154ba) Signed-off-by: Xiaotian Wu <wuxiaotian@loongson.cn> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: add process of option QB_NFSROOTFS_EXTRA_OPTXiangyu Chen2023-01-261-1/+5
| | | | | | | | | | | | | | | | | | | | | This extra options to be appended to the nfs rootfs options in kernel boot arg. Example config with qemuppc64 in machine config: add r/w size in the nfs rootfs extra option: QB_NFSROOTFS_EXTRA_OPT = "wsize=524288,rsize=524288" re-build and runqemu with nfs again, we can observe the kernel command line added our defined value in QB_NFSROOTFS_EXTRA_OPT: Kernel command line: root=/dev/nfs nfsroot=10.0.2.2:/home/xchen5/testing/build/tmp-glibc/deploy/images/qemuppc64/testnfs,nfsvers=3,port=3049,tcp,mountport=3048,wsize=524288,rsize=524288 rw mem=256M ip=dhcp console=hvc0 console=hvc0 nohugevmalloc (From OE-Core rev: 43a97f5bf3f90c5c1fd603f7dca2b3db2c0e3040) Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: add QB_SETUP_CMD and QB_CLEANUP_CMDMikko Rapeli2022-12-211-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These enable running custom shell setup and cleanup commands before and after qemu. Enables machine configurations to for example run qemu with swtpm to emulate TPM devices. Example config with meta-tpm2 based swtpm in machine config: * image recipe depens on swtpm-native to get the native tools to PATH, same handling as qemu itself do_testimage[depends] += "swtpm-native:do_populate_sysroot" * startup commands for swtpm daemon, note that swtpm socket file has 107 character limit and absolute paths to build environment will not work QB_SETUP_CMD = " \ test -d '${IMAGE_BASENAME}_swtpm' || ( mkdir -p '${IMAGE_BASENAME}_swtpm' && \ swtpm_setup --tpmstate '${IMAGE_BASENAME}_swtpm' --tpm2 --pcr-banks sha256 ); \ swtpm socket --tpmstate dir='${IMAGE_BASENAME}_swtpm' \ --ctrl type=unixio,path='${IMAGE_BASENAME}_swtpm/swtpm-sock' \ --log level=40 --tpm2 -t -d \ " * qemu startup command in machine config is configured enable swtpm device QB_OPT_APPEND += "-chardev socket,id=chrtpm,path='${IMAGE_BASENAME}_swtpm/swtpm-sock' -tpmdev emulator,id=tpm0,chardev=chrtpm -device tpm-tis-device,tpmdev=tpm0" * in this case, swtpm daemon stops automatically with qemu machine, but QB_CLEANUP_CMD could be used to kill a specific process and wipe temporary files Now runqemu and testimage.bbclass can be used with swtpm. (From OE-Core rev: d5c38964a4458aa31ec37810773ecc4f5d410dbe) Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: do not hardcode the ip address of the nfs server when using tapAlexander Kanavin2022-11-291-1/+2
| | | | | | | | | | Rather, set it similarly to the overall network config. (From OE-Core rev: d5e2ef31b151825613b62e58034e81f72526a944) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: limit slirp host port forwarding to localhost 127.0.0.1Mikko Rapeli2022-11-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | With default slirp port forwarding config qemu listens on TCP ports 2222 and 2323 on all IP addresses available on the build host. Most use cases with runqemu only need it for localhost and it is not safe to run qemu images with root login without password enabled and listening on all available, possibly Internet reachable network interfaces. Limit qemu port forwarding to localhost 127.0.0.1 IP address. Now qemu machine SSH and telnet ports are only reachable from the build host machine, not full Internet. If qemu machine needs to be reachable from network, then it can be enabled via local.conf or machine config variable QB_SLIRP_OPT: QB_SLIRP_OPT = "-netdev user,id=net0,hostfwd=tcp::2222-:22" (From OE-Core rev: c6b1e3d50bf2feea80b70a42c6fad868fa9e6042) Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Do not perturb script environmentJoshua Watt2022-10-261-12/+14
| | | | | | | | | | | | | | | | | | | | | Instead of changing the script environment to affect the child processes, make a copy of the environment with modifications and pass that to subprocess. Specifically, when dri rendering is enabled, LD_PRELOAD was being passed to all processes created by the script which resulted in other commands (e.g. stty) exiting with a failure like: /bin/sh: symbol lookup error: sysroots-uninative/x86_64-linux/lib/librt.so.1: undefined symbol: __libc_unwind_link_get, version GLIBC_PRIVATE Making a copy of the environment fixes this because the LD_PRELOAD is now only passed to qemu itself. (From OE-Core rev: 2232599d330bd5f2a9e206b490196569ad855de8) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Fix gl-es argument from causing other arguments to be ignoredJoshua Watt2022-10-261-1/+1
| | | | | | | | | | | The code to parse arguments was inadvertently skipping all arguments in the elif block after gl-es if it was specified on the command line. (From OE-Core rev: 718bb8d56f6a24c86e67830a7d13af54df2ebb4e) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: display host uptime when startingAlexandre Belloni2022-09-121-0/+6
| | | | | | | | | | | In order to be able to debug issues on the host that have an impact on the guest, it is useful to get the uptime of the host while starting so we can match with the events in dmesg. Also include the uptime when cleaning up. (From OE-Core rev: 2d96499823f7de6e16a461426491e015ba63c1ec) Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Add missing space on default display optionMark Hatle2022-07-281-1/+1
| | | | | | | | | (From OE-Core rev: ee9428611fc38bc711b5b3e12cf0d3257b1b5680) Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org> Signed-off-by: Mark Hatle <mark.hatle@amd.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: add QB_KERNEL_CMDLINERaju Kumar Pothuraju2022-06-171-1/+6
| | | | | | | | | | | | | | | | runqemu auto generating the KERNEL_CMDLINE values and specifying using -append option to qemu boot command which will lead to override the kernel_cmdline/bootargs which are specified in DTB when using -dtb option. Add new macro QB_KERNEL_CMDLINE to specify not to add the runqemu generated KERNEL_CMDLINE values instead use which are in the DTB if value defined as 'none'. Add provision to override bootargs using # runqemu bootparams="root=/dev/ram0" (From OE-Core rev: 98f4bf980c378cc541b220d79ee006bf2fae9ae8) Signed-off-by: Raju Kumar Pothuraju <raju.kumar-pothuraju@xilinx.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Do not auto detect graphics if publicvnc is specifiedScott Murray2022-04-151-1/+3
| | | | | | | | | | | | | The graphics option auto detection logic added in 7f78bb7a was not checking if the publicvnc option had been specified, meaning that it would be ignored and the auto detection result used instead. Add setting a flag variable in the argument parsing and check it along with the ones for the other graphics backend options. (From OE-Core rev: 4b73b55c2d258768cda2bf7262ebb36bcb7fed5b) Signed-off-by: Scott Murray <scott.murray@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: Allow auto detection of the correct graphics optionsRichard Purdie2022-04-141-7/+26
| | | | | | | | | | | | | | | | | Running "runqemu qemux86 kvm" when qemu is configured for sdl and/or gtk display output currently leads to a poor user experience with no cursor and corrupted fonts in the gtk case. This is due to no options being passed to qemu which leads to the loss of the font envirornment variable and the show-cursor option. If the user hasn't specified a display type, grep the output of "qemu-system-xxx --help" for the display types and pick the "best" which ensures our config is passed in. That resolves the gtk font issue and the cursor issue with both sdl and gtk. (From OE-Core rev: 7f78bb7a7baf67b9226fb460ca9e12fde6ef40c8) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/runqemu: Fix memory limits for qemux86-64Richard Purdie2022-03-151-1/+1
| | | | | | | | | | When setting memory to 4GB, qemu is only running with 2GB for x86_64. Avoid this by removing the mem= option to the kernel and letting the qemu configuration handle it for x86 in a similar way to mips. (From OE-Core rev: 2fd53417eba354c31c058c4bb066bb882e098add) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts: Various typo/grammar/punctuation fixesRobert P. J. Day2022-03-021-8/+8
| | | | | | | | | | | | | | | | Among other things, fix misspellings of: - absolute - deprecated - suitable - handle and a bunch of other things. (From OE-Core rev: c3773cd6c44dfe82be9ecd248120e7d6c753f891) Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: preload uninative libraries when host gl drivers are in useAlexander Kanavin2022-02-071-0/+8
| | | | | | | | | | | | | | Some of the host distributions build the drivers in a way (RPATH/RUNPATH) that tricks uninative loader into loading pieces of the host libc, if the same pieces haven't been previously loaded by native binaries. Mixing the two libc versions leads to failures. This change ensures that the correct (uninative) versions are always in use. (From OE-Core rev: 39c10816d5ec9d9c7952d786d7a3f942d25d0c27) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemu: replace a gtk wrapper with directly setting environment from runqemuAlexander Kanavin2022-02-071-0/+1
| | | | | | | | | | | | | | | The wrapper is executed by host bash, and host bash refuses to run when pseudo libc is preloaded via LD_PRELOAD (which is the case when gl is enabled). Only the fontconfig setting is carried over as local testing showed that only that is necessary for the gui to look ok nowadays; adjust further if necessary. (From OE-Core rev: 34f152de14f803fcfe5c92c515bf585838bba10a) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemuboot/runqemu: fully form the ip= kernel parameterAlexander Kanavin2022-01-111-1/+1
| | | | | | | | | | | New systemd is actually parsing this in systemd-network-generator and fails if it is not fully formed. 'off' means 'static ip, do nothing': https://www.kernel.org/doc/Documentation/filesystems/nfs/nfsroot.txt (From OE-Core rev: 2cf12c8dde0f05917797f8b4a80883dc0647b95d) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: additional setting to force software rendering with sdl 2.0.18Alexander Kanavin2021-12-171-0/+1
| | | | | | | (From OE-Core rev: 282e28bec1419d4e34076234027f34af3a49e7b5) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: check the qemu PID has been set before kill()ing itRoss Burton2021-12-091-1/+2
| | | | | | | | | | | | If runqemu is killed, check that we have a valid PID for the qemu before sending a kill() to it. [ YOCTO #14651 ] (From OE-Core rev: 0f3afbd3a6a6bef668612f818517df7543c0a683) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: support rootfs mounted roAdrian Freihofer2021-11-131-1/+7
| | | | | | | | | | Optionally allow to set QB_KERNEL_ROOT to e.g. "/dev/vda ro" to mount the rootfs reay-only in Qemu. (From OE-Core rev: 448eb1fd21287ba16b17e9402ce040b86ae3638c) Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: work without SERIAL_CONSOLES being definedJon Mason2021-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Not all machine definitions need to have SERIAL_CONSOLES defined, but runqemu currently will fail with the following script error if not present: Traceback (most recent call last): File "/builder/meta-arm/poky/scripts/runqemu", line 1604, in main config.setup_final() File "/builder/meta-arm/poky/scripts/runqemu", line 1446, in setup_final self.setup_serial() File "/builder/meta-arm/poky/scripts/runqemu", line 1381, in setup_serial self.kernel_cmdline_script += ' console=%s' %entry.split(';')[1] IndexError: list index out of range To get around this issue, add a sanity check to runqemu to avoid the parsing of SERIAL_CONSOLES if empty. (From OE-Core rev: e8359000e765f876c041b6ccabe63f069f83efec) Signed-off-by: Jon Mason <jdmason@kudzu.us> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: unbreak non-gl displaysAlexander Kanavin2021-10-301-2/+9
| | | | | | | | | | | | | Correct two issues: 1. Looking for dri.pc is only needed when gl is enabled. 2. virtio-vga-gl works only when gl is enabled via -display, otherwise virtio-vga needs to be selected. (From OE-Core rev: d6d5fe44510d2087b735758ac85e804533a1778c) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: add DEPLOY_DIR_IMAGE replacement in QB_OPT_APPENDJon Mason2021-10-141-1/+1
| | | | | | | | | | | | Add the ability to replace DEPLOY_DIR_IMAGE with that path in QB_OPT_APPEND. This allows for anything present in DEPLOY_DIR_IMAGE to be passed into the qemu parameters. This is especially useful if you want to run multiple flash images (as -bios only allows for one). (From OE-Core rev: 1f0bec0421617e8aa9645c385195a755f0d44e75) Signed-off-by: Jon Mason <jdmason@kudzu.us> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* runqemu: correct vga-virtio option to keep virgl enabledAlexander Kanavin2021-10-111-1/+1
| | | | | | | | | | qemu 6.1 has (perhaps unintentionally) disabled virgl in -vga virtio: https://gitlab.com/qemu-project/qemu/-/issues/586 (From OE-Core rev: 2c6c7f0ff24da7060cea35f8ff89f2cabd96f2fb) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* qemu: add a hint on how to enable CPU render nodes when a suitable GPU is absentAlexander Kanavin2021-08-231-0/+2
| | | | | | | | | | | | | | | | | | | This is particularly useful for llvm-accelerated GL rendering from qemu guest to an offscreen buffer (accessible over vnc or spice) using llvmpipe on the host, rather than using unaccelerated swrast renderer in the guest. This is the best that can be done in the absence of a host GPU with render node support (such as old Matrox cards common in servers, or fully virtualized cloud environments with no GPU at all). Note: even though NVidia blob drivers do support render nodes, they do not support gbm (yet?), and so rendering will fall back to llvmpipe as well even when the system has a 3000 euro NVidia GPU. Cue Linus picture. (From OE-Core rev: 9b1daa173481f7f560e00e0dc22b4010ff1dc0ec) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>