The Mutliboot Specification is a specification allowing to forward important informations from a bootloader (such as Grub) to the kernel. It also specifies how a bootloader should load a kernel.
The multiboot header
A According to the multiboot specification, an OS image must contain a Multiboot Header within the first 8192 bytes of the file and must be aligned on 4 bytes.
A Multiboot compliant bootloader must be able to load ELF binaries, such as K.
In the Multiboot Header, you should have the following fields:
u32used to identify the header (value:
u32field used to specify the needed features. You should need the flag asking the bootloader to align all modules on a page boundary (0x1) and the flag asking the bootloader to pass memory informations to the kernel (0x2).
u32field whose value is
-(magic + flags)
The state of the system when the kernel starts to be executed is the following:
EAXcontains a magic value
EBXcontains the address of the Multiboot information structure
- The system is in 32 bits
The multiboot information structure
The bootloader fills a structure called Multiboot infortmation structure. It
is described in
You should check if the
flag field advertise that the informations you need
You will find in this structure the fields
mods_addr contains the address of an array of informations about the loaded
modules, such as the address where it is loaded and the size of the module. This
structure is defined in
module_t. The modules to load are
specified in the
grub.cfg. For K, the first module is the rom you should load.
You will need the command line passed to your kernel. You can find its address
cmdline field of your Multiboot information structure.
k/multboot.hcontains the structures used in the Multiboot specification
- Multiboot Specification