Yocto-based Linux distribution for Raspberry Pi 4 and Radxa Rock 5C, built from the ground up to provide a minimal, highly secure, and customizable environment for my home server use.
This project uses the crops/yocto:debian-11-base Docker image for building.
# Pull the image
docker pull crops/yocto:debian-11-base
# Run the container
docker run --rm -it -v $(pwd):/home/yoctouser/YoctoPi crops/yocto:debian-11-basesource setup-env.sh
bitbake ypi-imagecd build/tmp/deploy/images/<machine>
# Option 1: dd
sudo dd if=ypi-image-<machine>.wic.gz of=/dev/sdX bs=4M status=progress conv=fsync
# Option 2: bmaptool (faster)
sudo bmaptool copy ypi-image-<machine>.rootfs.wic /dev/sdX --bmap ypi-image-<machine>.rootfs.wic.bmapNote: Replace /dev/sdX with your actual SD card device (e.g., /dev/sdb). Verify with lsblk before flashing.
- Yocto Version: scarthgap
- Linux Kernel: 6.6
- Init System: systemd
- Package Format: DEB (apt)
Web/Networking:
- caddy - Web server and reverse proxy
- wireguard-tools - VPN connectivity
Containerization:
- docker
Misc:
- fail2ban - Intrusion prevention (jails: sshd, caddy)
- log2ram - Log management for SD card longevity
- python3-telegram-bot - Telegram bot library
- Default user:
ypiuser(default password:pass) - Root login: Disabled (password locked)
- SSH: Enabled via key authentication
Configure these in local.conf before building:
- SSH_PORT : Custom SSH port
- SSH_PUBLIC_KEY : Authorized public key for SSH authentication
- YPI_PASSWORD_HASH : Custom ypiuser password hash
- YPI_ROOTFS_PARTUUID : Boot rootfs from SATA disk (set to PARTUUID of your disk's partition, see below)
Boot from SD card, rootfs on a SATA disk (/dev/sda1).
Connect your SATA disk. Identify it with lsblk, then create a partition and format it as ext4:
# Create a GPT partition table and a single partition (interactive)
sudo fdisk /dev/sda
# Format as ext4
sudo mkfs.ext4 /dev/sda1Find the PARTUUID of partition 1 on your SATA disk:
sudo blkid /dev/sda1Set it in local.conf:
YPI_ROOTFS_PARTUUID = "<PARTUUID from blkid>"
Setting YPI_ROOTFS_PARTUUID automatically selects a custom WKS layout (layers/meta-custom/wic/generic-gptdisk-sata.wks.in) that omits the rootfs partition from the SD card image.
bitbake ypi-imageFlash the WIC image to the SD card:
cd build/tmp/deploy/images/rockchip-rk3588s-rock-5c
sudo dd if=ypi-image-rockchip-rk3588s-rock-5c.wic.gz of=/dev/sdX bs=4M status=progress conv=fsyncThen write the rootfs to the hard drive:
# Mount the partition
sudo mount /dev/sda1 /mnt
# Extract the rootfs
sudo tar -xzf ypi-image-<machine>.rootfs.tar.gz -C /mnt
# Unmount
sudo umount /mnt