multiboot 2 header

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

multiboot 2 header

Post by lemonyii »

hi,
sorry for my posting frequently, but i'm really working hard.
this is my most simple multiboot 2 header:

Code: Select all

MAGIC       equ		0xE85250D6           	; 'magic number' , version 1.6
ARCH		equ		0
HDRLEN		equ		24
CHECKSUM    equ		-(MAGIC + ARCH + HDRLEN + 8) 

align 	8
MultiBoot2Header:
dd	MAGIC
dd	ARCH
dd	HDRLEN
dd	CHECKSUM
dd	0				;tag end
dd	8
but it can't be recognized by grub2. is there any fields that must present here? i didn't see any.
there is a sample but the CHECKSUM field is not complete. chechsum is bad, what a disaster!
can anyone figure it out for me or do you have a sample?
thank you,
lemonyii
Enjoy my life!------A fish with a tattooed retina
User avatar
xvedejas
Member
Member
Posts: 168
Joined: Thu Jun 04, 2009 5:01 pm

Re: multiboot 2 header

Post by xvedejas »

The magic number for GRUB2 is 0x1BADB002...
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: multiboot 2 header

Post by Owen »

xvedejas wrote:The magic number for GRUB2 is 0x1BADB002...
1BADB002 is Multiboot 1.
Hangin10
Member
Member
Posts: 162
Joined: Wed Feb 27, 2008 12:40 am

Re: multiboot 2 header

Post by Hangin10 »

The tagged format is just for GRUB -> Kernel, so perhaps removing those two extra dwords from the end (and correcting header size & checksum) will help?
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

Re: multiboot 2 header

Post by lemonyii »

Hangin10 wrote:The tagged format is just for GRUB -> Kernel, so perhaps removing those two extra dwords from the end (and correcting header size & checksum) will help?
in fact my first one is without that two dwords, and of course do not work. then i found there is a tag of TAG_END, and it seems very special, so i added them. it seems the sample in specification helps a lot, but mine is almost copied from it.
still working.
thank you,
lemonyii
Enjoy my life!------A fish with a tattooed retina
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: multiboot 2 header

Post by gerryg400 »

Check this thread. The Grub2 implementation does not match the spec.

http://forum.osdev.org/viewtopic.php?f= ... 81&start=0
If a trainstation is where trains stop, what is a workstation ?
User avatar
lemonyii
Member
Member
Posts: 153
Joined: Thu Mar 25, 2010 11:28 pm
Location: China

Re: multiboot 2 header

Post by lemonyii »

oh, thank you so much!
hell the grub2! and i hope that's the only place that grub2 do not support in the sepci. if any more, i'll consider to follow multiboot1.
trying.
thanks!
lemonyii
Enjoy my life!------A fish with a tattooed retina
User avatar
tongko
Member
Member
Posts: 26
Joined: Wed Nov 07, 2012 2:40 am
Location: Petaling Jaya, Malaysia

Re: multiboot 2 header

Post by tongko »

Hi, not sure this will help. I'm facing problem where grub 2 doesn't recognize the multiboot2 magic, but then I read it somewhere on the web and change my grub.cfg to the following:

Code: Select all

set timeout=15
set default=0

menuentry "Sin Hing 0.0.1" {
	multiboot2 /boot/shos.bin
}
Run grub-file:

Code: Select all

grub-file --is-x86-multiboot2 shos.bin
return 0, which means it is multiboot2 confirmed.

But then now I hit into error message saying "out of memory"...
MichaelPetch
Member
Member
Posts: 799
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: multiboot 2 header

Post by MichaelPetch »

tongko wrote:But then now I hit into error message saying "out of memory"...
Did you specify an entry point?
User avatar
tongko
Member
Member
Posts: 26
Joined: Wed Nov 07, 2012 2:40 am
Location: Petaling Jaya, Malaysia

Re: multiboot 2 header

Post by tongko »

MichaelPetch wrote:
tongko wrote:But then now I hit into error message saying "out of memory"...
Did you specify an entry point?
Thanks for asking, I just solved this. Apparently, this is a typo mistake, I want to set my stack size to 1M, so I bring up the calculator and punch in 1024*1024*1024... :oops:

now that I've change it to 0x100000 then everything just working as intended, well, not everything, but at least, I can now dive into my C code which I'm more familiar with, compare to the ASM.

BTW, to the OP, I'm using Grub 2.02, which now the multiboot2 header are conform to the specification, I guess. I download the Grub2 source code and perform a search to find the multiboot2.h and found that it is fixed now. Hope this help.
Post Reply