A very small bootimage for the Raspberry Pi 5

Pieter-Tjerk de Boer, PA3FWM web@pa3fwm.nl

For my DAB-to-AM converter project, I wanted to make a Raspberry Pi diskimage available on my website for easy duplication of the project. However, a standard Raspbian diskimage is about half a gigabyte large, most of which is not needed for this project (but would cost diskspace and bandwidth). On this page I describe how to make a very much smaller (about 35 megabyte) diskimage for a RPi5 that only needs to run one or a few programs.

Most modern Linux systems, including Raspbian, use an 'initial ramdisk' as an intermediate step in the boot process. This initial ramdisk (short: `initrd') contains a very basic Linux system, just enough to load kernel modules that are needed and mount the 'real' root file system, possibly even over a network. My approach is to do away with that 'real' root filesystem, and run everything from within that initial ramdisk.

Of course, the environment of that inital ramdisk is very limited. E.g., there is no notion of different users (everything runs as root), no notion of logging in, and only a very limited set of libraries and programs is available. However, multitasking is already possible, there's a completely useable read-write file system (albeit in RAM so not persistent across reboots), and even basic networking is possible.

A typical microSD card containing Raspbian actually contains three file systems:

My main modification concerns the init script on the initial ramdisk. It now checks whether the VFAT partition contains any files named init-*.tgz; each such file found is unpacked onto the ramdisk, and if it contains a file called init.sh, that is executed. This makes it very easy to install and run things, without having to rebuild the entire initramfs file for each change.

A few more modifications were made: init.sh no longer hangs if no root file system is specified. I removed many unnecessary kernel modules from the initrd, and unnecessary files (such as images for older RPi versions) from the VFAT file system, to save space. Furthermore, cmdline.txt was modified to no longer point to a root filesystem, and to set the console to something else than /dev/tty1, to prevent console writes from messing up the videodac. And config.txt was modified for the videodac settings, as described on my videodac page

During the boot process, the init-*.tgz files are unpacked in (lexicographical) order of their filenames. On my disk image, this starts with a bunch of init-01-*.tgz files, each of which contains one tool that I need, ranging from something that turns off the fan, to a Python interpreter; the files in them have simply been copied from the current Raspbian release. Then follows init-20-dab2am.tgz , containing and starting my application software (the DAB-to-AM converter). Finally, init-99-waitindefinitely.tgz simply waits indefinitely; without this, the initrd's init program would continue with the (now absent) root file system.

If you want to use this for your own project, be my guest! Just download my dab2am image, and replace the init-*.tgz by whatever you need. (If you publish your project using it, I'd appreciate a link back to this page.)

For testing, here's a handy init-90-sshd.tgz file, which runs an sshd (dropbear) so you can log on to the RPi via the wired ethernet connection. To use it, you should also put appropriate authorized_keys and ed25519_host_key files on the VFAT partition as well. The sshd listens on port 2222, and the only user account is root. (Note: I do not keep this image up to date for security patches: it contains whatever Raspbian was current in October 2026. So only use this on a trusted private network!)


Text and pictures on this page are copyright 2026, P.T. de Boer, web@pa3fwm.nl .
Republication is only allowed with my explicit permission.