You are not logged in.

#1 2011-03-16 21:59:21

jacobopantoja
Member
From: Madrid
Registered: 2011-03-16
Posts: 44

initramfs vs grub2

Hi everybody,

I've been playing with GRUB2 this last year, and I've been able to boot into software raid 0 and 1, without a separate boot partition. This has allowed me understanding a bit more about grub.

This evening I've read the ach wiki article about initramfs, and I have the feeling that GRUB2 is capable of the same things that initramfs does. But I have googled and i haven't found *any* information or question about that.

The question is simple: Is it possible to bring up the kernel with grub2 at the point where initramfs brings it?

Thanks

Offline

#2 2011-03-16 23:19:06

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: initramfs vs grub2

Unless I misunderstand you, you're approaching this incorrectly.  The initramfs is  loaded by the bootloader,  and the latter precedes the former.  No bootloader means no booting, because no process exists to load the initramfs (aka initrd, though the terms are sometimes applied differently).  You need both to boot your system, and each needs the other to completely do its job.

Offline

#3 2011-03-17 01:01:56

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: initramfs vs grub2

To be thorough - it should also be noted that initramfs is optional. Arch uses it by default, but anyone who builds their own kernel can do without it in many cases.

Offline

#4 2011-03-17 17:43:20

jacobopantoja
Member
From: Madrid
Registered: 2011-03-16
Posts: 44

Re: initramfs vs grub2

Ok, I think I'm missing somewhere. By the way, ANOKNUSA, what I wanted to say is that if GRUB2 is capable of doing the initramfs stuff, not the contrary.
Let's imagine GRUB2 bringing up a system whose root is an encrypted LVM volume, and /boot being part of this volume (not a separate partition). GRUB2 can perfectly load the kernel if the embedding has been done with the appropriate modules. Then, where is the point in using initramfs? Even with GRUB Legacy, if you have a separate /boot partition, you can load the kernel image with the lvm and encryption support built-in, so I don't see neither the point in using initramfs.
So, despite now I know that initramfs is optional (thanks to tomk for the clarification), I throw again my doubt: why is the normal thing to use initramfs?
Thanks for your time.

Last edited by jacobopantoja (2011-03-17 17:44:01)

Offline

#5 2011-03-17 20:43:32

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: initramfs vs grub2

jacobopantoja wrote:

So, despite now I know that initramfs is optional (thanks to tomk for the clarification), I throw again my doubt: why is the normal thing to use initramfs?

I'm not entirely sure, but my inference is that by default a distro kernel is configured to cover as many different bits of common hardware as possible, the modules for which are compiled into the initramfs (in Arch's case, using hooks and rc.conf, if I'm not mistaken).  During boot, the appropriate modules for one's system are probed and loaded, while the unnecessary ones remain in the background.  Someone who builds a custom kernel with all necessary modules hard-coded into it can skip initramfs, and thus decrease the amount of disk space used by the kernel and give a slight boost to the speed of boot-up.  I think the real benefit of this, however, might be that it decreases the odds of killing the boot process due to a corrupt initramfs.  I should probably do more homework before I say anything more on it, though. tongue 

You can check these out:
https://bbs.archlinux.org/viewtopic.php?id=43109
http://www.linuxquestions.org/questions … em-624308/

Offline

Board footer

Powered by FluxBB