Simple, minimal example on building custom Raspberryp 5 images. Produces an image with a very simple distro with systemd, and console interface.
- Open folder in dev container.
source /yocto/poky/oe-init-build-env
.- Add this layers with bitbake:
bitbake-layers add-layer /yocto/workspace/meta-simple/
bitbake-layers add-layer /yocto/workspace/meta-raspberrypi
- Change
build/local.conf
file:
- Add
MACHINE ?= "raspberrypi5"
for raspberry image or any qemu. - Add
DISTRO ?= "myimg"
for the custom distro.
NOTE: If problem downloading kernel occurs, look into the log for the git command and simply run it from a terminal manually.
At local.conf
:
- Add more packages with:
IMAGE_INSTALL:append = " <packages> ...
bitbake my-img
If a qemu machine was chosen, use (from dev container):
runqemu slirp nographic
If you produce an image for a Raspberry board, make sure you copy them out of the container:
docker cp <container_id>:/yocto/build/tmp/deploy/images/<machine>/<image>.wic.gz .
Example:docker cp -L a7ac:/yocto/build/tmp/deploy/images/raspberrypi5/my-img-raspberrypi5.rootfs-20240619160220.wic.bz2 .
Then, extract to disk. Example:
bzip2 -cd my-img-raspberrypi5.rootfs-20240619160220.wic.bz2 | sudo dd of=/dev/disk5 bs=10M status=progress
The machine should be SSH accessible from a static ip: 192.168.1.10
. Make sure the host device has an IP in range.
- https://wiki.somlabs.com/index.php/Connecting_to_WiFi_network_using_systemd_and_wpa-supplicant
- Wifi is disabled at boot by default. Once logged in, simply type
systemctl enable wpa_supplicant@wlan0
- See https://lists.yoctoproject.org/g/yocto/topic/enable/61338089
- Details: https://man.archlinux.org/man/systemd.network.5
- After image is deployed, change
ssid
andpsk
fields of/etc/wpa_supplicant/wpa_supplicant-wlan0.conf
and restart wpa_supplicant service.
- https://wiki.koansoftware.com/index.php/Modify_the_linux_kernel_with_configuration_fragments_in_Yocto
- https://docs.yoctoproject.org/kernel-dev/index.html#:~:text=Table%20of%20Contents.%201%20Introduction.%201.1
bitbake -c menuconfig virtual/kernel
.swu
files are generated when installing swupdate
package. To update from within the system, use this as reference:
swupdate -i my-img-raspberrypi5.rootfs.swu -H a:1.0 -v -e stable,copy1