Question on initrd and initramfs

Tobias Boege tobias at gambas-buch.de
Sat Sep 29 14:10:17 EDT 2012


On Sun, 30 Sep 2012, Mulyadi Santosa wrote:
> Hi...
> 
> On Fri, Sep 28, 2012 at 5:56 PM, Ezequiel Garcia <elezegarcia at gmail.com> wrote:
> > Please note that the image you give qemu (or bootloader)
> > to use as initrd is *not* formatted using any mkfs.
> > It's just created with:
> >
> > $ find . | cpio -H newc -o > ../initramfs.cpio
> 
> Yup I am aware of that :)
> 
> > And the compiled kernel has no support for *any* filesystem.
> > So, the question is: how are those files formatted?
> 
> Now that's something I can't answer definitively. I just guess that,
> somewhere inside kernel code, there is certain code that can't be
> toggled on or off i.e it is always enabled. And that code, one of
> them, is tackling this initramfs unpacking.
> 
> > (Guess the answer is: look at the code)
> 
> Eventually...well, yes :)
> 

Have you read Documentation/filesystems/ramfs-rootfs-initramfs.txt? I didn't
but there are some eye-catching statements:

1. initramfs becomes a rootfs (l. 86)
2. rootfs is a special instance of ramfs (l. 73)
3. ramfs cannot be turned off (l. 29ff)

This means that initramfs cannot be turned off.

4. initramfs is a gzipped cpio archive and contained within the kernel
   (l. 85) and so is the cpio extractor code (l. 166f)
5. initramfs is automatically loaded as rootfs (l. 86)

Consequently, all that is essential to the kernel. Or not?
You may want to continue l. 95ff where it goes about filesystems.
Code is (at least) in init/initramfs.c. Please, CMIIW.

Regards,
Tobi




More information about the Kernelnewbies mailing list