MiniLinux has been designed to be a very simple distribution for a flash (Compact Flash) based system. Features:

It is based on Debian/GNU/Linux packages and does having stripping of the filesystem. Afterwards package management wont work but the squashfs/cramfs isnt writeable anyway.


MiniLinux boots in 3 steps. First syslinux loads the kernel and a small initrd populated with some files from the build systems root. The initrd then creates the final root filesystem by mounting a ramfs (not ramdisk) to /newroot the CF cards FAT filesystem to /newroot/boot and the final squashfs filesystem via a loopback mount to /newroot/roroot. To be able to modify or overwrite files in /var or /etc are copied instead of linked.

Which subtrees are copied or linked is decided in the initrd booted first. See the initramfs-local in the data subdir which gets copied to the initrd image and does all the magic.

After then jumping into the final rootfs it first umounts the initrd to save memory. After mounting the /proc filesystem it then creates the module dependencies and restores the persistent config files from the tar on /boot which is the CF Cards FAT filesystem. See the data/rootfs/earlyboot script.

Persistent configs

To create persistent configs the booting and filesystem layout has been choosen to be able to overlay files in /dev, /root, /var and /etc. The overlay is beeing done by early in the boot extracting a tar file from the CFs FAT filesystem to the root of the ramfs.

For handling all the config file persistent process a shell script calles persist is installed on the system. To make config files persistent. persist knows 3 commands. take, commit, restore. take copies the config filed named to /var/persist keeping the absolute path. When issueing a commit the tree in /var/persist is then written to /boot/persist.tgz and thus beeing available for restoration via restore on the next boot.

Config files are snapshotted in their state when issueing a take and written to storage with commit.

chaos:~# persist take /etc/hostname chaos:~# persist commit chaos:~# ls -la /boot/persist.tgz -rwxr--r-- 1 root root 353 Jan 1 01:19 /boot/persist.tgz


I have used the distribution on an IBM Netstation 2800 (8364-EXX) as an XTerm and a Router. A kernel is included. The distribution also works perfectly on the Soekris board. All systems which are PC like and beeing able to boot an initrd and mounting a FAT filesystem should be ok.

Build system

The build system consists of a Makefile. On make a rootfs and initrd will be created from the config at the top of the Makefile. You need to be root to be able to build this as otherwise you wont be able to execute debootstrap, mount/umount proc, udev etc.

Debian Dependencies

The build process first creates a root filesystem with debootstrap. Then it installs additional packages defined in the makefile including the kernel. Then the build system uses initramfs-utils to create the initrd. Afterwards it removes listed packages. Then the filesystem will be stripped with the listed functions e.g. strip-apt. Then some modifications will be done like creating an /etc/fstab and putting some symlinks in place like /etc/mtab. Then the resulting rootfs will be compressed as an squashfs.

RELEASE=etch MIRROR= SECMIRROR= KERNELPKG=linux-image-2.6-486 squashfs-modules-2.6-486 ADDPKG=digitemp less wireless-tools ssh ntp lftp wget psmisc RMPKG=info man-db manpages dselect \ laptop-detect dmidecode groff-base \ libldap2 gnupg debian-archive-keyring apt aptitude \ tasksel tasksel-data libapt-pkg-libc6.3-6-3.11 apt-utils \ whiptail traceroute nano makedev bsdmainutils libnewt0.52 ADDLOCAL=data/rt2500-modules-2.6.18-5-486_1.1.0+cvs20060620-3+2.6.18.dfsg.1-13etch4_i386.deb STRIPMETHODS= strip-dpkg2usr strip-apt2usr strip-locale \ strip-doc strip-man strip-info strip-apt BUILDDIR=build ROOTFSMOUNT=$(BUILDDIR)/rootfs DATADIR=data INITRDMOD=piix ide-disk ide-core generic \ loop squashfs \ msdos fat vfat nls_cp437 nls_iso8859-1

