# Building for demo with machine=qemux86-64

**URL:** <https://hub.mender.io/t/building-for-demo-with-machine-qemux86-64/4891>\
**Category:** General Discussions\
**Tags:** qemu, qemux86-64\
**Created:** [April 24, 2022, 10:16am UTC](https://hub.mender.io/t/building-for-demo-with-machine-qemux86-64/4891 "2022-04-24T10:16:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bug.spencor](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@bug.spencor](https://hub.mender.io/u/bug.spencor)\
**Post date:** [April 24, 2022, 10:16am UTC](https://hub.mender.io/t/building-for-demo-with-machine-qemux86-64/4891/1 "2022-04-24T10:16:21Z")

</div>

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](https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html#)). 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](https://docs.mender.io/3.1/system-updates-yocto-project/build-for-demo).

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:

```auto
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"
...

```

```auto
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

```auto
+ 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):

```auto
$ 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

```

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [April 25, 2022, 10:49am UTC](https://hub.mender.io/t/building-for-demo-with-machine-qemux86-64/4891/2 "2022-04-25T10:49:08Z")

</div>

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](https://github.com/mendersoftware/meta-mender/blob/1dbb4b07a057045b4b60e26a5eefcac764abb7c4/meta-mender-qemu/conf/layer.conf#L19). 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

---

<div class="post-metadata">

**Author:** ![bug.spencor](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@bug.spencor](https://hub.mender.io/u/bug.spencor)\
**Post date:** [April 25, 2022, 3:57pm UTC](https://hub.mender.io/t/building-for-demo-with-machine-qemux86-64/4891/3 "2022-04-25T15:57:58Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![paulobear](https://avatars.discourse-cdn.com/v4/letter/p/2acd7d/32.png) [@paulobear](https://hub.mender.io/u/paulobear)\
**Post date:** [May 24, 2022, 4:26pm UTC](https://hub.mender.io/t/building-for-demo-with-machine-qemux86-64/4891/4 "2022-05-24T16:26:02Z")

</div>

@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
