Multiboot

From OSDev Wiki
Jump to: navigation, search

The Multiboot specification is an open standard that provides kernels with a uniform way to be booted by Multiboot-compliant bootloaders. The reference implementation of the Multiboot specification is provided by GRUB.

Contents

Multiboot 1

The original Multiboot specification was created by Bryan Ford and Erich Stefan Boleyn in 1995. It has evolved and been updated by the Free Software Foundation ever since.

Multiboot 1 compliant kernels used the magic number 0x1BADB002, and Multiboot-compliant bootloaders report themselves with magic number 0x2BADB002.

You can check whether a program has a valid Multiboot 1 header by running grub-file which is quiet but will exit 0 if it finds a header, and 1 otherwise.

grub-file --is-x86-multiboot myos.bin

Multiboot 2

The newer Multiboot specification was created to solve some of the problems that the original specification had. It is not backwards compatible, uses different structures and different magic numbers.

Multiboot 2 compliant kernels used the magic number 0xE85250D6, and Multiboot-compliant bootloaders report themselves with magic number 0x36D76289.

You can check whether a program has a valid Multiboot 2 header by running grub-file which is quiet but will exit 0 if it finds a header, and 1 otherwise.

grub-file --is-x86-multiboot2 myos.bin

Note: GNU LD has default page size of 0x00200000 for elf64, which will fail multiboot2 test. You can use "-z max-page-size=SIZE" to get around this.

Multiboot 2 modules

(Note that this section may or may not be 100% accurate, has yet to be tested.)

The Multiboot 2 specification supports boot modules, which are pieces of data loaded into memory when the bootloader boots your kernel. Normally these are just files residing on the boot media, which are loaded by your boot loader, but the exact implementation is up to your bootloader. For GRUB, these modules are loaded using the "module" command before booting your kernel.

Once your kernel is booted, you can use the multiboot information structure to locate and identify these modules. Note that in the case of GRUB, the module's string will also include the text after the module name, for example, if you load a module using "module video 1024x768", the string field of that module's structure will contain "video 1024x768". In this way, you can specify 'arugments' to modules when you load them. (This seems to be the behaviour intended by the multiboot spec.)

GRUB may support decompressing modules before loading them, this seems to be driven by the extension of the file.

See Also

Articles

Threads

External Links

Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox
In other languages