mbcheck says my multiboot header has bad checksum
Posted: Sun Jan 13, 2013 2:37 pm
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:
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:
This multiboot header looks fine, and is not what mbcheck said. But looking further down the hexdump I see:
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).
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).
Code: Select all
00000160 02 b0 ad 1b 03 00 00 00 fb 4f 52 e4 bc 00 40 00 |.........OR...@.|
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.........|
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).