multiboot specification and multiboot header

This specification adopts a compromise solution to this problem. Multiboot-compliant OS images always contain a magic Multiboot header (see OS image format), which allows the boot loader to load the image without having to understand numerous a.out variants or other executable formats. This magic header does not need to be at the very beginning of the executable file, so kernel images can still conform to the local a.out format variant in addition to being Multiboot-compliant.

An OS image may be an ordinary 32-bit executable file in the standard format for that particular operating system, except that it may be linked at a non-default load address to avoid loading on top of the PC’s I/O region or other reserved areas, and of course it should not use shared libraries or other fancy features.

An OS image must contain an additional header called Multiboot header, besides the headers of the format used by the OS image. The Multiboot header must be contained completely within the first 8192 bytes of the OS image, and must be longword (32-bit) aligned. In general, it should come as early as possible, and may be embedded in the beginning of the text segment after the real executable header.

The layout of the Multiboot header must be as follows:

OffsetTypeField NameNote
0u32magicrequired
4u32flagsrequired
8u32checksumrequired
12u32header_addrif flags[16] is set
16u32load_addrif flags[16] is set
20u32load_end_addrif flags[16] is set
24u32bss_end_addrif flags[16] is set
28u32entry_addrif flags[16] is set
32u32mode_typeif flags[2] is set
36u32widthif flags[2] is set
40u32heightif flags[2] is set
44u32depthif flags[2] is set

The field ‘magic’ is the magic number identifying the header, which must be the hexadecimal value 0x1BADB002.

The field ‘flags’ specifies features that the OS image requests or requires of an boot loader.

The field ‘checksum’ is a 32-bit unsigned value which, when added to the other magic fields (i.e. ‘magic’ and ‘flags’), must have a 32-bit unsigned sum of zero.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值