mbcheck says my multiboot header has bad checksum

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
gsingh2011
Member
Member
Posts: 83
Joined: Tue Feb 03, 2009 11:37 am

mbcheck says my multiboot header has bad checksum

Post by gsingh2011 »

After following the bare bones tutorial, I ran mbcheck on loader.o and kernel.bin. I also modified the mbcheck.c file to print out the magic and the flags so I could see what was causing the problem. The output is very strange:

Code: Select all

$ mbcheck loader.o
loader.o: The Multiboot header is found at the offset 564.
magic: 0x1badb002
flags: 0x30fff10000
loader.o: Bad checksum (0xe4524ffb).
$ mbcheck kernel.bin 
kernel.bin: The Multiboot header is found at the offset 4560.
magic: 0x1badb002
flags: 0x2afff10000
kernel.bin: Bad checksum (0xe4524ffb).
As you can see, the issue is with the flags. The hex value should be 0x03 in the bare bones tutorial, and yet it's not in the hex. After inspecting both files with hexdump, I see something very strange:

Code: Select all

00000160  02 b0 ad 1b 03 00 00 00  fb 4f 52 e4 bc 00 40 00  |.........OR...@.|
This multiboot header looks fine, and is not what mbcheck said. But looking further down the hexdump I see:

Code: Select all

00000230  2a 00 00 00 02 b0 ad 1b  00 00 00 00 00 00 f1 ff  |*...............|
00000240  30 00 00 00 fb 4f 52 e4  00 00 00 00 00 00 f1 ff  |0....OR.........|
And this is what mbcheck told me. Running hexdump on the other file gives a similar output.

So my question is this: Why do I see the multiboot header multiple times in hexdump? Why is it wrong the second time? And will grub use the first correct version or the second incorrect version (my kernel does not boot, so I think it may be using the incorrect version).
gsingh2011
Member
Member
Posts: 83
Joined: Tue Feb 03, 2009 11:37 am

Re: mbcheck says my multiboot header has bad checksum

Post by gsingh2011 »

So turns out my kernel boots fine, even though mbcheck says the checksum is off.

Could this be a bug with mbcheck?
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: mbcheck says my multiboot header has bad checksum

Post by dozniak »

Is your mbcheck compiled as a 32-bits app?
Learn to read.
gsingh2011
Member
Member
Posts: 83
Joined: Tue Feb 03, 2009 11:37 am

Re: mbcheck says my multiboot header has bad checksum

Post by gsingh2011 »

dozniak wrote:Is your mbcheck compiled as a 32-bits app?
Nope, it was compiled as 64 bit and compiling as 32 bit fixed the problem. Thanks :)
Post Reply