#kernel-bootloader #bootloader #multiboot2 #kernel #no-alloc #boot

no-std multiboot2

Convenient and safe parsing of Multiboot2 Boot Information (MBI) structures and the contained information tags. Usable in no_std environments, such as a kernel. An optional builder feature also allows the construction of the corresponding structures.

5 releases

0.23.1 Oct 22, 2024
0.22.2 Aug 24, 2024
0.20.2 May 26, 2024
0.19.0 Sep 21, 2023
0.3.1 Oct 31, 2016

#128 in Operating systems

Download history 263/week @ 2025-01-31 1599/week @ 2025-02-07 1247/week @ 2025-02-14 1581/week @ 2025-02-21 1765/week @ 2025-02-28 1454/week @ 2025-03-07 3090/week @ 2025-03-14 3746/week @ 2025-03-21 3007/week @ 2025-03-28 2521/week @ 2025-04-04 2064/week @ 2025-04-11 2479/week @ 2025-04-18 1483/week @ 2025-04-25 1204/week @ 2025-05-02 2017/week @ 2025-05-09 1420/week @ 2025-05-16

6,355 downloads per month
Used in 6 crates (3 directly)

MIT/Apache

1MB
5K SLoC

multiboot2

crates.io docs

Convenient and safe parsing of Multiboot2 Boot Information (MBI) structures and the contained information tags. Usable in no_std environments, such as a kernel. An optional builder feature also allows the construction of the corresponding structures.

It follows the Multiboot 2.0 specification at https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html and the ELF 64 specification at http://www.uclibc.org/docs/elf-64-gen.pdf.

Design

For every Multiboot2 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 on the corresponding types.

Features and no_std Compatibility

This library is always no_std without alloc. However, the default builder- feature requires the alloc-crate and an #[global_allocator] to be available. You need the builder only if you want to construct new boot information structures at runtime. For parsing, this is not relevant, and you can deactivate the default features.

Background: The Multiboot 2 Information Structure

The Multiboot information structure looks like this:

Field Type
total size u32
reserved u32
tags variable
end tag = (0, 8) (u32, u32)

There are many different types of tags, but they all have the same beginning:

Field Type
type u32
size u32
other fields variable

MSRV

The MSRV is 1.75.0 stable.

License & Contribution

See main README file.

Dependencies