[Top][All Lists]

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

Re: Contribution: a file loading module

From: Brendan Trotter
Subject: Re: Contribution: a file loading module
Date: Fri, 24 Jun 2011 21:01:05 +0930


Note: I am me. I speak on behalf of myself only, and don't represent
the views of the GRUB team in any way.

On Fri, Jun 24, 2011 at 7:03 PM, Pierre-Nicolas Clauss
<address@hidden> wrote:
> Are you saying that :
> kernel /my_multiboot_kernel
> chainloader /my_chainloader
> boot
> will load the kernel as per the multiboot header and then call the 
> chainloader ?
> does grub guarantee that the kernel will be kept in memory ?

The terminology GRUB uses is very misleading. What they call "kernel"
really means "the module that the boot loader should pass control to",
and it does not need to be a kernel as such. The "kernel" may just be
a layer that sets things up for the real kernel, where the real kernel
is loaded by GRUB as a module (or possibly not loaded by GRUB at all).

For example, if your chainloader is happy to relocate itself and then
copy the real kernel to 0x00100000, then you might do:

kernel /boot/my_chainloader
module /boot/my_kernel

Otherwise, if you want to keep your chainloader "as is" for other
reasons, then you might want an extra layer ("thunk code") to set
things up in the state your chainloader expects (e.g. relocate things,
potentially switch CPU modes, etc):

kernel /boot/my_thunk_code
module /boot/my_chainloader
module /boot/my_kernel

In GRUB, "chainloading" is chainloading in the old MBR partition way -
e.g. loading a 512-byte boot sector from the start of a partition and
passing control to it (in real mode). GRUB can't pass control to a
512-byte boot sector while also passing control to "the module that
the boot loader should pass control to" (what GRUB incorrectly calls
"kernel") - it simply doesn't make sense.

If your chainloader actually is an old MBR partition style
chainloader, then you're not really using GRUB at all (you're using
the de facto boot method that's been standard for about 30 years,
which GRUB and just about every other boot manager for "80x86 PC BIOS"
happens to support).If your chainloader isn't an old MBR partition
style chainloader, then you should call it something different to
avoid confusion (maybe "<your OS name> stage 1".or something).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]