Based on this discussion
Create some directory structure
yocto will be root directory, and sources subdirectory will contain yocto layers
nikita@pc ~ $ mkdir -p yocto/sources; cd yocto/sources
Clone yocto layers
nikita@pc ~/yocto/sources $ git clone https://git.yoctoproject.org/meta-arm -b scarthgap
nikita@pc ~/yocto/sources $ git clone git://git.openembedded.org/meta-openembedded -b scarthgap
nikita@pc ~/yocto/sources $ git clone git://code.qt.io/yocto/meta-qt6.git -b 6.10
nikita@pc ~/yocto/sources $ git clone https://github.com/radxa/meta-rockchip.git -b scarthgap
nikita@pc ~/yocto/sources $ git clone git://git.yoctoproject.org/poky -b scarthgap
Go to yocto and setup env
nikita@pc ~/yocto $ source sources/poky/oe-init-build-env
Add layers to conf/bblayers.conf
nikita@pc ~/yocto/build $ cat conf/bblayers.conf
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
/home/nikita/yocto/sources/poky/meta \
/home/nikita/yocto/sources/poky/meta-poky \
/home/nikita/yocto/sources/poky/meta-yocto-bsp \
/home/nikita/yocto/sources/meta-arm/meta-arm \
/home/nikita/yocto/sources/meta-arm/meta-arm-toolchain \
/home/nikita/yocto/sources/meta-rockchip \
/home/nikita/yocto/sources/meta-openembedded/meta-oe \
/home/nikita/yocto/sources/meta-openembedded/meta-python \
/home/nikita/yocto/sources/meta-qt6 \
"
Edit conf/local.conf
Adopt PARALLEL_MAKE and BB_NUMBER_THREADS to your hardware
nikita@pc ~/yocto/build $ cat conf/local.conf
DISTRO ?= "poky"
PACKAGE_CLASSES = "package_ipk"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
EXTRA_IMAGE_FEATURES += "tools-sdk tools-debug"
USER_CLASSES ?= "buildstats"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
HALT,${TMPDIR},100M,1K \
HALT,${DL_DIR},100M,1K \
HALT,${SSTATE_DIR},100M,1K \
HALT,/tmp,10M,1K"
PACKAGECONFIG:append:pn-qemu-system-native = " sdl"
CONF_VERSION = "2"
MACHINE = "radxa-zero-3e"
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += " kernel-modules"
DL_DIR = "${TOPDIR}/../downloads"
SSTATE_DIR = "${TOPDIR}/../sstate-cache"
CORE_IMAGE_EXTRA_INSTALL = "\
openssh \
kernel-modules \
rsync \
qtbase \
qthttpserver \
qtserialport \
qttools \
qttools-tools \
"
LICENSE_FLAGS_ACCEPTED = "commercial"
PACKAGECONFIG:pn-python3-pygobject = ""
DISTRO_FEATURES:remove = " ptest"
PARALLEL_MAKE = "-j16"
BB_NUMBER_THREADS = "2"
Create a script for building image along with qt host toolchain for cross-compilation
nikita@pc ~/yocto/build $ cat build_all.sh
#!/bin/bash
bitbake meta-toolchain-qt6 nativesdk-packagegroup-qt6-toolchain-host packagegroup-qt6-modules core-image-minimal-dev
You may face compilation errors in some packages, usually related to missing #include <something>, just add missing includes and try again:
# /home/nikita/yocto/build/tmp/work/x86_64-linux/glslang-native/1.3.275.0/git/SPIRV/SpvBuilder.h
+#include <cstdint>
# /home/nikita/yocto/build/tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-flex/2.6.4/flex-2.6.4/lib/malloc.c
- void *malloc ();
+ void *malloc (size_t);
And script for flashing image to sd-card (replace /dev/sde with your device name)
You may need to install bmaptool
nikita@pc ~/yocto/build $ cat flash_image.sh
#!/bin/bash
sudo bmaptool copy tmp/deploy/images/radxa-zero-3e/core-image-minimal-dev-radxa-zero-3e.rootfs.wic /dev/sde
Build the image and flash to sd-card, it may take many hours
nikita@pc ~/yocto/build $ ./build_all.sh
nikita@pc ~/yocto/build $ ./flash_image.sh