Sitemap

Building the Linux Yocto Image for Raspberry pi zero

4 min readJul 20, 2026

--

For building newer IoT or DIY projects if you want to build your own yocto image you can follow this tutorial to the end .

for setting up the yocto we will going to use the poky-scratchgap for installing the system files and making the enivornment .

Remember how to access the Raspberry pi zero you will need some tool like there UART Signals :

You can use the FTDI Serial Logger:

For Hardware Setup:

you will need FTDI and RPI 0 V1.3

FTDI GND → RPI 0 V1.3 GND

FTDI RX → RPI 0 V1.3 GPIO14 (TXD)

FTDI TX → RPI 0 V1.3 GPIO15 (RXD)

Press enter or click to view image in full size
pinout image from manufacturer

and 1 SD Card to flash the Image :

To Install the environment poky-scratch gap I installed:

Let’s start so first things first you will need the packages :

sudo apt update
sudo apt install -y \
gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat \
cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping \
python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint xterm \
zstd liblz4-tool file locales

Then you can add packages :

mkdir ~/yocto_project
cd ~/yocto_project

now Create the Repository I used Kirkstone so you can also use same :

cd ~/yocto_project
git clone <https://git.yoctoproject.org/poky.git>
cd poky
git branch -a
git checkout scarthgap
git branch

Now the next step is to clone the RaspberryPi zero BSP layers

cd .. 
echo "To reach the directory to poky-scratchgap"
git clone <https://git.yoctoproject.org/meta-raspberrypi.git>
cd meta-raspberrypigit checkout scarthgapcd ..

The last and most important to get building the scratchgap and making the build directory successfully :

poky/
├── bitbake/
├── meta/
├── meta-poky/
├── build/
│ └── conf/
│ ├── bblayers.conf
│ └── local.conf
└── …

source oe-init-build-env
bitbake-layers add-layer ../meta-raspberrypi
bitbake-layers show-layers

Add the layers

bash

bitbake-layers add-layer../../meta-raspberrypibitbake-layers add-layer../../meta-openembedded/meta-oebitbake-layers add-layer../../meta-openembedded/meta-multimediabitbake-layers show-layers

You should see meta, meta-poky, meta-yocto-bsp, meta-raspberrypi, meta-oe, and meta-multimedia listed.

Configure local.conf for the Pi Zero

Open conf/local.conf and set the machine. A Raspberry Pi Zero v1.3 has no onboard Wi-Fi, so use:

conf

MACHINE ?= "raspberrypi0"

(If you ever move to a Pi Zero W, use raspberrypi0-wifi instead.)

Get Harshdixit’s stories in your inbox

Join Medium for free to get updates from this writer.

Also enable the serial console, since that’s your only way in without HDMI/keyboard:

conf

ENABLE_UART = "1"

Optional but useful additions:

conf

IMAGE_INSTALL:append = " openssh"

(gives you SSH if you later bring up networking — irrelevant for a plain Zero v1.3 without Wi-Fi, but handy if you add a USB-Ethernet gadget).

Build the image

bash

bitbake core-image-minimal

core-image-minimal is the smallest option if you just want a boot-to-shell system; core-image-base adds a bit more hardware-enablement tooling. Either works fine on the Zero. Expect the first build to take a while (an hour or more depending on your machine) since it's compiling the whole toolchain and base system from source.

The finished image lands at:

~/yocto_project/poky/build/tmp/deploy/images/raspberrypi0/core-image-base-raspberrypi0.wic.bz2

Flash the SD card

Find your SD card device first (be very careful with this — picking the wrong device will overwrite your disk):

bash

lsblk

Then decompress and write:

bash

bzip2 -dk core-image-base-raspberrypi0.wic.bz2sudoddif=core-image-base-raspberrypi0.wicof=/dev/sdXbs=4Mstatus=progressconv=fsyncsync

Replace /dev/sdX with your actual SD card device (e.g. /dev/sdb, never a partition like /dev/sdb1).

Wire up the FTDI adapter

As you noted:

FTDI RPi Zero v1.3 GND GND RX GPIO14 (TXD) TX GPIO15 (RXD)

Don’t connect the FTDI’s 5V/3.3V line — power the Pi separately over micro-USB. Sharing power through the FTDI can brown out or damage the board.

Open the serial console

Insert the SD card, power on the Pi, then from your host machine:

bash

sudoaptinstall -yscreenscreen /dev/ttyUSB0115200

(Substitute /dev/ttyUSB0 with whatever dmesg | grep tty shows after plugging in the FTDI.)

You should see the kernel boot log, followed by a login prompt. Poky’s default image logs in as:

login: root

with no password.

To exit screen: Ctrl-A then K, confirm with y.

Quick troubleshooting notes

  • Nothing on the serial console: double-check RX/TX aren’t swapped — a common mistake is wiring RX-to-RX instead of RX-to-TX.
  • add-layer fails with a dependency error: it's almost always a missing meta-oe/meta-python layer — meta-raspberrypi leans on meta-openembedded more in scarthgap than in older releases.
  • Build fails on linux-raspberrypi: make sure MACHINE is set before the first bitbake invocation — changing it after tmp/ has been populated requires a bitbake -c cleanall virtual/kernel or a fresh build dir.

--

--