After building with make copy the rootfs (e.g. build/rootfs.squashfs) which needs to be named rootfs, the kernel (e.g. build/boot/vmlinuz-2.6.18-6-486) and the initrd (e.g. build/boot/initrd.img-2.6.18-6-486) to your boot device. Then you need install a bootloader to the medium. I prefer syslinux because of its simplicity and (v)fat abilities. Afterwards you'll need a syslinux.cfg like this.

default linux #serial 0 19200 0 label linux kernel linux append root=/dev/ram0 initrd=initrd console=ttyS0,19200n8


Any kernel booting and supporting your system will be sufficient. I recommend using squashfs as the rootfs as it compressed much better than cramfs and does not suffer from cramfses non-posix compliance. squashfs is as of yet (Kernel 2.6.10) not in the mainline kernel. See links section for patch download location. From version 20080130 on the build system will use the etch default kernel and install the needed squashfs module in the initrd. Also a cpio based initrd build with initramfs-tools will be used.

Beware - In case of USB Memory stick you will need to compile SCSI, SCSI Disk, USB-Storage and your USB host controller OHCI/UHCI or EHCI into your kernel. From version 20080130 on you simple need to list all necessary modules to load in the INITRDMOD variable when using the modularized debian kernel.



20071116 Florian Lohoff 
	- Dropped most of initrd generating in favor of initramfs-tools
	- Made it work with debian distribution kernel
	- Ported over to etch
	- Dropped woody/sarge specialities
	- Added security updates

20050814 Florian Lohoff 
	- Fix problem with fstab - it should be /dev/loop0
	- udev bugs have been fixed - build fails now - fix the fix

20050215 Florian Lohoff 
	- Added serial console setup
	- Added soekris kernel
	- Added ipmasq, dnsmasq to Router package list
	- Fixed udev bugs with mounting /.dev,/dev,/dev/pts,/dev/shm on
	- New Soekris kernel (2.6.10) without hangcheck (Not supported ->
	  regular reboot)

20050216 Florian Lohoff 
	- "persist take" would not overwrite already persistant files

20060317 Florian Lohoff 
	- Autodetect kernel version for createing subdirs
	- Move build into subdir "build"
	- Create directory "boot" and create all files needed on 
	  boot device in there (initrd, rootfs, kernel)
	- Create "video" target for video4l capture machines

20060318 Florian Lohoff 
	- Switched to using busybox-static in the initrd
	- Added a MKSQUASHFS option to generate 2.0 versioned squashfs
	  (Squashfs silently fails to mount rootfs on wrong version)
	- Rewrote initrd's linuxrc to be busybox compatible
	- Included a syslinux.cfg
	- Fixed bug with fstab creation
	- Made initrd's linuxrc be more automatically generated from Makefiles
	  variables (BOOTDEV, BOOTFSTYPE) - Probably we could take this from
	  kernel command line and autodetect FSTYPE - Made initrd be very
	  flexible. We could also create the final fstab dynamically.
	- Rewrote kernel installation to actually dpkg -i the kernel into the
	  rootfs. This also enables us to install various extern kernel module
	  packages on request.
	- Add LC_ALL=C to all invocations of dpkg/apt-get within chroot -
	  Fixes hundrets of locale warnings.

20060319 Florian Lohoff 
	- ReRead inittab after restoring persisant config from boot device
	  in case we changed the inittab
	- Added removal of base-config, apt, apt-utils and more failure
	  tolerance in apt strip targets

20060321 Florian Lohoff 
	- Rewrote /lib/modules /lib/ etc handling. Only symlink
	  farm - not bind mount. Also set links for non kernel directories
	  e.g. the pwc driver installs into /lib/modules/`uname -r`/updates

20060523 Florian Lohoff 
	- Added "-o ro" to initrd/init mounting the squashfs/cramfs
	  This seems to be needed with newer kernels or Busybox.
	  Thanks to Frank Scholz for spotting this.