Unable to build qemu image

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 :blush:

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

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

1 Like

Nice!

I was thinking more of something like using the QB_… variables like the Beaglebone 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”