LINUX TIPS AND TRICKS --- May 05, 2000

Published by ITworld.com, the IT problem-solving network
http://www.itworld.com/newsletters

*********************************************************************


Modularized Kernel And The Initrd Utility
By Danny Kalev

Earlier versions of Linux used a monolithic kernel. In such a kernel, 
the system's device drivers are statically linked into the kernel's 
image. A monolithic kernel is inflexible because it has to be rebuilt
and reinstalled every time a module is added or removed. Due to its 
inflexibility, the system administrator has to compile support into a 
monolithic kernel even for drivers that are used infrequently. This is 
inefficient and can easily cause the kernel image to exceed the maximum 
size supported by Lilo and Loadlin.

Nowadays all Linux distributions support kernel modularization. A 
modularized kernel loads modules dynamically without forcing a rebuild. 
Thus, hardware components or file systems that are used infrequently can 
be loaded on demand and unloaded when no longer needed, instead of being 
compiled directly into the kernel. For example, most SCSI disk drivers 
are implemented as modules that the kernel can load dynamically.

You need an initrd image to load the SCSI module at boot time. The 
initrd (init RAM disk) utility performs a dual-stage boot process, 
whereby the Linux loader (either Lilo or Loadlin) first sets up on a RAM 
disk a temporary root system that includes all the modules that you 
would like to add. The special device file, /dev/initrd, contains the 
temporary file system. The second stage consists of loading the 
additional modules and mounting the real file system. 

Before you can use initrd, you need to compile both RAM disk support and 
initial RAM disk support into the kernel. Some Linux distributions 
streamline the creation of an initrd image. For example, Red Hat's Linux 
offers the mkinitrd facility for this purpose.

Consult the initrd man pages for further information or read the file 
called initrd.txt, which is usually located at 
usr/src/linux/Documentation/initrd.txt.

------------------------------------------------------------------
Questions? Comments? Join my Linux Software Development discussion on 
ITworld.com's Linux Forum: http://forums.itworld.com/webx?14@@.ee6b652 

About the author
----------------
Danny Kalev is a system analyst and software engineer with more
than 10 years of experience, specializing in C++ and
object-oriented analysis and design on various platforms including
VMS, DOS, Windows, Unix, and Linux. His technical interests involve
code optimization, networking, and distributed computing. He is
also a member of the ANSI C++ standardization committee and the
author of ANSI/ISO C++ Professional Programmer's Handbook (Que,
1999). Contact him at linuxnl@excite.com.
 
*********************************************************************