Last Updated on: 11th June 2023, 10:36 am
Static RAM Linux – an exercise in building a small, RAM based Linux distribution. Static RAM Linux is an imitation of Linux From Scratch, with the twist being that the *goal* is the creation of statically linked, rather than dynamically linked systems. The target audience is technically inclined high school/technical school/early college students. Experts will find this presentation trivial, while greenhorns will be frustrated and lost.
This distribution is intended to be booted from solid-state memory devices, such as USB flash sticks or Compact Flash hard disk replacements, which are characterized by a low number (20K) of write operations before failure occurs. Static RAM Linux loads the entire Linux distribution into RAM, and by default, does not touch the storage media after booting. Throughout this exercise, I will assume that you have an expendable flash memory stick as a target bootable system.
The work flow will be to create a file system on a host system, test and customize this system, archive the desired system as as cpio.gz archive, and use the GRUB/Linux boot loader to place this file system as a boot ram disk in Linux.
Simplest is small, busybox based command line environment. No compiler is present here. This is useful as a rescue disk, and as an introductory command line environment. This is very small, at 474K compressed. The Linux kernel (2.4M compressed) occupies more space than this simplest distribution.
StaticRamLinux has a GCC 4.3.3 static toolchain with uClibC. This environment can build the compilers and binary utilities, but does not include Perl, which is necessary for the kernel and many other packages. We see the size of the distribution has increased significantly. (31M compressed). Alternative C compilers, such as TCC, and ACK are worth checking out.
StaticRamLinuxWithPerl has the GCC 4.3.3 environment from above, as well as Perl 5.8.6. This is the simplest system which will compile modern Linux kernels. (42M compressed)
StaticRamLinuxWithPerlAndModules has the features from above, as well as a collection of kernel modules and the udev utilities to simplify kernel customization for a specific hardware set. Ubuntu and Knoppix have superior hardware detection features than my collection here. The path of wisdom is to use one of the above boot CDs to determine the necessary modules for your computer, then make a custom kernel with only your necessary features, without modules. This gets the smallest, fastest booting kernel, with superior protection from rootkit installation via the loadable module path. The modules I have above cover the machines I work with. However, the comprehensive module collection for a generic kernel is over 500MB, while the Ubuntu module collection is over 100MB. Once you have identified the modules you need, the goal is to eliminate modules, eliminate udev, and simplify the system to the smallest size possible.