Re: initrd and noinitramfs.c -- the saga continues

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

 



On Sat, Dec 01, 2007 at 09:22:28PM -0500, Robert P. J. Day wrote:
> 
>   just perusing the simple code in init/noinitramfs.c, which is
> what's invoked if you choose not to build in initrd support:

No, that's invoked when you choose not to build initramfs. IOW: it is
used when you build with initrd.

> static int __init default_rootfs(void)
> {
>         int err;
> 
>         err = sys_mkdir("/dev", 0755);
>         if (err < 0)
>                 goto out;
> 
>         err = sys_mknod((const char __user *) "/dev/console",
>                         S_IFCHR | S_IRUSR | S_IWUSR,
>                         new_encode_dev(MKDEV(5, 1)));
>         if (err < 0)
>                 goto out;
> 
>         err = sys_mkdir("/root", 0700);
>         if (err < 0)
>                 goto out;
> 
>         return 0;
> 	...
> 
> so, if you choose not to select initrd support, then the above trivial
> initial root filesystem better be everything you need to completely
> finish the boot process, right?  i just want to make sure i'm not
> overlooking anything subtle.

No, when you don't use initrd, you get initramfs. The trivial initramfs
contains the same what the above code has, but in a packed cpio
archive. If you choose to use initrd, you don't get that packed cpio
archive, so the above code makes a simple root filesystem on which the
initrd image is mounted.

The difference between initrd and initramfs is that initrd contains a
filesystem image that's being put in a ramdisk and initramfs contains a
cpio archive that's put into the page cache (using ramfs/tmpfs). The
advantage of initramfs is that it doesn't need any particular
filesystem compiled into the kernel (i.e.: everything can be modular)
and that the final filesystem only occupies exactly enough space (no
wasted empty space in the ramdisk).


Erik

-- 
They're all fools. Don't worry. Darwin may be slow, but he'll
eventually get them. -- Matthew Lammers in alt.sysadmin.recovery

Attachment: signature.asc
Description: Digital signature


[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