Yocto Raspberry Pi Build
In a similar fashion as the QEMU example, this sample project will build a full system image, using safe defaults, that we will be able to run on a Raspberry Pi 4.
We designed Thistle Yocto Build to make it easier to package custom Linux image for your embedded device with Yocto Linux. It is a wrapper around the Yocto project, and dependencies will be downloaded and managed at runtime. Basic features are enabled to enhance quality of life while using Yocto, such as disk space monitoring, and usage of sccache
to improve build-time.
Tools needed
To get started you need to obtain a few dependencies and the Thistle Yocto Build binary. Note that the build system only supports x86_64 hosts.
# Ubuntu (22.10 onwards)
$ apt install gawk wget git-core diffstat unzip texinfo gcc-multilib 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 python3-subunit mesa-common-dev zstd lz4 file
# Arch - also requires `sdl` from the AUR
$ pacman -S base-devel git diffstat unzip texinfo python chrpath wget xterm rpcsvc-proto socat cpio inetutils
$ curl -L -o thistle-yocto-build https://downloads.thistle.tech/thistle-yocto-build/2.0.4/thistle-yocto-build-x86_64-unknown-linux-musl
$ chmod +x thistle-yocto-build
Build the sample project
Only two simple steps are required, the first one will generate the sample configuration file. Feel free to explore the generated conf.yml
file - the complete list of options can be found here.
$ ./thistle-yocto-build gen-config rpi4
Generated default thistle-yocto-build config file at conf.yml
The second step will build the image. Building this image takes approximately 60 minutes on a Ryzen5 3600, and requires ~50GB of free storage. This build will be performed in debug mode, with SSH enabled.
$ ./thistle-yocto-build build --debug conf.yml
~~ Thistle Yocto Build Starting ~~
WARNING: Building in insecure debug mode
Please enter a value for the username: a
Please enter a value for the password:
Fetching remote repo meta-openembedded
Fetching remote repo meta-raspberry
Fetching remote repo openembedded-core
Fetching remote repo meta-thistle
Fetching bitbake from upstream git repo at commit 2022-04.6-kirkstone
Fetching remote repo bitbake
Found oe-init-build-env at "/home/user/rpi/build/layers/openembedded-core/oe-init-build-env"
Generating bitbake config files
Enabling ccache
Setting up disk monitoring system
Detected 12 CPUs, will configure build accordingly
Build starting - 2023-03-15T14:24:34.522041821+01:00
[...]
Build done in 3430s
WARNING: Build successful
Build artifact folder: "/home/user/rpi/build/deploy"
Analyzing build for security issues...
No issues detected
Launch Image
Once the build is finished, boot the built image by copying it onto your Raspberry Pi 4 SD card:
$ cp ./build/deploy/images/raspberrypi4-64-thistle/base-raspberrypi4*.rootfs.wic fullimg.wic
$ sudo dd if=fullimg.wic of=/dev/mmcblk0 status=progress
Next Steps
- Have a look at the configuration page to explore all the possible options
- Use the Thistle Update Client to update the images directly on your device