I’m exploring the idea of “reducing” a debian bootstrap chroot, similarly to how the m0n0wall build scripts copy only the necessary files for a running system from a FreeBSD jail.
The base debian bootstrap uses about 166MB (after apt-get clean and localepurge, it is only 120MB), which is pretty small as it is. Most of the stuff isn’t needed though. I would like the build to not actually have an sshd server, and similar console messages to m0n0wall.
I think the process would even be simpler than the m0n0wall building process, because of how everything is installed.
host+-- chroot +-- target to do a minidebootstrap to
Several questions remain:
- Which filesystem? JFFS2? Squashfs? YAFFS? CRAMFS?
- How does the init process for debian differ from that for FreeBSD?
- How would the initramfs involved in the process?
- How could the image be used on different types of media, like CDs, USB Flash drives, CF, IDE, or SATA drives?
- What about partitions?
I think I’ll just try a few different experiments to see what happens. How? QEMU!
How does m0n0wall build such a mini distro: <ol><li>the m0n0wall.files file contains a list of all the files which can be copied over to the target image</li><li>builds a customer kernel which only contains the required modules</li><li>The libs required by the target userland are identified by ldd in mklibs.pl?</li><li>loader.cf turns dma off for compatibility with a variety of cf cards</li></ol>
I learn better by doing than reading, so I’ll probably do some trial and error experiments with QEMU and see what happens. I just remembered that I had seen an article about running debian on a 32mb compact flash drive at one point, here it is: Embedding Debian GNU/Linux in a 32MB CompactFlash by by Bao C. Ha.
This has a lot of very helpful information. I just scanned through it again, and I’m sure I’ll be reading it again and again in the coming days!
On the FreeBSD side of things, there is the excellent miniBSD - reducing FreeBSD by Manuel Kasper. This also has a lot of great stuff. There is a lot of cool parallels between the two guides and I think a phing-based build process will work really well for both operating systems.
On the “WRT” side of things, OpenWRT uses ipkg, from handhelds.org. An “itsy” package management system. Along those lines is the Soekris Port of the OpenWRT distribution. I just found an interview with the founder of FreeWRT discussing the differences between it and OpenWRT, the site was down, so I mirrored the interview from Google’s cache here. At the same time, I checked out kamikaze from OpenWRT and it seems to be working well - I’m compiling an x86 image with all the packages right now, among them ipkg and uClibc. Cool!
Argh, unfortunately that build failed too. Now I’m going to try building uClinux. Actually no I’m not. After reading some more about uClinux, FreeWRT, and OpenWRT, I think my focus remains on standard hardware. While I really like the idea of uClinux, the lure of debian is too strong! And for good reason. Debian is awesome.
The plan then is to stick with FreeBSD and debian as the basis for building mini-distros. And with my recent foray into OpenVZ, it should be easier to test various “reduced” debian systems. While I’m at it, I’ll try to clarify the goal here:
- Not the smallest system possible, but retain the amazing debian core, and provide a "webmin-like" administration webgui that is flexible and extensible
- This would essentially remove the need for an X11 server, yet provide user-friendly administrative powers to average users
- Furthermore, this could be achieved with low-power, low-cost hardware
My guess is that both Debian and FreeBSD (among others) will work very well for this purpose, and making the build process support them both (at least) will open the sphere of influence to a great audience.
UPDATE: A new psuedo-distro is in the works: NODOWS.