Multiboot Header - Has the magic number changed?
Multiboot Header - Has the magic number changed?
Now that I have my kernel compiling and installing on my computer; I have been trying to get it to boot with grub2 like it says in the wiki. My problem is there seems to be a lack of information on how to set up the multiboot header, and apparently the magic number has changed. Can anyone point me to information on how to get this working? NOTE: I did google this.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Re: Multiboot Header - Has the magic number changed?
Grub2 is supposed to implement the old multiboot standard as well as the new one. At least, that was the case at some point. The new multiboot draft says the new magic number is 0x36d76289. That may or may not be correct. Documentation for grub2 (and the new multiboot stuff in general) is rather nonexistant, so your best bet would be to look at the code. Unfortunately the web interface to view the code is throwing 503 errors right now.nekros wrote:Now that I have my kernel compiling and installing on my computer; I have been trying to get it to boot with grub2 like it says in the wiki. My problem is there seems to be a lack of information on how to set up the multiboot header, and apparently the magic number has changed. Can anyone point me to information on how to get this working? NOTE: I did google this.
Re: Multiboot Header - Has the magic number changed?
As far as I can see, my kubuntu 9.10 installation uses Grub2 and it boots my kernel (which is multiboot 1 compliant) without problems..
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Multiboot Header - Has the magic number changed?
A couple of months ago Grub2 had a massive bug booting Multiboot 2 kernels (It read 1kb, searched it for a MB1 header, read another kb, searched for an MB2 header... see the problem?)
Regardless, MB1 support is/is supposed to be the same as for Grub Legacy
Regardless, MB1 support is/is supposed to be the same as for Grub Legacy
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot Header - Has the magic number changed?
That draft was never implemented and never will be. Multiboot 2 has been completely dropped and the magic value is the same as it was before. Note that hey are going to use the tagged format and add support for extra architectures in Multiboot 1.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Multiboot Header - Has the magic number changed?
The tagged format IS Multiboot 2. You cannot implement a tagged format in the context of Multiboot 1: The specification is completely inextensible.
Not to mention completely lacking in 64-bit support.
Not to mention completely lacking in 64-bit support.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot Header - Has the magic number changed?
Okay, maybe both me and the rest of the developer folks of GRUB are wrong and you are right.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: Multiboot Header - Has the magic number changed?
What I'm saying is this: You can't implement a tagged format without changing the magic number
Re: Multiboot Header - Has the magic number changed?
In the end, I think I'll just write my own elf bootloader....
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot Header - Has the magic number changed?
There's no information missing on the wiki, you're screwing it up somehow. You just have to have the header somewhere in the first 8192 of the image, 32-bit aligned.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Multiboot Header - Has the magic number changed?
I've done that with both 1 and 2 headers still says header not found.
Working On:Bootloader, RWFS Image Program
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
Leviathan: http://leviathanv.googlecode.com
Kernel:Working on Design Doc
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot Header - Has the magic number changed?
Post the header and linker script.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Multiboot Header - Has the magic number changed?
I'm having the same problem so I'll go ahead and post *my* code
start.asm (FASM syntax)
link.ld
start.asm (FASM syntax)
Code: Select all
...
section '.text'
align 4
mboot:
; This is the GRUB Multiboot header
dd 0x1BADB002 ; header magic
dd 3 ; header flags
dd -(0x1BADB002 + 3) ; header checksum
dd mboot
...
Code: Select all
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
end = .;
}
Valix is an experiment in an interpreted userspace with object-oriented and functional design patterns. Developers needed! Join #valix on irc.freenode.net
Re: Multiboot Header - Has the magic number changed?
Maybe that's not the cause of your problem - but it's definitely a thing to change.
Never put the multiboot header into your .text section (because the linker might move that header anywhere in that section). A better approach is to create a new section called ".multiboot" or something like that and to tell your linker to put that section in front of everything. That's at least what I do (and I have no problems with that though I'm still using GRUB legacy ).
Never put the multiboot header into your .text section (because the linker might move that header anywhere in that section). A better approach is to create a new section called ".multiboot" or something like that and to tell your linker to put that section in front of everything. That's at least what I do (and I have no problems with that though I'm still using GRUB legacy ).
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Multiboot Header - Has the magic number changed?
It is not a mistake to have the multiboot header in the .text section, it is in fact the most common approach. You needn't be afraid that your header will end up in some random place because you basically end up with the assembly code generated from the C file appended to the multiboot header part. Having a separate section is inconsistent with many executable formats (e.g., a.out).
As for the linker script, look closely at ".".
As for the linker script, look closely at ".".
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]