# Unable to build qemu image

**URL:** <https://hub.mender.io/t/unable-to-build-qemu-image/7258>\
**Category:** General Discussions\
**Tags:** yocto, raspberry-pi-5, scarthgap\
**Created:** [October 21, 2024, 7:31pm UTC](https://hub.mender.io/t/unable-to-build-qemu-image/7258 "2024-10-21T19:31:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidlekve](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@davidlekve](https://hub.mender.io/u/davidlekve)\
**Post date:** [October 21, 2024, 7:31pm UTC](https://hub.mender.io/t/unable-to-build-qemu-image/7258/1 "2024-10-21T19:31:30Z")

</div>

Hi!

I have set up the board integration for raspberry pi 5, and want to build a qemu image based on this project.

I get the error: \* opkg\_solver\_install: No candidates to install kernel-devicetree (null)!

This is the whole output:

~/mender-raspberrypi5/meta-mender-community/my-raspberrypi5/build$ MACHINE=qemuarm64 bitbake core-image-base  
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:00  
Loaded 4701 entries from dependency cache.  
NOTE: Resolving any missing task queue dependencies

Build Configuration:  
BB\_VERSION = “2.8.0”  
BUILD\_SYS = “x86\_64-linux”  
NATIVELSBSTRING = “universal”  
TARGET\_SYS = “aarch64-poky-linux”  
MACHINE = “qemuarm64”  
DISTRO = “poky”  
DISTRO\_VERSION = “5.0.2”  
TUNE\_FEATURES = “aarch64 crc cortexa57”  
TARGET\_FPU = “”  
meta-mender-raspberrypi = “scarthgap:3fc71db2ad10034855c84b285127dade0d9a56ba”  
meta-lts-mixins = “HEAD:66ceeebd047d7fdfc8668b300319a76da8ae257d”  
meta-mender-core = “HEAD:b3754de176ad9b87afc7fe950a8b335eb8f64106”  
meta-oe  
meta-networking  
meta-python = “HEAD:78a14731cf0cf38a19ff8bd0e9255b319afaf3a7”  
meta-raspberrypi = “HEAD:1918a27419dcd5e79954c0dc0edddcde91057a7e”  
meta  
meta-poky  
meta-yocto-bsp = “HEAD:7fb368604c5c7295a910ffd2d8dba7b9f00b8462”

Sstate summary: Wanted 215 Local 211 Mirrors 0 Missed 4 Current 2571 (98% match, 99% complete)############################################################################## | ETA: 0:00:00  
Removing 2 stale sstate objects for arch qemuarm64: 100% |###################################################################################################################################| Time: 0:00:00  
NOTE: Executing Tasks  
ERROR: core-image-base-1.0-r0 do\_rootfs: Unable to install packages. Command ‘/home/david/mender-raspberrypi5/meta-mender-community/my-raspberrypi5/build/tmp/work/qemuarm64-poky-linux/core-image-base/1.0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /home/david/mender-raspberrypi5/meta-mender-community/my-raspberrypi5/build/tmp/work/qemuarm64-poky-linux/core-image-base/1.0/opkg.conf -t /home/david/mender-raspberrypi5/meta-mender-community/my-raspberrypi5/build/tmp/work/qemuarm64-poky-linux/core-image-base/1.0/temp/ipktemp/ -o /home/david/mender-raspberrypi5/meta-mender-community/my-raspberrypi5/build/tmp/work/qemuarm64-poky-linux/core-image-base/1.0/rootfs --force\_postinstall --prefer-arch-to-version install kernel-devicetree kernel-image mender-auth mender-update packagegroup-base-extended packagegroup-core-boot psplash run-postinsts’ returned 255:

- opkg\_solver\_install: No candidates to install kernel-devicetree (null)!

ERROR: Logfile of failure stored in: /home/david/mender-raspberrypi5/meta-mender-community/my-raspberrypi5/build/tmp/work/qemuarm64-poky-linux/core-image-base/1.0/temp/log.do\_rootfs.288027  
ERROR: Task (/home/david/mender-raspberrypi5/meta-mender-community/my-raspberrypi5/build/…/poky/meta/recipes-core/images/core-image-base.bb:do\_rootfs) failed with exit code ‘1’  
NOTE: Tasks Summary: Attempted 5913 tasks of which 5911 didn’t need to be rerun and 1 failed.

Summary: 1 task failed:  
/home/david/mender-raspberrypi5/meta-mender-community/my-raspberrypi5/build/…/poky/meta/recipes-core/images/core-image-base.bb:do\_rootfs  
Summary: There was 1 ERROR message, returning a non-zero exit code.

Help on fixing this is much appreciated 😊

---

<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:** [October 22, 2024, 5:17am UTC](https://hub.mender.io/t/unable-to-build-qemu-image/7258/2 "2024-10-22T05:17:22Z")

</div>

Hi @davidlekve,

Building for multiple platforms in one setup is definitely a supported path, but it requires a little bit of care in where and how to set the build/project-specific variables.

In your case, the `IMAGE_INSTALL` contains `kernel-devicetree`, which is specific to the Raspberry Pi, but will not work on QEMU.

So the best way is to factor out the per-MACHINE settings into derived machines, the general SW platform settings into a derived DISTRO, and off you go. Coincidentially, just last week I updated my repository which contains a demo setup for exactly that use case: [GitHub - TheYoctoJester/mender-multiplatform: Example setup for integrating multiple target machines into a single kas-automated build](https://github.com/TheYoctoJester/mender-multiplatform)

One thing to note is that your build then needs to include _all_ necessary board support packages, respectively layers, but I don’t expect any real clashes between `qemuarm64` and `raspberrypi5`.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![davidlekve](https://avatars.discourse-cdn.com/v4/letter/d/c4cdca/32.png) [@davidlekve](https://hub.mender.io/u/davidlekve)\
**Post date:** [October 25, 2024, 8:45am UTC](https://hub.mender.io/t/unable-to-build-qemu-image/7258/3 "2024-10-25T08:45:36Z")

</div>

Nice!

I was thinking more of something like using the QB\_… variables like the [Beaglebone](https://github.com/mendersoftware/poky/blob/master/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf) does.

This could enable only building for `MACHINE=raspberrypi5`, but also running `runqemu raspberrypi5`. The goal is to improve dx by only needing to build once and not needing to move sd-cards.

I have tried with the following variables that made sense to me (mostly copying from qemuarm64 and beaglebone-yocto).

EXTRA\_IMAGEDEPENDS += “qemu-native qemu-helper-native”  
IMAGE\_CLASSES += “qemuboot”  
QB\_DEFAULT\_FSTYPE = “wic”  
QB\_FSINFO = “wic:no-kernel-in-fs”  
QB\_MACHINE = “-machine virt”  
QB\_KERNEL\_CMDLINE\_APPEND = “console=ttyAMA0 systemd.mask=systemd-networkd”  
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\_SYSTEM\_NAME = “qemu-system-aarch64”  
QB\_CPU = “-cpu cortex-a57”  
QB\_SMP ?= “-smp 4”  
QB\_CPU\_KVM = “-cpu host -machine gic-version=3”

QB\_GRAPHICS = “-device virtio-gpu-pci”  
QB\_OPT\_APPEND = “-device qemu-xhci -device usb-tablet -device usb-kbd”

QB\_SERIAL\_OPT = “-device virtio-serial-pci -chardev null,id=virtcon -device virtconsole,chardev=virtcon”  
QB\_TCPSERIAL\_OPT = “-device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1,nodelay=on -device virtconsole,chardev=virtcon”

QB\_KERNEL\_ROOT = “/dev/mmcblk0p2”

**I get the following error**  
david@david-Precision-5680:~/mender-multiplatform$ runqemu mmp-raspberrypi5  
runqemu - INFO - Running MACHINE=mmp-raspberrypi5 bitbake -e …  
runqemu - ERROR - Failed to find rootfs: /home/david/mender-multiplatform/build/tmp/deploy/images/mmp-raspberrypi5/core-image-full-cmdline-mmp-raspberrypi5-20241025082416\*.wic or /home/david/mender-multiplatform/build/tmp/deploy/images/mmp-raspberrypi5/core-image-full-cmdline-mmp-raspberrypi5\*.wic  
runqemu - INFO - Cleaning up  
runqemu - INFO - Host uptime: 136520.23

I have therefore also tried with mmcblk0p3

**Do you see any mistakes or know where the root is located?**

I have used the multimender-repo and have configured mmp-raspberrypi with the QB\_… above and also the following:

MACHINEOVERRIDES =. “raspberrypi5:”

require conf/machine/raspberrypi5.conf  
require conf/machine/include/raspberrypi.conf

KERNEL\_IMAGETYPE\_UBOOT ?= “Image”  
KERNEL\_BOOTCMD ?= “booti”  
UBOOT\_MACHINE = “rpi\_arm64\_config”

#include/mender-full  
INHERIT += “mender-full”

MENDER\_ARTIFACT\_NAME = “gha\_autobuild”

CONF\_VERSION = “2”  
PACKAGE\_CLASSES = “package\_ipk”  
INIT\_MANAGER = “systemd”

CMDLINE\_SERIAL=“console=serial0,115200 console=tty1”  
VC4DTBO=“”  
MACHINE\_FEATURES:remove=“vc4graphics”
