Defining Custom Image and Distro for Raspberry Pi Zero 2W
A guide to creating custom image recipes and distribution configurations in your own Yocto layer, eliminating the need for manual local.conf edits
February 3, 2026
Defining Custom Image and Distro for Raspberry Pi Zero 2W
I'll complete the layer for creating my own image by adding an
image recipe and distribution configuration to the meta-jooojub-rpi layer created in the previous post.I will now apply the modifications I previously made to
This eliminates the need for manual edits, allowing you to create images immediately just by adding the layer, which simplifies maintenance and distribution.
local.conf and bblayers.conf for the Raspberry Pi Zero 2W image directly to the layer.This eliminates the need for manual edits, allowing you to create images immediately just by adding the layer, which simplifies maintenance and distribution.
1. Add Image recipes
Previously, we used
You can create custom image recipes based on this base image.
core-image-base when building images with bitbake.You can create custom image recipes based on this base image.
Create files and directories in the following paths within the
I've configured it to be buildable with the name jooojub-rpi0-2w.
meta-jooojub-rpi layer created in the previous post.I've configured it to be buildable with the name jooojub-rpi0-2w.
recipes-core/images/jooojub-rpi0-2w.bbbitbake
Since
core-image-base is included, you can now build the image using jooojub-rpi0-2w.2. Create Distro Configuration
To minimize modifications to the existing
local.conf, create your own Distro.conf/distro/rpi0-2w.confshell
You can now add the LICENSE and
IMAGE_ROOTFS size settings, which were previously modified in local.conf, here instead.
3. Create conf Templates
When running
By default, poky/meta-poky/conf/templates is used.
oe-init-build-env to set up the initial build environment, you can specify your own templates.By default, poky/meta-poky/conf/templates is used.
I'll make this part customizable as well to minimize additional tasks.
Copy the templates from the existing
Copy the templates from the existing
meta-poky.Copy default templateshell
Now, add the desired parts.
To avoid the hassle of manually adding layers every time, I've configured them to be included automatically during initial setup.
conf/templates/default/bblayers.conf.samplediff
I've modified the message displayed by
oe-init-build-env to include a list of buildable targets.conf/templates/default/conf-notes.txtdiff
Modify the MACHINE and DISTRO values that need to be added to
local.conf to your preferred values.conf/templates/default/local.conf.samplediff
4. Build Test
Let's check if the modifications made so far work correctly.
I'll boldly delete the existing build directory and configure the build using my custom conf templates.
I'll boldly delete the existing build directory and configure the build using my custom conf templates.
Simply specify the path to the previously created templates in the
Using an absolute path is recommended.
TEMPLATECONF environment variable.Using an absolute path is recommended.
Create build env with TEMPLATECONFshell
You can see that the modifications to
conf-notes.txt are displayed correctly.conf/bblayers.confbash
The layers are correctly added to
conf/bblayers.conf as well.conf/local.confbash
The desired
MACHINE and DISTRO values are also present in conf/local.conf.Since the desired values are included by default, you can run bitbake immediately to generate the image.
5. Next Steps
The basic foundation for customizing Yocto recipes is now in place.
I'll start adding the features I want one by one.
I'll start adding the features I want one by one.