A Mutable Log

Embedded Linux system for Raspberry Pi with Yocto Project

Yocto Project, and OpenEmbedded, have been making news lately as the toolchain to build custom embedded Linux systems. I decided to try and get a working Linux system up and running on a Raspberry Pi 1 Model B+.

The procedure that follows uses the meta-raspberrypi BSP in tandem with Yocto Project poky, on a Ubuntu 20.04 host.

Download the required layers using git

git clone http://git.yoctoproject.org/git/poky
git clone http://git.yoctoproject.org/git/meta-raspberrypi
git clone https://github.com/dv1/meta-gstreamer1.0.git

Initialize the build environment by executing

source poky/oe-init-build-env build

You can run the same command again if you ever need to setup the environment again in the future.

Append meta-raspberrypi and any other layers to BBLAYERS in conf/bblayers.conf

vi conf/bblayers.conf

After you’re done, conf/bblayers.conf should look like

  /home/pi/poky/meta \
  /home/pi/poky/meta-poky \
  /home/pi/poky/meta-yocto-bsp \
  /home/pi/meta-gstreamer1.0 \
  /home/pi/meta-raspberrypi \

Set MACHINE to raspberrypi in conf/local.conf

vi conf/local.conf

After you’re done, the relevant portion of conf/local.conf should look like

#MACHINE ?= "genericx86-64"
#MACHINE ?= "edgerouter"
# This sets the default machine to be qemux86-64 if no other machine is selected:
MACHINE ??= "raspberrypi"

# Where to place downloads

This will build an image suitable to be installed on a Raspberry 1 Model B+. Other available alternatives can be seen under /home/pi/meta-raspberrypi/conf/machine/


Complete the build by executing

bitbake core-image-base

That should take a while.

After the build is complete, create an SD card using the following commands

sudo apt install bmap-tools
sudo bmaptool copy --bmap tmp/deploy/images/raspberrypi/core-image-base-raspberrypi-20210115193541.rootfs.wic.bmap tmp/deploy/images/raspberrypi/core-image-base-raspberrypi-20210115193541.rootfs.wic.bz2 /dev/sda

Change /dev/sda to the appropriate device on your system.

Boot your Raspberry Pi using the SD card. Command line appears on the HDMI display, or, if configured, over the serial port on the expansion header. You can login as root with an empty password.