cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Commander Commander
Commander
  • 230 Views

in-memory filesystem during bootup

During the bootup of a Linux system, the kernel (optionally) 
mounts an in-memory filesystem, that is used to look for the
root filesystem.

Is there a configuration file that instructs the kernel on this
in-memory filesystem?

 

 

Trevor "Red Hat Evangelist" Chandler
Labels (3)
2 Replies
Sunnykumar1
Flight Engineer
Flight Engineer
  • 195 Views

@Trevor 

initramfs (Initial RAM File System) instructs the kernel about the in-memory filesystem used during early boot.

The kernel does not read a traditional text configuration file for this Instead, it loads an initramfs image, which contains:

- Early userspace

- Initialization scripts

- Modules needed to locate and mount the real root filesystem.

0 Kudos
Chetan_Tiwary_
Community Manager
Community Manager
  • 161 Views

@Trevor what a nice question ! Deep dive into Linux boot process !!

If you are asking about effectiveconfiguration” that instructs the kernel about the in-memory filesystem then it is in the boot loader’s config like /boot/grub/grub.cfg .

The instruction happens inside this bootloader configuration. When the bootloader starts the kernel, it passes the memory address of the initramfs to the kernel as a boot parameter.

if you are asking about where you can find an internal setting used when building the kernel itself. The CONFIG_INITRAMFS_SOURCE option in the kernel config allows the build system to bake the initramfs image directly into the kernel. If you do this, the filesystem becomes part of the kernel binary. This means the kernel does not need to look for an external image from the bootloader because it already has everything it needs inside.

When we configure the bootloader to load the kernel and the initramfs as distinct files, there’s no need to use CONFIG_INITRAMFS_SOURCE during the kernel build.

During the boot process, the kernel loads an image called the initramfs. This is basically a small, compressed CPIO archive that contains the bare essentials. The bootloader tells the kernel where to find this file using a setting like initrd=.

Once it is loaded, the kernel extracts it into a temporary spot in your system's memory. This creates a tiny, working environment that runs before the rest of the OS. Its main job is to find your actual hard drive, load the right drivers, and mount the real root filesystem. Once everything is ready, it hands off control to the real system and clears itself out of the way.

Just to let you know - initramfs is not mandatory. The kernel starts by using the initramfs as a temporary root filesystem. Inside this small system, a "pre-init" process kicks off. Its main job is to find and mount your real root disk. Once the real disk is ready, this process switches over and hands control to the standard init system. This hand-off is what allows your computer to finish booting and get you to a login screen.

Join the discussion
You must log in to join this conversation.