Originally published on itspavan.dev
Introduction
Real-time systems are critical across automotive, robotics, and aerospace industries. This guide explains how to construct a Yocto build with a Real-Time kernel patch for BeagleBone hardware.
Setting Up the Build Environment
Begin by cloning Poky and following the official Yocto Project documentation. Modify conf/local.conf with these configurations:
MACHINE ?= "beaglebone-yocto"
PACKAGE_CLASSES ?= "package_deb"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks tools-sdk package-management"
PREFERRED_VERSION_linux-yocto ?= "5.15%"
MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "kernel-modules"
CORE_IMAGE_EXTRA_INSTALL += "usbinit"
Patching the Kernel and Configuring It
Create a custom layer called meta-mylayer with this directory structure:
mkdir -p meta-mylayer/recipes-kernel/linux/linux-yocto
mkdir -p meta-mylayer/conf
Configure meta-mylayer/conf/layer.conf:
BBPATH .= ":${LAYERDIR}"
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "mylayer"
BBFILE_PATTERN_mylayer = "^${LAYERDIR}/"
BBFILE_PRIORITY_mylayer = "5"
Add linuxyocto_5.15.bbappend in meta-mylayer/recipes-kernel/linux with kernel branch and source revision configurations for BeagleBone and other machines.
Include these kernel version specifications and patch references:
LINUX_VERSION:beaglebone-yocto = "5.15.54"
SRC_URI += "file://usbeth.cfg"
SRC_URI += "file://patch-5.15.55-rt48.patch"
Download the RT patch from the official kernel repository and extract it into the layer directory.
Configure USB support in usbeth.cfg:
CONFIG_USB_ETH=y
CONFIG_USB_G_NCM=m
CONFIG_USB_MASS_STORAGE=y
Register the new layer:
cd ~/poky/build
bitbake-layers add-layer ../../meta-mylayer
Building and Deployment
Execute the build process using bitbake core-image-minimal. The compilation requires substantial time. Upon completion, locate image files in <build directory>/tmp/deploy/images/beaglebone-yocto/ and transfer them to an SD card using the dd command.
Conclusion
Building Yocto with RT kernel patches involves careful configuration of layers and kernel settings. Access the completed system via serial connection as the root user.