Skip to content

Commit 725ea5c

Browse files
authored
Merge pull request #122 from rust-osdev/multiboot2-v15-dev
multiboot2-v0.15
2 parents 95fb832 + 4b35d58 commit 725ea5c

22 files changed

+665
-199
lines changed

.github/workflows/_build-rust.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,51 @@ on:
1717
required: false
1818
default: x86_64-unknown-linux-gnu
1919
description: Rust target for the build step. Clippy and tests are still executed with the default target.
20+
features:
21+
type: string
22+
required: false
23+
# Make sure we always an empty string to "--features <FEATURES>"
24+
default: '""'
25+
description: Comma-separated String with additional Rust features relevant for a certain job.
2026
do-style-check:
2127
type: boolean
2228
required: false
2329
default: true
24-
description: Whether style checks should be done.
30+
description: Perform code and doc style checks.
2531
do-test:
2632
type: boolean
2733
required: false
2834
default: true
29-
description: Whether tests should be executed.
35+
description: Execute tests.
3036

3137
jobs:
32-
build:
38+
check_rust:
3339
runs-on: ubuntu-latest
3440
steps:
3541
- name: Check out
3642
uses: actions/checkout@v3
37-
- name: Install Rust
43+
- name: Set up rustup cache
44+
uses: actions/cache@v3
45+
continue-on-error: false
46+
with:
47+
path: |
48+
~/.rustup/downloads
49+
~/.rustup/toolchains
50+
# key: ${{ runner.os }}-rustup-${{ inputs.rust-version }}-${{ inputs.rust-target }}-${{ hashFiles('**/rustup-toolchain.toml') }}
51+
key: ${{ runner.os }}-rustup-${{ inputs.rust-version }}-${{ inputs.rust-target }}
52+
# The effect of this is must smaller than the cache for Cargo. However, it
53+
# still saves a few seconds. Note that many CI runs within a week may
54+
# quickly bring you close to the 10GB limit:
55+
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#managing-caches
56+
- name: Install Rust Toolchain via Rustup
3857
uses: actions-rs/toolchain@v1
3958
with:
4059
profile: minimal
4160
toolchain: ${{ inputs.rust-version }}
4261
override: true
4362
components: clippy, rustfmt
4463
target: ${{ inputs.rust-target }}
45-
- name: Set up cargo cache
64+
- name: Set up Cargo cache
4665
uses: actions/cache@v3
4766
continue-on-error: false
4867
with:
@@ -54,23 +73,22 @@ jobs:
5473
target/
5574
# We do not have a Cargo.lock here, so I hash Cargo.toml
5675
key: ${{ runner.os }}-rust-${{ inputs.rust-version }}-cargo-${{ hashFiles('**/Cargo.toml') }}
57-
restore-keys: ${{ runner.os }}-cargo-${{ inputs.rust-version }}
5876
- run: cargo version
77+
- name: Build (library)
78+
run: cargo build --target ${{ inputs.rust-target }} --features ${{ inputs.features }}
79+
- name: Build (all targets)
80+
run: cargo build --all-targets --features ${{ inputs.features }}
5981
- name: Code Formatting
6082
if: ${{ inputs.do-style-check }}
6183
run: cargo fmt --all -- --check
62-
- name: Build (library)
63-
run: cargo build --target ${{ inputs.rust-target }}
64-
- name: Build (all targets)
65-
run: cargo build --all-targets
6684
- name: Code Style and Doc Style
6785
if: ${{ inputs.do-style-check }}
6886
run: |
69-
cargo doc --document-private-items
70-
cargo clippy --all-targets
87+
cargo doc --document-private-items --features ${{ inputs.features }}
88+
cargo clippy --all-targets --features ${{ inputs.features }}
7189
- name: Unit Test
7290
if: ${{ inputs.do-test }}
7391
run: |
7492
curl -LsSf https://get.nexte.st/latest/linux | tar zxf -
7593
chmod u+x cargo-nextest
76-
./cargo-nextest nextest run
94+
./cargo-nextest nextest run --features ${{ inputs.features }}

.github/workflows/rust.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env:
1515
CARGO_TERM_COLOR: always
1616

1717
jobs:
18+
### Regular Build #########################
1819
build_msrv:
1920
name: build (msrv)
2021
uses: ./.github/workflows/_build-rust.yml
@@ -35,7 +36,9 @@ jobs:
3536
with:
3637
rust-version: nightly
3738
do-style-check: false
39+
features: unstable
3840

41+
### no-std Build #########################
3942
build_nostd_msrv:
4043
name: build no_std (msrv)
4144
needs: build_msrv
@@ -62,7 +65,9 @@ jobs:
6265
rust-version: nightly
6366
do-style-check: false
6467
rust-target: thumbv7em-none-eabihf
68+
features: unstable
6569

