Re: Classic confusion: initrd-initramfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, Oct 8, 2009 at 8:49 AM, Rajat Jain <Rajat.Jain@xxxxxxxxxxxx> wrote:

Hi,

OK, I know enough has already been discussed on this topic and I think
that I'm just not able to put pieces in place. So I understand the basic
difference between an initrd (having a filesystem on a block /loopback
device and mounting it on a ramdisk) and initramfs (Having a compressed
cpio archieve included in the kernel image and weaving a file system
directly on RAM to see the contents of this cpio).
 
I assume this
discussion is not limited to x86 architectures and initrd / initram fs
can be used on all the other architectures also?


   As per my understanding, this should work for other architectures but not sure.

1) Firstly, are initramfs and initrd mutually exclusive techniques to
achieve the same goal (providing initial drivers)? Does enabling one
disable the other OR they complement / help each other? Conceptually,
the former should be true, but browsing through the kernel config, the
latter seems true.

All 2.6 Linux kernels contain a gzipped "cpio" format archive, which is
extracted into rootfs when the kernel boots up.  After extracting, the kernel
checks to see if rootfs contains a file "init", and if so it executes it as PID
1.  If found, this init process is responsible for bringing the system the
rest of the way up, including locating and mounting the real root device (if
any).  If rootfs does not contain an init program after the embedded cpio
archive is extracted into it, the kernel will fall through to the older code
to locate and mount a root partition, then exec some variant of /sbin/init
out of that.
Reference: Kernel Documentation file(~/linux-2.6.18/Documentation/filesystems/ramfs-rootfs-initramfs.txt).
 
2) The initrd image CANNOT be combined with kernel image to produce a
single image, and the initramfs image cannot be seperated out from
kernel image and later provided at boot time as a separate image, right?



 
3) I understand in case of initramfs, kernel does everything including
loading of initramfs image (since it is included in kernel image only).
But in case of initrd image, who loads the initrd image into memory? The
bootloader I assume ... Because grub and lilo have a "initrd" line in
their config file. But then how is it communicated to the kernel where
in RAM  (at which address) is the initrd loaded?


initrd is loaded by BIOS. BIOS handles all the work of loading it into memory.
Quick search gave me : http://www.alexonlinux.com/opening-and-modifying-the-initrd

The bootloader will load the kernel and initrd image into memory and then start the kernel, passing in the memory address of the initrd
 http://en.wikipedia.org/wiki/Initrd

4) How about non-X86 architectures that don't have lilo / grub? Who
loads initrd image into memory in that case and how is it communicated
to kernel?

5) What does the "initrd=" kernel command line parameter mean, and is it
applicable only for x86?

6) Is there a unified way of loading initrd on all architectures? Most
of the online text suggestes to make entry into lilo or grub, which are
not available else where...

Thanks & Best Regards,

Rajat Jain


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ




--
Thanks & Regards,
Ajit Subhash Mote


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux