OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:48 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: multiboot 2 header
PostPosted: Sun Sep 19, 2010 10:34 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 25, 2010 11:28 pm
Posts: 153
Location: China
hi,
sorry for my posting frequently, but i'm really working hard.
this is my most simple multiboot 2 header:
Code:
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


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Sun Sep 19, 2010 12:34 pm 
Offline
Member
Member
User avatar

Joined: Thu Jun 04, 2009 5:01 pm
Posts: 168
The magic number for GRUB2 is 0x1BADB002...

_________________
Valix is an experiment in an interpreted userspace with object-oriented and functional design patterns. Developers needed! Join #valix on irc.freenode.net


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Sun Sep 19, 2010 4:26 pm 
Offline
Member
Member
User avatar

Joined: Fri Jun 13, 2008 3:21 pm
Posts: 1700
Location: Cambridge, United Kingdom
xvedejas wrote:
The magic number for GRUB2 is 0x1BADB002...


1BADB002 is Multiboot 1.


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Sun Sep 19, 2010 5:00 pm 
Offline
Member
Member

Joined: Wed Feb 27, 2008 12:40 am
Posts: 162
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?


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Sun Sep 19, 2010 6:48 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 25, 2010 11:28 pm
Posts: 153
Location: China
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


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Mon Sep 20, 2010 1:50 am 
Offline
Member
Member

Joined: Thu Mar 25, 2010 11:26 pm
Posts: 1801
Location: Melbourne, Australia
Check this thread. The Grub2 implementation does not match the spec.

http://forum.osdev.org/viewtopic.php?f=1&t=22481&start=0

_________________
If a trainstation is where trains stop, what is a workstation ?


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Mon Sep 20, 2010 2:25 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 25, 2010 11:28 pm
Posts: 153
Location: China
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


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Thu Nov 16, 2017 11:45 am 
Offline
Member
Member
User avatar

Joined: Wed Nov 07, 2012 2:40 am
Posts: 26
Location: Petaling Jaya, Malaysia
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:
set timeout=15
set default=0

menuentry "Sin Hing 0.0.1" {
   multiboot2 /boot/shos.bin
}


Run grub-file:
Code:
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"...


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Thu Nov 16, 2017 4:47 pm 
Offline
Member
Member

Joined: Fri Aug 26, 2016 1:41 pm
Posts: 671
tongko wrote:
But then now I hit into error message saying "out of memory"...
Did you specify an entry point?


Top
 Profile  
 
 Post subject: Re: multiboot 2 header
PostPosted: Thu Nov 16, 2017 9:30 pm 
Offline
Member
Member
User avatar

Joined: Wed Nov 07, 2012 2:40 am
Posts: 26
Location: Petaling Jaya, Malaysia
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], SemrushBot [Bot] and 53 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group