Page 1 of 1

Creating GRUB ISO image

Posted: Thu Jul 05, 2012 1:05 am
by blm768
I've been trying to create a bootable GRUB image for my OS, but I can't figure out how to get it to work. I've based my setup on the GRUB2 wiki page.

File tree:

Code: Select all

-iso:
    -boot:
    -boot32.bin
    -grub:
        grub.cfg
My grub.cfg is:
menuentry "OS" {
multiboot /boot/boot32.bin
boot
}

The command I'm using to make the image:
grub-mkrescue --modules="multiboot biosdisk iso9660 sh" -o boot.iso iso

When I try this, GRUB brings up its menu with the proper entry, but it gives the error "unsupported flag: 0xb."

Running the code with qemu's -kernel flag works just fine, so I'm not sure what could be wrong. I'm thinking that my Multiboot header might be misaligned, but that seems doubtful because it's right at the beginning of the .text section.

Re: Creating GRUB ISO image

Posted: Thu Jul 05, 2012 2:44 am
by jnc100
What value are you using for the 'flags' field in the multiboot header in your kernel? Grub seems to think you are setting bits 0, 1 and 3 (0xb) and setting bit 3 is unsupported. From a quick read of the sources, it will only produce this error if it has already found the multiboot header (as identified by the magic number and a valid checksum) so your problem is probably not alignment issues.

Regards,
John.

Re: Creating GRUB ISO image

Posted: Thu Jul 05, 2012 10:32 am
by blm768
jnc100 wrote:What value are you using for the 'flags' field in the multiboot header in your kernel? Grub seems to think you are setting bits 0, 1 and 3 (0xb) and setting bit 3 is unsupported. From a quick read of the sources, it will only produce this error if it has already found the multiboot header (as identified by the magic number and a valid checksum) so your problem is probably not alignment issues.

Regards,
John.
That's what I found as well, but I fixed the issue in my source without results. I initially thought that it was reading some other data as the header, but I just realized that my build system might have "forgotten" to rebuild it; it's a bit convoluted because I'm using an IDE and had to patch in a custom build tool (make macros are horribly broken :)).