Skip to content

Commit d90fedb

Browse files
committed
multiboot2-header: update README.md
1 parent dddfed0 commit d90fedb

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

multiboot2-header/README.md

+12-9
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@
33
[![crates.io](https://img.shields.io/crates/v/multiboot2-header.svg)](https://crates.io/crates/multiboot2-header)
44
[![docs](https://docs.rs/multiboot2-header/badge.svg)](https://docs.rs/multiboot2-header/)
55

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

910
What this library is good for:
10-
- writing a small binary which writes you a valid Multiboot2 header
11-
into a file (such as `header.bin`)
11+
- construct a Multiboot2 header at runtime (constructing one at build-time with
12+
macros is not done yet, contributions are welcome!)
13+
- write a Multiboot2-bootloader that parses a Multiboot2-header
1214
- understanding Multiboot2 headers better
1315
- analyze Multiboot2 headers at runtime
1416

15-
What this library is not optimal for:
16-
- compiling a Multiboot2 header statically into an object file using only Rust code
17-
1817
## Features and `no_std` Compatibility
18+
1919
This library is always `no_std` without `alloc`. However, the default `builder`-
2020
feature requires the `alloc`-crate and an `#[global_allocator]` to be available.
2121
You need the `builder` only if you want to construct new headers at runtime.
22-
For parsing, this is not relevant, and you can deactivate the default feature.
22+
For parsing, the feature is not relevant, and you can deactivate it.
2323

2424
```toml
2525
# without `builder`-feature (and without `alloc`-crate)
@@ -29,6 +29,7 @@ multiboot2-header = "<latest>"
2929
```
3030

3131
## Example 1: Builder + Parse
32+
3233
```rust
3334
use multiboot2_header::builder::{InformationRequestHeaderTagBuilder, Multiboot2HeaderBuilder};
3435
use multiboot2_header::{HeaderTagFlag, HeaderTagISA, MbiTagType, RelocatableHeaderTag, RelocatableHeaderTagPreference, Multiboot2Header};
@@ -58,17 +59,19 @@ fn main() {
5859
```
5960

6061
## Example 2: Multiboot2 header as static data in Rust file
62+
6163
You can use the builder, construct a Multiboot2 header, write it to a file and include it like this:
6264
```
6365
#[used]
6466
#[no_mangle]
6567
#[link_section = ".text.multiboot2_header"]
66-
static MULTIBOOT2_HDR: &[u8; 64] = include_bytes!("mb2_hdr_dump.bin");
68+
static MULTIBOOT2_HDR: [u8; 64] = include_bytes!("mb2_hdr_dump.bin");
6769
```
6870
You may need a special linker script to place this in a LOAD segment with a file offset with less than 32768 bytes.
6971
See specification.
7072

7173
## MSRV
74+
7275
The MSRV is 1.69.0 stable.
7376

7477
## License & Contribution

multiboot2-header/src/lib.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
//! Library with type definitions and parsing functions for Multiboot2 headers.
2-
//! This library is `no_std` and can be used in bootloaders.
1+
//! Rust library with type definitions and parsing functions for Multiboot2
2+
//! headers, as well as a builder to build them at runtime. This library is
3+
//! `no_std` and can be used in bootloaders.
34
//!
45
//! # Example
6+
//!
57
//! ```rust
68
//! use multiboot2_header::builder::{InformationRequestHeaderTagBuilder, HeaderBuilder};
79
//! use multiboot2_header::{HeaderTagFlag, HeaderTagISA, MbiTagType, RelocatableHeaderTag, RelocatableHeaderTagPreference, Multiboot2Header};
@@ -31,6 +33,7 @@
3133
//! ```
3234
//!
3335
//! ## MSRV
36+
//!
3437
//! The MSRV is 1.69.0 stable.
3538
3639
#![no_std]

0 commit comments

Comments
 (0)