pi-gen-micro is a system designed to build tiny embedded operating systems from the same package sources as Raspberry Pi OS.
Why? Because this means you get the latest hardware support and updates in line with a widely-used and tested OS.
sudo pi-gen-micro ${CONFIGURATION_NAME}
For example, the fastboot
gadget used by rpi-sb-provisioner
:
pushd $(mktemp -d)
sudo pi-gen-micro fastboot