Notes About Yocto

I used Ubuntu 20.04 (LTS) for this.

Getting started commands

cd ~
# Build prerequisites
sudo apt-get install 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 pylint3 xterm python3-subunit mesa-common-dev
# Cloning the official reference OS called Poky
git clone git://
# Fork the current stable (hardknott)
git checkout -t origin/hardknott -b m-hardknott
# Build Poky to run on x64.
source oe-init-build-env
# Run the Poky via qemu (an emulator - it is slow).
runqemu qemux86-64 sdl
# I used the SDL graphical backend because the default backend hid the cursor.

Now adding the support for Raspberry Pi

# Clone the Raspberry Pi BSP
cd ~/poky
git clone git://
# Set MACHINE variable in build/conf/local.conf to "raspberrypi"
vim build/conf/local.conf
# Add the layer 
cd build
bitbake-layers add-layer ../meta-raspberrypi/
# Build a minimal image
bitbake core-image-minimal

Formatting a MicroSD card

# Insert USB MicroSD card reader and figure out device it is.
dmesg | tail
# Make sure the device isn't mounted before continuing.
# Create partitions with parted
sudo parted /dev/sdc
  mklabel msdos
  mkpart primary fat32 1M 100M
  mkpart primary ext4 100M 100%
# Format first partition as FAT32 (vfat)
sudo mkfs.vfat /dev/sdc1
# Label the first partition BOOT
sudo fatlabel /dev/sdc1 BOOT
# Format second partition as ext4
sudo mkfs.ext4 /dev/sdc2
# Label the second partition ROOT
sudo e2label /dev/sdc2 ROOT
# Save the partition UUIDs in a text file for later
blkid | grep sdc > ~/sdcard/PARTUUID.txt

Mounting the MicroSD card

# Create subfolders for each partition
mkdir ~/sdcard/{root,boot} -p
sudo mount /dev/sdc1 ~/sdcard/boot
sudo mount /dev/sdc2 ~/sdcard/root

During my testing, I copied the NOOBS root file system to ~/sdcard/root, and then

  • Updated ~/sdcard/boot/cmdline.txt to include the correct root partition ID.
  • Updated ~/sdcard/root/etc/fstab to include the correct root and boot partition IDs.

However a better way to set the partitions is to use the MMC block device IDs like mmcblkdev0p0 and p1.

Layers required for raspberrypi BSP:

  • git clone -b hardknott
  • git clone -b hardknott * git clone -b hardknott

I started customizing Poky to make it what I wanted.

Adding systemd support

Edited poky/build/conf/local.conf by adding the following lines:

# Note the space after the quote and before systemd on the _append line
DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = ""

Some links

Waveshare 2.7inch e-Paper HAT

First we have to install the dependencies, as specified by Waveshare

BCM2835 Library

tar xf  bcm2835-1.68.tar.gz
cd bcm2835-1.68
# OPTIONAL: run the tests
sudo make check
# Install
sudo make install


sudo apt update
sudo apt install wiringpi

Python libraries

sudo apt install python3-pip python3-pil python3-numpy
sudo pip3 install rpi.gpio spidev

Examples from Waveshare

git clone
  • notes_about_yocto.txt
  • Last modified: 2021/09/11 11:07
  • by john