Crate multiboot2_header

source ·
Expand description

Rust library with type definitions and parsing functions for Multiboot2 headers, as well as a builder to build them at runtime. This library is no_std and can be used in bootloaders.

§Example: Parsing a Header

use multiboot2_header::Multiboot2Header;

let ptr = 0x1337_0000 as *const u8 /* use real ptr here */;
let mb2_hdr = unsafe { Multiboot2Header::load(ptr.cast()) }.unwrap();
for _tag in mb2_hdr.iter() {
    //
}

§MSRV

The MSRV is 1.70.0 stable.

Structs§

  • This information does not need to be provided if the kernel image is in ELF format, but it must be provided if the image is in a.out format or in some other format. Required for legacy boot (BIOS). Determines load addresses.
  • Builder for a Multiboot2 header information.
  • Tells that a console must be available in MBI. Only relevant for legacy BIOS.
  • An C ABI-compatible dynamically sized type with a common sized Header and a dynamic amount of bytes. This structures owns all its bytes, unlike Header. Instances guarantees that the memory requirements promised in the crates description are respected.
  • This tag indicates that payload supports starting without terminating UEFI boot services. Or in other words: The payload wants to use UEFI boot services.
  • Terminates a list of optional tags in a Multiboot2 header.
  • Specifies the physical address to which the boot loader should jump in order to start running the operating system. Not needed for ELF files.
  • This tag is taken into account only on EFI i386 platforms when Multiboot2 image header contains EFI boot services tag. Then entry point specified in ELF header and the entry address tag of Multiboot2 header are ignored.
  • This tag is taken into account only on EFI amd64 platforms when Multiboot2 image header contains EFI boot services tag. Then entry point specified in ELF header and the entry address tag of Multiboot2 header are ignored.
  • Specifies the preferred graphics mode. If this tag is present the bootloader assumes that the payload has framebuffer support. Note: This is only a recommended mode. Only relevant on legacy BIOS.
  • The common header that all header tags share. Specific tags may have additional fields that depend on the typ and the size field.
  • Specifies what specific tag types the bootloader should provide inside the mbi.
  • Re-export of multiboot2::TagType from multiboot2-crate. Serialized form of TagType that matches the binary representation (u32). The abstraction corresponds to the typ/type field of a Multiboot2 TagHeader. This type can easily be created from or converted to TagType.
  • If this tag is present, provided boot modules must be page aligned.
  • The “basic” Multiboot2 header. This means only the properties, that are known during compile time. All other information are derived during runtime from the size property.
  • Wrapper type around a pointer to the Multiboot2 header. The Multiboot2 header is the Multiboot2BasicHeader followed by all tags (see crate::tags::HeaderTagType). Use this if you get a pointer to the header and just want to parse it. If you want to construct the type by yourself, please look at HeaderBuilder (requires the builder feature).
  • This tag indicates that the image is relocatable.

Enums§

  • Possible flags for ConsoleHeaderTag.
  • Flags for Multiboot2 header tags.
  • ISA/ARCH in Multiboot2 header.
  • Possible types for header tags of a Multiboot2 header. The names and values are taken from the example C code at the bottom of the Multiboot2 specification. This value stands in the typ property of HeaderTagHeader.
  • Errors that occur when a chunk of memory can’t be parsed as Multiboot2Header.
  • Re-export of multiboot2::TagType from multiboot2-crate. Higher level abstraction for TagTypeId that assigns each possible value to a specific semantic according to the specification. Additionally, it allows to use the TagType::Custom variant. It is not binary compatible with TagTypeId.
  • It contains load address placement suggestion for boot loader. Boot loader should follow it. ‘0’ means none, ‘1’ means load image at lowest possible address but not lower than min addr and ‘2’ means load image at highest possible address but not higher than max addr.

Constants§

Traits§

Type Aliases§

  • Iterator over the tags of a Multiboot2 boot information.