Pi Image Tools (Unified Monorepo)
Unified Raspberry Pi appliance pipeline: disk benchmarking, unattended multi-reboot bootstrapping, Matter Test Harness provisioning, and compressed image generation with auto-expansion.
- 01Stage 1: Storage throughput benchmark (bench/)
- 02Stage 2: Unattended bootstrap engine (automation/)
- 03Stage 3: Matter appliance provisioning (matter-image/)
- 04Stage 4: Capture & partition compaction (shrink/)
- 05Stage 5: First-boot auto-expansion hook
Architecture Overview
A complete, four-stage appliance engineering suite that turns a stock Raspberry Pi running 64-bit Ubuntu into a certified, reproducible, production-ready system image. It unifies storage throughput benchmarking, an unattended multi-reboot bootstrap engine, comprehensive Matter (CHIP) Test Harness provisioning, and filesystem-level partition shrinking into a single, cohesive workflow. The pipeline runs end-to-end without manual intervention, surviving intermediate system restarts and outputting an auto-expanding, compressed .img ready for immediate mass flashing.
How it works
Core mechanics, failure recovery paths, and system design decisions.
Stage 1: Storage throughput benchmark (bench/)
Sweeps 18 block sizes between 512 B and 64 MB using dd_test.sh, systematically clearing the kernel page cache (echo 3 > /proc/sys/vm/drop_caches) before every pass to pinpoint the fastest transfer rate for the target card reader.
Stage 2: Unattended bootstrap engine (automation/)
Survives multiple machine reboots via an idempotent sentinel block in ~/.bashrc. Upon system restart, control.sh resumes execution of single_script.sh automatically, self-deleting upon final completion to leave clean user logins.
Stage 3: Matter appliance provisioning (matter-image/)
Deploys the full CSA Matter Test Harness: configures wpa_supplicant services, kernel modules (ip6table_filter), and IPv6 router advertisement sysctls (accept_ra=2) essential for Thread border router communication, then builds Docker containers and syncs PAA certificates.
Stage 4: Capture & partition compaction (shrink/)
Uses dcfldd to snapshot the physical SD card (/dev/mmcblk0), then invokes pishrink.sh to shrink the ext4 root filesystem to its true data boundary via resize2fs, truncate unallocated sectors, and compress the image with gzip to ~1.5–3 GB.
Stage 5: First-boot auto-expansion hook
Injects an expansion trigger into /etc/rc.local inside the shrunken image so that upon first boot on any physical SD card (32 GB, 64 GB, or 128 GB), the partition silently resizes to occupy 100% of the storage medium.
Engineering Highlights
- •Consolidates four standalone imaging and benchmarking utilities into one unified repository
- •Survives two full machine reboots completely unattended via ~/.bashrc sentinel orchestration
- •Automates low-level networking: IPv6 sysctls, Thread border routing flags, and wpa_supplicant services
- •Cuts raw 32GB/64GB card backups down to ~1.5–3 GB compressed distribution archives
- •Auto-expanding first-boot hook guarantees zero manual partition resizing for end users