background preloader

Linux

Facebook Twitter

Linux initial RAM disk (initrd) overview. Learn about its anatomy, creation, and use in the Linux boot process M. JonesPublished on July 31, 2006 What's an initial RAM disk? The initial RAM disk (initrd) is an initial root file system that is mounted prior to when the real root file system is available. The initrd is bound to the kernel and loaded as part of the kernel boot procedure. The initrd contains a minimal set of directories and executables to achieve this, such as the insmod tool to install kernel modules into the kernel.

In the case of desktop or server Linux systems, the initrd is a transient file system. Anatomy of the initrd The initrd image contains the necessary executables and system files to support the second-stage boot of a Linux system. Depending on which version of Linux you're running, the method for creating the initial RAM disk can vary. Listing 1. You can now inspect the /mnt/initrd subdirectory for the contents of the initrd. Listing 2. The result is a small root file system, as shown in Listing 3. Summary. Inside the Linux boot process. In the early days, bootstrapping a computer meant feeding a paper tape containing a boot program or manually loading a boot program using the front panel address/data/control switches. Today's computers are equipped with facilities to simplify the boot process, but that doesn't necessarily make it simple.

Let's start with a high-level view of Linux boot so you can see the entire landscape. Then we'll review what's going on at each of the individual steps. Source references along the way will help you navigate the kernel tree and dig in further. Overview Figure 1 gives you the 20,000-foot view. Figure 1. When a system is first booted, or is reset, the processor executes code at a well-known location. When a boot device is found, the first-stage boot loader is loaded into RAM and executed. When the second-stage boot loader is in RAM and executing, a splash screen is commonly displayed, and Linux and an optional initial RAM disk (temporary root file system) are loaded into memory.

Back to top. uClinux™ -- Embedded Linux Microcontroller Project -- Home Page. Access the Linux kernel using the /proc filesystem. The /proc filesystem was originally developed to provide information on the processes in a system. But given the filesystem's usefulness, many elements of the kernel use it both to report information and to enable dynamic runtime configuration. The /proc filesystem contains directories (as a way of organizing information) and virtual files. A virtual file can present information from the kernel to the user and also serve as a means of sending information from the user to the kernel. It's not actually required to do both, but this article show you how to configure the filesystem for input and output.

A short article like this can't detail all the uses of /proc, but it does demonstrate a couple of uses to give you an idea of how powerful /proc can be. Listing 1 is an interactive tour of some of the /proc elements. Listing 1. Listing 2 illustrates reading from and then writing to a virtual file in /proc. Listing 2. Alternatively, you could use sysctl to configure these kernel items.

Anatomy of the Linux file system. Basic file system architecture The Linux file system architecture is an interesting example of abstracting complexity. Using a common set of API functions, a large variety of file systems can be supported on a large variety of storage devices. Take, for example, the read function call, which allows some number of bytes to be read from a given file descriptor.

The read function is unaware of file system types, such as ext3 or NFS. It is also unaware of the particular storage medium upon which the file system is mounted, such as AT Attachment Packet Interface (ATAPI) disk, Serial-Attached SCSI (SAS) disk, or Serial Advanced Technology Attachment (SATA) disk. Back to top What is a file system? I'll start with an answer to the most basic question, the definition of a file system.

Mounting Associating a file system to a storage device in Linux is a process called mounting. Listing 1. . $ dd if=/dev/zero of=file.img bs=1k count=10000 10000+0 records in 10000+0 records out $ Listing 2. Listing 3. Bootchart. Linux: Init Process and PC Boot Procedure. PC Boot and Linux Init Process: BIOS: The Basic Input/Output System is the lowest level interface between the computer and peripherals. The BIOS performs integrity checks on memory and seeks instructions on the Master Boor Record (MBR) on the floppy drive or hard drive. The MBR points to the boot loader (GRUB or LILO: Linux boot loader). Boot loader (GRUB or LILO) will then ask for the OS label which will identify which kernel to run and where it is located (hard drive and partition specified).

The installation process requires to creation/identification of partitions and where to install the OS. The Linux Init Processes: SysV init or systemd: The Linux and Unix SysV heritage began with the "sysvinit" process which used the /etc/inittab configuration file to drive the execution of init scripts and configuration of terminal and GUI interfaces. Launching processes: The init process is the last step in the boot procedure and identified by process id "1". System Processes: Systemd init: #! #!