• 8
name Punditsdkoslkdosdkoskdo

How can a linux kernel be so little?

An ordinary stable 3* kernel is about 70 mb now. But there are little linux distributions of 30-10 mb with software and other stuff running out of the box.

How can the linux kernel be so small in these distros? Can stripping down only unneeded modules and drivers dramatically reduce the size? What else is done to reduce the kernel size?

Most major distros configure their kernels with maximum hardware support so it will work out of the box with most computers and anything you plug in later on. They also use an initrd system which is not needed in most cases. There are also options in the kernel configuration that make the build process optimize for size, and a better (though slower) compression method can be selected as well. Lastly, if you are looking at the size of the kernel source code, keep in mind that it also includes support for several architectures beyond x86/amd64, network protocols, file systems, and other features that you'll probably never use and that can be disabled.

  • 0
Reply Report

The default kernel configuration is configured to support as many hardware as possible. A non-stripped kernel with default configuration resulted in a size of 1897996 kB (including kernel + modules). When stripping many unnecessary drivers and options (why would I need a HP module if I own a Clevo notebook), it resulted in a size of 892892 kB which is a size reduction of 53% compared to the stock kernel.

When installing the kernel modules, append the INSTALL_MOD_STRIP=1 option. This will strip all debugging symbols and reduced the size by 92% for me (from 892892 kB to 69356 kB). Note this will only affects modules to be installed and not the kernel (vmlinuz) itself:

make INSTALL_MOD_STRIP=1 modules_install

From Documentation/kbuild/kbuild.txt:

INSTALL_MOD_STRIP, if defined, will cause modules to be
stripped after they are installed.  If INSTALL_MOD_STRIP is '1', then
the default option --strip-debug will be used.  Otherwise,
INSTALL_MOD_STRIP value will be used as the options to the strip command.
  • 0
Reply Report

Early Linux distributions such as Tom's Root-BootMuLinuxDiet-router, (the now defunct) LOAF and many others now departed, all fitted a working Linux system on to one or two 1.44 MB diskettes.

The Linux kernel has grown but don't forget it is modular, kernel modules are loaded as needed. Thus it is still possible to produce a Linux distribution with a very small footprint.

See: Kernel Size Tuning Guide -

If you read Linux_tiny.pdf you will see this

  • historic 0.99pl15 kernel: Slackware 1.1.2, 1994 301K
  • Fedora Core 2 1.2M
  • SuSE 9.1 1.5M
  • 2.6.5-tiny1 test config: IDE, ext2, TCP, NIC 363K
  • 0
Reply Report

Related Questions

Trending Tags