70+
### Style Checks + Doc #####################
6671
style_msrv:
6772
name: style (msrv)
6873
needs: build_msrv
@@ -89,3 +94,4 @@ jobs:
8994
rust-version: nightly
9095
do-style-check: true
9196
do-test: false
97+
features: unstable

multiboot2-header/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors = [
99
"Philipp Schuster <[email protected]>"
1010
]
1111
license = "MIT/Apache-2.0"
12-
edition = "2018"
12+
edition = "2021"
1313
categories = [
1414
"no-std",
1515
"parsing",

multiboot2-header/Changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG for crate `multiboot2-header`
22

3+
## Unreleased
4+
- MSRV is 1.56.1
5+
36
## v0.2.0 (2022-05-03)
47
- **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag`
58
- **BREAKING** some paths changed from `multiboot2_header::header` to `multiboot2_header::builder`

multiboot2-header/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You may need a special linker script to place this in a LOAD segment with a file
6868
See specification.
6969

7070
## MSRV
71-
The MSRV is 1.52.1 stable.
71+
The MSRV is 1.56.1 stable.
7272

7373
## License & Contribution
7474

multiboot2-header/src/builder/information_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct InformationRequestHeaderTagBuilder {
2121
#[cfg(feature = "builder")]
2222
impl InformationRequestHeaderTagBuilder {
2323
/// New builder.
24-
#[allow(clippy::missing_const_for_fn)] // TODO remove once MSRV is higher than 1.52.1
24+
#[allow(clippy::missing_const_for_fn)] // TODO remove once MSRV is higher than 1.65.0
2525
pub fn new(flag: HeaderTagFlag) -> Self {
2626
Self {
2727
irs: BTreeSet::new(),
@@ -31,7 +31,7 @@ impl InformationRequestHeaderTagBuilder {
3131

3232
/// Returns the expected length of the information request tag,
3333
/// when the `build`-method gets called.
34-
#[allow(clippy::missing_const_for_fn)] // TODO remove once MSRV is higher than 1.52.1
34+
#[allow(clippy::missing_const_for_fn)] // TODO remove once MSRV is higher than 1.65.0
3535
pub fn expected_len(&self) -> usize {
3636
let basic_header_size = size_of::<InformationRequestHeaderTag<0>>();
3737
let req_tags_size = self.irs.len() * size_of::<MbiTagType>();

multiboot2-header/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
//! ```
3232
//!
3333
//! ## MSRV
34-
//! The MSRV is 1.52.1 stable.
34+
//! The MSRV is 1.56.1 stable.
3535
3636
#![no_std]
3737
#![deny(rustdoc::all)]

multiboot2/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ authors = [
1414
"Philipp Schuster <[email protected]>"
1515
]
1616
license = "MIT/Apache-2.0"
17-
edition = "2018"
17+
edition = "2021"
1818
categories = [
1919
"no-std",
2020
"parsing",

multiboot2/Changelog.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# CHANGELOG for crate `multiboot2`
22

3+
## 0.15.0 (2023-03-XX)
4+
- MSRV is 1.56.1
5+
- **BREAKING** fixed lifetime issues: `VBEInfoTag` is no longer `&static`
6+
- **BREAKING:** `TagType` is now split into `TagTypeId` and `TagType`
7+
- `TagTypeId` is a binary-compatible form of a Multiboot2 tag id
8+
- `TagType` is a higher-level abstraction for either specified or custom tags
9+
but not ABI compatible.
10+
- fixed another internal lifetime issue
11+
- `BootInformation::framebuffer_tag()` now returns
12+
`Option<Result<FramebufferTag, UnknownFramebufferType>>` instead of
13+
`Option<FramebufferTag>` which prevents a possible panic. If the `--unstable`
14+
feature is used, `UnknownFramebufferType` implements `core::error::Error`.
15+
- Fixed misleading documentation of the `BootInformation::efi_memory_map_tag`
16+
- `BootInformation` now publicly exports the `get_tag` function allowing you to
17+
work with custom tags. An example is given in the function documentation.
18+
(check docs.rs). There is also a small unit test that you can use to learn
19+
from.
20+
- There exists a seamless integration between `u32`, `TagType`, and `TagTypeId`
21+
via `From` and `PartialEq`-implementations.
22+
323
## 0.14.2 (2023-03-17)
424
- documentation fixes
525
- `MbiLoadError` now implements `Display`

multiboot2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ other fields | variable
3131
All tags and the mbi itself are 8-byte aligned. The last tag must be the _end tag_, which is a tag of type `0` and size `8`.
3232

3333
## MSRV
34-
The MSRV is 1.52.1 stable.
34+
The MSRV is 1.56.1 stable.
3535

3636
## License & Contribution
3737

multiboot2/src/boot_loader_name.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::TagType;
1+
use crate::TagTypeId;
22
use core::str::Utf8Error;
33

44
/// This tag contains the name of the bootloader that is booting the kernel.
@@ -8,7 +8,7 @@ use core::str::Utf8Error;
88
#[derive(Clone, Copy, Debug)]
99
#[repr(C, packed)] // only repr(C) would add unwanted padding before first_section
1010
pub struct BootLoaderNameTag {
11-
typ: TagType,
11+
typ: TagTypeId,
1212
size: u32,
1313
/// Null-terminated UTF-8 string
1414
string: u8,
@@ -47,7 +47,7 @@ mod tests {
4747
// size is: 4 bytes for tag + 4 bytes for size + length of null-terminated string
4848
let size = (4 + 4 + MSG.as_bytes().len() + 1) as u32;
4949
[
50-
&((TagType::BootLoaderName as u32).to_ne_bytes()),
50+
&((TagType::BootLoaderName.val()).to_ne_bytes()),
5151
&size.to_ne_bytes(),
5252
MSG.as_bytes(),
5353
// Null Byte

multiboot2/src/command_line.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Module for [CommandLineTag].
22
3-
use crate::TagType;
3+
use crate::TagTypeId;
44
use core::mem;
55
use core::slice;
66
use core::str;
@@ -12,7 +12,7 @@ use core::str;
1212
#[derive(Clone, Copy, Debug)]
1313
#[repr(C, packed)] // only repr(C) would add unwanted padding before first_section
1414
pub struct CommandLineTag {
15-
typ: TagType,
15+
typ: TagTypeId,
1616
size: u32,
1717
/// Null-terminated UTF-8 string
1818
string: u8,
@@ -51,7 +51,7 @@ mod tests {
5151
// size is: 4 bytes for tag + 4 bytes for size + length of null-terminated string
5252
let size = (4 + 4 + MSG.as_bytes().len() + 1) as u32;
5353
[
54-
&((TagType::Cmdline as u32).to_ne_bytes()),
54+
&((TagType::Cmdline.val()).to_ne_bytes()),
5555
&size.to_ne_bytes(),
5656
MSG.as_bytes(),
5757
// Null Byte

multiboot2/src/efi.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! All MBI tags related to (U)EFI.
22
3-
use crate::TagType;
3+
use crate::TagTypeId;
44

55
/// EFI system table in 32 bit mode
66
#[derive(Clone, Copy, Debug)]
77
#[repr(C, packed)] // only repr(C) would add unwanted padding before first_section
88
pub struct EFISdt32 {
9-
typ: TagType,
9+
typ: TagTypeId,
1010
size: u32,
1111
pointer: u32,
1212
}
@@ -22,7 +22,7 @@ impl EFISdt32 {
2222
#[derive(Clone, Copy, Debug)]
2323
#[repr(C)]
2424
pub struct EFISdt64 {
25-
typ: TagType,
25+
typ: TagTypeId,
2626
size: u32,
2727
pointer: u64,
2828
}
@@ -38,7 +38,7 @@ impl EFISdt64 {
3838
#[derive(Debug)]
3939
#[repr(C)]
4040
pub struct EFIImageHandle32 {
41-
typ: TagType,
41+
typ: TagTypeId,
4242
size: u32,
4343
pointer: u32,
4444
}
@@ -54,7 +54,7 @@ impl EFIImageHandle32 {
5454
#[derive(Debug)]
5555
#[repr(C)]
5656
pub struct EFIImageHandle64 {
57-
typ: TagType,
57+
typ: TagTypeId,
5858
size: u32,
5959
pointer: u64,
6060
}

multiboot2/src/elf_sections.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use crate::tag_type::Tag;
2+
use crate::TagType;
23
use core::fmt::{Debug, Formatter};
34

45
/// This tag contains section header table from an ELF kernel.
@@ -11,7 +12,7 @@ pub struct ElfSectionsTag {
1112
}
1213

1314
pub unsafe fn elf_sections_tag(tag: &Tag, offset: usize) -> ElfSectionsTag {
14-
assert_eq!(9, tag.typ);
15+
assert_eq!(TagType::ElfSections.val(), tag.typ);
1516
let es = ElfSectionsTag {
1617
inner: (tag as *const Tag).offset(1) as *const ElfSectionsTagInner,
1718
offset,

0 commit comments

Comments
 (0)