Skip to content

Instantly share code, notes, and snippets.

@beriberikix
Last active November 12, 2024 13:12
Show Gist options
  • Save beriberikix/e2175380cb6d10c1e9b86339bacd3325 to your computer and use it in GitHub Desktop.
Save beriberikix/e2175380cb6d10c1e9b86339bacd3325 to your computer and use it in GitHub Desktop.
Yocto Rasbperry Pi 4

Quick Yocto Guide for Raspberry Pi 3

Prerequisites

# Ensure Docker is installed and configured.

# Create project directory
mkdir -p ~/yocto-rpi4
cd ~/yocto-rpi4

Initial Setup

# Clone required repositories
git clone -b scarthgap git://git.yoctoproject.org/poky
git clone -b scarthgap git://git.openembedded.org/meta-openembedded
git clone -b scarthgap git://git.yoctoproject.org/meta-raspberrypi

# Start Docker container with appropriate resources
# I have a build server and set the memory to 32g and cpus to 14
docker run --rm -it \
    --memory 8g \
    --cpus 4 \
    -v "$(pwd)":/workdir \
    ghcr.io/crops/poky:ubuntu-22.04 \
    --workdir=/workdir

# Initialize build environment
source poky/oe-init-build-env build

# Add required layers
bitbake-layers add-layer ../meta-openembedded/meta-oe
bitbake-layers add-layer ../meta-openembedded/meta-python
bitbake-layers add-layer ../meta-openembedded/meta-networking
bitbake-layers add-layer ../meta-raspberrypi

# Verify layers
bitbake-layers show-layers

Build Configuration

Edit conf/local.conf:

# Machine Selection
MACHINE = "raspberrypi3-64"

# Raspberry Pi Specific
ENABLE_UART = "1"

# https://meta-raspberrypi.readthedocs.io/en/latest/ipcompliance.html
LICENSE_FLAGS_ACCEPTED = "synaptics-killswitch"

Build Process

# Clean any previous builds (optional)
bitbake -c clean core-image-base

# Build image
bitbake core-image-base

Flashing and First Boot

# Flash with Balena Etcher. On a recent test I used `core-image-base-raspberrypi3-64.rootfs.wic.bz2`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment