Building for demo with machine=qemux86-64

I’m evaluating Mender and Yocto for a project, so I try to reproduce the “Building for demo” tutorial. I first walked through the Yocto tutorial (Yocto Project Quick Build — The Yocto Project ® 4.2.999 documentation). Sato was reacting slow to mouse and keyboard inputs (might be a nested virtualization performance problem) so I used “core-image-full-cmdline” which is building and running fine.

Next step was to integrate meta-mender following Building for demo | Mender documentation.

I had to add the meta-openembedded layer (not mentioned in the tutorial) then I could add the mender layers and build without errors.

My configuration is identical to the tutorial:

conf/local.conf:

MENDER_ARTIFACT_NAME = "release-1"
INHERIT += "mender-full"
MACHINE = "qemux86-64"
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""
ARTIFACTIMG_FSTYPE = "ext4"
...
Other commonly useful commands are:
 - 'devtool' and 'recipetool' handle common recipe tasks
 - 'bitbake-layers' handles common layer tasks
 - 'oe-pkgdata-util' handles common target package tasks
marting@yoctodev:~/git/poky/build$ vim conf/local.conf 
marting@yoctodev:~/git/poky/build$ bitbake core-image-full-cmdline
Parsing recipes: 100% |############################################################################################################################################################################################################################################################| Time: 0:00:14
Parsing of 1602 .bb files complete (0 cached, 1602 parsed). 2420 targets, 70 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.15"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "my-dunfell:b6ce93d565cec4eca94da05f3b9bf7f6bf115b75"
meta-mender-core     = "dunfell:dd32419555fc9afe3616a4ee51bb421239dd86d5"
meta-oe              = "dunfell:fdd1dfe6b4b2412cc536c26450ce126c960d8107"
meta-mender-demo     = "dunfell:dd32419555fc9afe3616a4ee51bb421239dd86d5"

When trying to run the image with ../meta-mender/meta-mender-qemu/scripts/mender-qemu I got error messages that ovmf.qcow2 and ovmfw.vars.qcow2 are missing in poky/build/tmp/deploy/images/qemux86-64/.

So my first question is if I’m missing something already and the build is not running correctly to build all required files (i.e. the UEFI files)?

I tried to workaround the problem and copied the OVMF_CODE.fd and OVMF_VARS.fd from Ubuntu to the images directory. Additionaly I remove the parameter format=qcow2 for the UEFI-files.

With that modification mender-qemu starts booting the VM. Here’s the command the script is using

+ QEMU_AUDIO_DRV=none qemu-system-x86_64 -m 256M -drive file=/home/marting/git/poky/build/tmp/deploy/images/qemux86-64/ovmf.qcow2,if=pflash,unit=0,readonly=on -drive file=/home/marting/git/poky/build/tmp/deploy/images/qemux86-64/ovmf.vars.qcow2,if=pflash,unit=1 -net nic,macaddr=52:54:00:f3:96:a5 -net user,hostfwd=tcp::8822-:22 -display vnc=:23 -nographic -enable-kvm -drive file=/home/marting/git/poky/build/tmp/deploy/images/qemux86-64/core-image-full-cmdline-qemux86-64.uefiimg,if=ide,format=raw
WARNING: Image format was not specified for '/home/marting/git/poky/build/tmp/deploy/images/qemux86-64/ovmf.vars.qcow2' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.

Boot stops when the system is at Waiting for root device /dev/mmcblk0p2...

Looks like there’s no device/partition mmcblk0p2. Is mmcblk0 the correct device which the VM should be using for qemu-machine?

The image looks good (partition-wise):

$ fdisk -l core-image-full-cmdline-qemux86-64-20220424094129.uefiimg
Disk core-image-full-cmdline-qemux86-64-20220424094129.uefiimg: 608 MiB, 637534208 bytes, 1245184 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 3CC74233-E995-44EF-89D5-6DA02679861F

Device                                                      Start     End Sectors  Size Type
core-image-full-cmdline-qemux86-64-20220424094129.uefiimg1  16384   49151   32768   16M EFI System
core-image-full-cmdline-qemux86-64-20220424094129.uefiimg2  49152  507903  458752  224M Linux filesystem
core-image-full-cmdline-qemux86-64-20220424094129.uefiimg3 507904  966655  458752  224M Linux filesystem
core-image-full-cmdline-qemux86-64-20220424094129.uefiimg4 966656 1228799  262144  128M Linux filesystem

Hi @bug.spencor,

thanks a lot for the very detailed description. So first things first: the given bblayers.conf indicates that the meta-mender-qemu layer is not added to the build. This should is needed to set up the ovmf magic as to be seen here. Can you add it and see if it solves the situation?

For the documentation, yes I am aware of the missing meta-openembedde/meta-oe reference and will fix it.

If you run into more issues, please let me know.

Greetz,
Josef

Thanks Josef! Adding the layer meta-mender-qemu did the trick. The VM is booting now from /dev/hda and ovmf files seem to be generated now, too (according to the timestamps).

1 Like

@TheYoctoJester - I just ran into the missing openembedded-layer message yesterday. Is there a way to add this to the repo manifest and just sync? I’m not familiar with Google’s repo manager.

Thanks,
Paul