|
In episode 7 of the tutorials about the Yocto Project and OpenEmbedded for Raspberry Pi 5, we will cover how to create a new layer, write a new recipe, and extend an existing recipe using a .bbappend file. All examples are based on the Yocto LTS release, Scarthgap.
Steps:
-
Initialize the build environment:
source oe-init-build-env
-
Create a new layer:
bitbake-layers create-layer ../meta-leon
-
Add the new layer to conf/bblayers.conf:
bitbake-layers add-layer ../meta-leon
-
Open another terminal and navigate to the newly created layer:
cd meta-leon
-
Create a directory for the "Hello, World" recipe:
mkdir -p recipes-apps/hello/
-
Create the recipe file recipes-apps/hello/hello_git.bb with the following content:
DESCRIPTION = "Hello World"
HOMEPAGE = "https://github.com/leon-anavi/hello-world"
SECTION = "console/utils"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=f388cad0df1af35e3626518d587c0cb6"
SRC_URI = "git://github.com/leon-anavi/hello-world.git;branch=master;protocol=https"
SRCREV = "f66f58e7bcdcc834568d8c7c6fc51e30765befad"
S = "${WORKDIR}/git"
inherit autotools
-
Create a directory in the layer to extend core-image-base:
mkdir -p recipes-core/images/
-
Create the file recipes-core/images/core-image-base.bbappend and add the following line to install the hello recipe from the meta-leon layer into core-image-base:
IMAGE_INSTALL:append = " hello"
-
Return to the terminal where the build environment was initialized and build the new image:
bitbake core-image-base
-
Flash core-image-base-raspberrypi5.rootfs.wic.bz2 to a microSD card.
-
Boot the Raspberry Pi 5 from the microSD card and run hello to verify that the "Hello, World" application has been successfully built and included in the image.
|