The runqemu command is easy to use when MACHINE is set to one of the qemu* types. It would be nice to get the same ease of use, e.g. if MACHINE is set to beaglebone-yocto. Achieving this for ARM devices is no longer so difficult. If the kernel has support for Qemu's virtual architecture built in, everything almost works out of the box. When #13336 is merged, the wic image is suitable to be booted into Qemu, as is the case for the hardware device. This extension is especially useful for eSDk-based workflows. To provide users with an SDK suitable for both Qemu and target hardware development, two separate SDK builds are usually required: one for runqemu and one for the real hardware. With this extension, this would no longer be necessary for ARM devices. Step 1: Add a new kernel feature to activate CONFIG_ARCH_VIRT as well as some VIRTIO drivers. Step 2: Append the required QB_ bits to the beaglebone-yocto.conf file. runqemu and bitbake core-image-minimal -c testimage should run without errors. (Allmost all tests will be skipped in this combination)
Step 1: Kernel config feature has been sent to the mailing list: https://lists.yoctoproject.org/pipermail/linux-yocto/2019-June/007754.html Step 2: Is blocked until step 1 is merged. The patch is ready and will be sent to the mailing list if this enhancement gets accepted: diff --git a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf index 35814cd8f1..5991f50e0c 100644 --- a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf +++ b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf @@ -20,7 +20,7 @@ WKS_FILE ?= "beaglebone-yocto.wks" IMAGE_INSTALL_append = " kernel-devicetree kernel-image-zimage" do_image_wic[depends] += "mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot u-boot:do_deploy" -SERIAL_CONSOLES ?= "115200;ttyS0 115200;ttyO0" +SERIAL_CONSOLES ?= "115200;ttyS0 115200;ttyO0 115200;ttyAMA0" SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}" PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto" @@ -39,3 +39,21 @@ UBOOT_LOADADDRESS = "0x80008000" MACHINE_FEATURES = "usbgadget usbhost vfat alsa" IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} MLO zImage am335x-bone.dtb am335x-boneblack.dtb am335x-bonegreen.dtb" + +# support runqemu +EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" +IMAGE_CLASSES += "qemuboot" +QB_DEFAULT_FSTYPE = "wic" +QB_FSINFO = "wic:no-kernel-in-fs" +QB_KERNEL_ROOT = "/dev/vda2" +QB_SYSTEM_NAME = "qemu-system-arm" +QB_MEM = "-m 512" +QB_MACHINE = "-machine virt" +QB_CPU = "-cpu cortex-a15" +QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0 systemd.mask=systemd-networkd" +QB_OPT_APPEND = "-device virtio-rng-device -nographic" +QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no" +QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@" +QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" +QB_SERIAL_OPT = "" +QB_TCPSERIAL_OPT = "-device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon"
This would be convenient but it would require work to maintain and do QA for this machine. If this is accepted, are you able to commit to doing this work?
Hi Randy, It's a fair question. But I don't see much effort for maintenance. Of course I will try to keep this feature running in the future. But just to make that clear. It's not my intention to make "MACHINE=beaglebone runqemu" an important Yocto feature with QA and a build job on the autombuilder. I don't see much value in it, because qemuarm MACHINE is 99% equal and well maintained. The current situation is that runqemu does not work for MACHINE=beaglebone. I just want to fix this because it is easy to fix and could serve as a general example for booting ARM-based devices in Qemu without compiling an additional MACHINE such as qemuarm. My main goal is to be able to perform image tests on a CI infrastructure with as little additional build effort as possible. The patch will be very simple, without affecting anything else in Yocto. Regards, Adrian
A v2 kernel config for bb was sent to the list: https://lists.yoctoproject.org/pipermail/linux-yocto/2019-June/007768.html With this patch runqemu just runs, also with graphics.
2.8 is now 3.0 so fix up the Version and Milestone entries.