Page 1 of 1

[SOLVED] GRUB: No multiboot header found

Posted: Tue Dec 10, 2024 4:31 am
by forgetme11
This is the multiboot2 header in the disassembled binary:

Code: Select all

0000000000000000 <multiboot2_header>:
       0:       e8 52 50 d6 00          call   d65057 <initial_stack+0xd5668f>
       5:       00 00                   add    %al,(%rax)
       7:       00 10                   add    %bl,(%rax)
       9:       00 00                   add    %al,(%rax)
       b:       00 17                   add    %dl,(%rdi)
       d:       ad                      lods   %ds:(%rsi),%eax
       e:       af                      scas   %es:(%rdi),%eax
       f:       1A ...
The fields summed should wrap around to 32bit 0, the specification says nothing else is needed from an ELF kernel.

This is the text section from linkconfig.ld (copied from wiki.osdev.org/Bare_Bones#Linking_the_Kernel):

Code: Select all

        .text BLOCK(4K) : ALIGN(4K)
        {
                *(.multiboot)
                *(.text)
        }
In case there is some known (not to me) GRUB2 quirk I followed wiki.osdev.org/GRUB to make an iso bootable by qemu

edit: I had forgot to change the length from 0x18 to 0x10 after removing a tag #-o from the header, take 3, problem persists, I am the worst developer in the world.

Re: GRUB: No multiboot header found

Posted: Tue Dec 10, 2024 7:04 am
by iansjack
Your magic number is 0xD65052E8. It should be 0xE85250D6.

Re: GRUB: No multiboot header found

Posted: Tue Dec 10, 2024 7:20 am
by forgetme11
Looks right to me, the bytes are on the left, the right is just what the assembler interpreted that as...

Re: GRUB: No multiboot header found

Posted: Tue Dec 10, 2024 7:22 am
by iansjack
The x86 is a little-endian processor.

Re: GRUB: No multiboot header found

Posted: Tue Dec 10, 2024 7:37 am
by forgetme11
#-o
Yeah it works now lol, thank you.