Skip to contentSkip to conversation

Grub-2 Multiboot

DISCUSSION Christian Schaubschlaeger 2 participants 7 messages Jun 6, 2008

lore
Share & tools
lore
#0 lore raw

Good morning,

I'm using grub-1.96. Today I tried to boot grub with grub itself using the multiboot mechanism. For that I made this entry in grub.cfg:

menuentry "GRUB"
{
multiboot (hd0,1)/boot/kernel.exec
}

where kernel.exec is the grub-2 binary (including the multiboot header) which can be found in the grub-2 source directory after building grub.

Now when I try to boot this, I get the following error message:

error: segment doesn't fit in memory reserved for the OS (0x8200 < 0x100000)

In kern/i386/pc/startup.S the multiboot header is defined, along with this comment:

/*
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
* This uses the a.out kludge to load raw binary to the area starting at 1MB,
* and relocates itself after loaded.
*/

which made me think that it should be possible to boot grub with grub. Am I doing something wrong?

Thanks in advance,
Christian

#1 lore raw
Quoted 21 lines · Christian Schaubschlaeger

Good morning,

I'm using grub-1.96. Today I tried to boot grub with grub itself using the multiboot mechanism. For that I made this entry in grub.cfg:

menuentry "GRUB"
{
multiboot (hd0,1)/boot/kernel.exec
}

where kernel.exec is the grub-2 binary (including the multiboot header) which can be found in the grub-2 source directory after building grub.

Now when I try to boot this, I get the following error message:

error: segment doesn't fit in memory reserved for the OS (0x8200 < 0x100000)

In kern/i386/pc/startup.S the multiboot header is defined, along with this comment:

Quoted 8 lines

/*
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
* This uses the a.out kludge to load raw binary to the area starting at 1MB,
* and relocates itself after loaded.
*/

which made me think that it should be possible to boot grub with grub. Am I doing something wrong?

Hi,

you should use core.img created by grub-mkimage.

Signature · 1 line
Bean
#2 lore raw
Quoted 4 lines

Hi,

you should use core.img created by grub-mkimage.

core.img apparently is not an ELF image. When I try to load it, grub says:

error: unknown ELF class

Regards
Christian

#3 lore raw
Quoted 9 lines · Christian Schaubschlaeger
Quoted 4 lines

Hi,

you should use core.img created by grub-mkimage.

core.img apparently is not an ELF image. When I try to load it, grub says:

error: unknown ELF class

It's an a.out format multiboot kernel, you should be able to load it in grub2.

Signature · 1 line
Bean
#4 lore raw
Quoted 5 lines · Bean
Quoted 3 lines · Christian Schaubschlaeger
Quoted 3 lines

Hi,

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

you should use core.img created by grub-mkimage.

core.img apparently is not an ELF image. When I try to load it, grub says:

error: unknown ELF class

It's an a.out format multiboot kernel, you should be able to load it in grub2.

Oh, btw, I take a look at the changelog. The a.out support is added after 1.96 have been released, so you need to use the cvs version.

Signature · 1 line
Bean
#5 lore raw
In reply to Bean
Quoted 2 lines

It's an a.out format multiboot kernel, you should be able to load it in grub2.

Is it really a.out?

Quoted 1 line

file core.img

core.img: data

Quoted 1 line

objdump -D core.img

objdump: core.img: File format not recognized

Christian

#6 lore raw
Quoted 9 lines · Christian Schaubschlaeger
Quoted 2 lines

It's an a.out format multiboot kernel, you should be able to load it in grub2.

Is it really a.out?

Quoted 1 line

file core.img

core.img: data

Quoted 1 line

objdump -D core.img

objdump: core.img: File format not recognized

It's not really an a.out file, but it contains section information in the multiboot header that allows it to to be loadded successfully. Normally, this feature is used to load a.out file in a platform independent way, as the a.out header is not quite reliable. In the case of core.img, there is no a.out header at all, but the section information is inside the multiboot header.

Signature · 1 line
Bean