Skip to content

idirxv/YoctoPi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YoctoPi

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.

Build Environment

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-base

Quick Start

Build

source setup-env.sh
bitbake ypi-image

Flash to SD Card

cd 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.bmap

Note: Replace /dev/sdX with your actual SD card device (e.g., /dev/sdb). Verify with lsblk before flashing.

System Specifications

Core System

  • Yocto Version: scarthgap
  • Linux Kernel: 6.6
  • Init System: systemd
  • Package Format: DEB (apt)

Installed Packages

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

User Configuration

  • Default user: ypiuser (default password: pass)
  • Root login: Disabled (password locked)
  • SSH: Enabled via key authentication

Optional Settings

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)

Setup rootfs in Hard Drive

Boot from SD card, rootfs on a SATA disk (/dev/sda1).

1. Prepare the hard drive

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/sda1

2. Set the PARTUUID in local.conf

Find the PARTUUID of partition 1 on your SATA disk:

sudo blkid /dev/sda1

Set 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.

3. Build and flash

bitbake ypi-image

Flash 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=fsync

Then 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

About

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.

Topics

Resources

Stars

Watchers

Forks

Contributors