multiboot2-header
Convenient and safe parsing of Multiboot2 Header structures and the
contained header tags. Usable in no_std environments, such as a
bootloader. The default builder feature also allows the construction of
the corresponding structures.
Design
For every Multiboot2 header structure, there is an ABI-compatible rusty type. This enables a zero-copying parsing design while also enabling the creation of these structures via convenient constructors for the corresponding types.
Use-Cases
What this library is good for:
- construct a Multiboot2 header at runtime (constructing one at build time with macros is not done yet, contributions are welcome!)
- write a Multiboot2 bootloader that parses a Multiboot2 header
- understand Multiboot2 headers better
- analyze Multiboot2 headers at runtime
Features and no_std Compatibility
This library is always no_std. The default builder feature enables alloc;
using it requires an #[global_allocator]. Remove that feature if you do not
need to construct headers.
# Without the `builder` feature or the `alloc` crate:
= { = "<latest>", = false }
# With the default `builder` feature (requires the `alloc` crate):
= "<latest>"
Example 1: Builder + Parse
use ;
/// Small example that creates a Multiboot2 header and parses it afterwards.
Example 2: Multiboot2 header as static data in Rust file
You can use the builder, construct a Multiboot2 header, write it to a file and include it like this:
static MULTIBOOT2_HDR: = *include_bytes!;
You may need a special linker script to place this symbol in the first 32768 bytes of the ELF. See Multiboot2 specification.
MSRV
The MSRV is 1.85.1 stable.
License & Contribution
See main README file.