Explorar o código

Merge pull request #213 from rust-osdev/dev

dev: misc improvements
Philipp Schuster hai 11 meses
pai
achega
1c693d175f

+ 0 - 0
integration-test/.envrc → .envrc


+ 4 - 4
.github/workflows/integrationtest.yml

@@ -9,7 +9,7 @@
 name: "Integration Test"
 name: "Integration Test"
 
 
 # Run on every push (tag, branch) and pull_request
 # Run on every push (tag, branch) and pull_request
-on: [pull_request, push, merge_group]
+on: [ pull_request, push, merge_group ]
 
 
 env:
 env:
   CARGO_TERM_COLOR: always
   CARGO_TERM_COLOR: always
@@ -27,7 +27,7 @@ jobs:
           # This channel is only required to invoke "nix-shell".
           # This channel is only required to invoke "nix-shell".
           # Everything inside that nix-shell will use a pinned version of
           # Everything inside that nix-shell will use a pinned version of
           # nixpkgs.
           # nixpkgs.
-          nix_path: nixpkgs=channel:nixos-23.05
+          nix_path: nixpkgs=channel:nixos-23.11
       - uses: DeterminateSystems/magic-nix-cache-action@main
       - uses: DeterminateSystems/magic-nix-cache-action@main
       - name: Set up cargo cache
       - name: Set up cargo cache
         uses: actions/cache@v4
         uses: actions/cache@v4
@@ -44,6 +44,6 @@ jobs:
           key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('integration-test/**/Cargo.toml', 'integration-test/**/Cargo.lock', 'integration-test/bins/rust-toolchain.toml') }}
           key: ${{ runner.os }}-${{ github.job }}-${{ hashFiles('integration-test/**/Cargo.toml', 'integration-test/**/Cargo.lock', 'integration-test/bins/rust-toolchain.toml') }}
       # Have all the "copying into Nix store" messages in a dedicated step for
       # Have all the "copying into Nix store" messages in a dedicated step for
       # better log visibility.
       # better log visibility.
-      - run: cd integration-test && nix-shell --run "echo OK" && cd ..
+      - run: nix-shell --run "echo OK"
       # Now, run the actual test.
       # Now, run the actual test.
-      - run: cd integration-test && nix-shell --run ./run.sh && cd ..
+      - run: nix-shell --run run-integrationtest

+ 4 - 4
.github/workflows/rust.yml

@@ -9,7 +9,7 @@
 name: "Cargo workspace"
 name: "Cargo workspace"
 
 
 # Run on every push (tag, branch) and pull_request
 # Run on every push (tag, branch) and pull_request
-on: [pull_request, push, workflow_dispatch, merge_group]
+on: [ pull_request, push, workflow_dispatch, merge_group ]
 
 
 env:
 env:
   CARGO_TERM_COLOR: always
   CARGO_TERM_COLOR: always
@@ -20,7 +20,7 @@ jobs:
     name: build (msrv)
     name: build (msrv)
     uses: ./.github/workflows/_build-rust.yml
     uses: ./.github/workflows/_build-rust.yml
     with:
     with:
-      rust-version: 1.69.0 # MSRV
+      rust-version: 1.70.0 # MSRV
       do-style-check: false
       do-style-check: false
       features: builder
       features: builder
 
 
@@ -46,7 +46,7 @@ jobs:
     needs: build_msrv
     needs: build_msrv
     uses: ./.github/workflows/_build-rust.yml
     uses: ./.github/workflows/_build-rust.yml
     with:
     with:
-      rust-version: 1.69.0 # MSRV
+      rust-version: 1.70.0 # MSRV
       do-style-check: false
       do-style-check: false
       rust-target: thumbv7em-none-eabihf
       rust-target: thumbv7em-none-eabihf
       features: builder
       features: builder
@@ -103,7 +103,7 @@ jobs:
     needs: build_msrv
     needs: build_msrv
     uses: ./.github/workflows/_build-rust.yml
     uses: ./.github/workflows/_build-rust.yml
     with:
     with:
-      rust-version: 1.69.0 # MSRV
+      rust-version: 1.70.0 # MSRV
       do-style-check: true
       do-style-check: true
       do-test: false
       do-test: false
       features: builder
       features: builder

+ 6 - 6
Cargo.lock

@@ -46,9 +46,9 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "proc-macro2"
 name = "proc-macro2"
-version = "1.0.79"
+version = "1.0.81"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e"
+checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
 dependencies = [
 dependencies = [
  "unicode-ident",
  "unicode-ident",
 ]
 ]
@@ -75,9 +75,9 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "quote"
 name = "quote"
-version = "1.0.35"
+version = "1.0.36"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
 dependencies = [
 dependencies = [
  "proc-macro2",
  "proc-macro2",
 ]
 ]
@@ -95,9 +95,9 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "uefi-raw"
 name = "uefi-raw"
-version = "0.3.0"
+version = "0.5.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62642516099c6441a5f41b0da8486d5fc3515a0603b0fdaea67b31600e22082e"
+checksum = "efa8716f52e8cab8bcedfd5052388a0f263b69fe5cc2561548dc6a530678333c"
 dependencies = [
 dependencies = [
  "bitflags",
  "bitflags",
  "ptr_meta",
  "ptr_meta",

+ 3 - 3
Cargo.toml

@@ -9,9 +9,9 @@ exclude = [
 ]
 ]
 
 
 [workspace.dependencies]
 [workspace.dependencies]
-bitflags = "2"
-derive_more = { version = "0.99", default-features = false, features = ["display"] }
-log = { version = "0.4", default-features = false }
+bitflags = "2.0.2"
+derive_more = { version = "~0.99", default-features = false, features = ["display"] }
+log = { version = "~0.4", default-features = false }
 
 
 # This way, the "multiboot2" dependency in the multiboot2-header crate can be
 # This way, the "multiboot2" dependency in the multiboot2-header crate can be
 # referenced by version, while still the repository version is used
 # referenced by version, while still the repository version is used

+ 49 - 25
integration-test/bins/Cargo.lock

@@ -4,15 +4,15 @@ version = 3
 
 
 [[package]]
 [[package]]
 name = "anyhow"
 name = "anyhow"
-version = "1.0.75"
+version = "1.0.82"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
+checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
 
 
 [[package]]
 [[package]]
 name = "autocfg"
 name = "autocfg"
-version = "1.1.0"
+version = "1.2.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
 
 
 [[package]]
 [[package]]
 name = "bit_field"
 name = "bit_field"
@@ -28,9 +28,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
 
 
 [[package]]
 [[package]]
 name = "bitflags"
 name = "bitflags"
-version = "2.4.1"
+version = "2.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
+checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
 
 
 [[package]]
 [[package]]
 name = "derive_more"
 name = "derive_more"
@@ -45,9 +45,9 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "either"
 name = "either"
-version = "1.9.0"
+version = "1.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
+checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2"
 
 
 [[package]]
 [[package]]
 name = "elf_rs"
 name = "elf_rs"
@@ -55,7 +55,7 @@ version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "894d710b6b07dae25ce69f9227ec2ffa3a3f71dc7f071acea3e1928ab4aeafdf"
 checksum = "894d710b6b07dae25ce69f9227ec2ffa3a3f71dc7f071acea3e1928ab4aeafdf"
 dependencies = [
 dependencies = [
- "bitflags 2.4.1",
+ "bitflags 2.5.0",
  "num-traits",
  "num-traits",
 ]
 ]
 
 
@@ -71,9 +71,9 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "lock_api"
 name = "lock_api"
-version = "0.4.11"
+version = "0.4.12"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
+checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
 dependencies = [
 dependencies = [
  "autocfg",
  "autocfg",
  "scopeguard",
  "scopeguard",
@@ -81,9 +81,9 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "log"
 name = "log"
-version = "0.4.20"
+version = "0.4.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
 
 
 [[package]]
 [[package]]
 name = "multiboot"
 name = "multiboot"
@@ -98,11 +98,24 @@ dependencies = [
 name = "multiboot2"
 name = "multiboot2"
 version = "0.19.0"
 version = "0.19.0"
 dependencies = [
 dependencies = [
- "bitflags 2.4.1",
+ "bitflags 2.5.0",
  "derive_more",
  "derive_more",
  "log",
  "log",
  "ptr_meta",
  "ptr_meta",
- "uefi-raw",
+ "uefi-raw 0.5.2",
+]
+
+[[package]]
+name = "multiboot2"
+version = "0.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "be7a13d71fc2f7747af3ce60e5eccb638acd687b3a580d0bd579c6d0f7b9d010"
+dependencies = [
+ "bitflags 2.5.0",
+ "derive_more",
+ "log",
+ "ptr_meta",
+ "uefi-raw 0.3.0",
 ]
 ]
 
 
 [[package]]
 [[package]]
@@ -110,7 +123,7 @@ name = "multiboot2-header"
 version = "0.3.2"
 version = "0.3.2"
 dependencies = [
 dependencies = [
  "derive_more",
  "derive_more",
- "multiboot2",
+ "multiboot2 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 ]
 
 
 [[package]]
 [[package]]
@@ -122,7 +135,7 @@ dependencies = [
  "good_memory_allocator",
  "good_memory_allocator",
  "log",
  "log",
  "multiboot",
  "multiboot",
- "multiboot2",
+ "multiboot2 0.19.0",
  "multiboot2-header",
  "multiboot2-header",
  "util",
  "util",
 ]
 ]
@@ -134,16 +147,16 @@ dependencies = [
  "anyhow",
  "anyhow",
  "good_memory_allocator",
  "good_memory_allocator",
  "log",
  "log",
- "multiboot2",
+ "multiboot2 0.19.0",
  "util",
  "util",
  "x86",
  "x86",
 ]
 ]
 
 
 [[package]]
 [[package]]
 name = "num-traits"
 name = "num-traits"
-version = "0.2.17"
+version = "0.2.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
+checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
 dependencies = [
 dependencies = [
  "autocfg",
  "autocfg",
 ]
 ]
@@ -156,9 +169,9 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
 
 
 [[package]]
 [[package]]
 name = "proc-macro2"
 name = "proc-macro2"
-version = "1.0.70"
+version = "1.0.81"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
+checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba"
 dependencies = [
 dependencies = [
  "unicode-ident",
  "unicode-ident",
 ]
 ]
@@ -191,9 +204,9 @@ checksum = "8bb0fd6580eeed0103c054e3fba2c2618ff476943762f28a645b63b8692b21c9"
 
 
 [[package]]
 [[package]]
 name = "quote"
 name = "quote"
-version = "1.0.33"
+version = "1.0.36"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
+checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
 dependencies = [
 dependencies = [
  "proc-macro2",
  "proc-macro2",
 ]
 ]
@@ -239,7 +252,18 @@ version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "62642516099c6441a5f41b0da8486d5fc3515a0603b0fdaea67b31600e22082e"
 checksum = "62642516099c6441a5f41b0da8486d5fc3515a0603b0fdaea67b31600e22082e"
 dependencies = [
 dependencies = [
- "bitflags 2.4.1",
+ "bitflags 2.5.0",
+ "ptr_meta",
+ "uguid",
+]
+
+[[package]]
+name = "uefi-raw"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "efa8716f52e8cab8bcedfd5052388a0f263b69fe5cc2561548dc6a530678333c"
+dependencies = [
+ "bitflags 2.5.0",
  "ptr_meta",
  "ptr_meta",
  "uguid",
  "uguid",
 ]
 ]

+ 8 - 2
integration-test/bins/Cargo.toml

@@ -10,5 +10,11 @@ members = [
 codegen-units = 1
 codegen-units = 1
 lto = true
 lto = true
 
 
-[patch.crates-io]
-multiboot2 = { path = "../../multiboot2" }
+
+[workspace.dependencies]
+anyhow = { version = "1.0", default-features = false }
+log = { version = "0.4", default-features = false }
+multiboot2 = { path = "../../multiboot2", features = ["builder", "unstable"] }
+multiboot2-header = { path = "../../multiboot2-header", features = ["builder", "unstable"] }
+good_memory_allocator = "0.1"
+util = { path = "./util" }

+ 8 - 8
integration-test/bins/multiboot2_chainloader/Cargo.toml

@@ -1,16 +1,16 @@
 [package]
 [package]
 name = "multiboot2_chainloader"
 name = "multiboot2_chainloader"
-description = "Multiboot chainloader that loads a Multiboot2 payload"
+description = "Integrationtest: Multiboot2 chainloader"
 version = "0.1.0"
 version = "0.1.0"
 edition = "2021"
 edition = "2021"
 publish = false
 publish = false
 
 
 [dependencies]
 [dependencies]
-util = { path = "../util" }
-multiboot2 = { path = "../../../multiboot2" }
-multiboot2-header = { path = "../../../multiboot2-header" }
-anyhow = { version = "1.0", default-features = false }
-elf_rs = "0.3"
-log = { version = "0.4", default-features = false }
-good_memory_allocator = "0.1"
+anyhow.workspace = true
+log.workspace = true
+good_memory_allocator.workspace = true
 multiboot = "0.8"
 multiboot = "0.8"
+multiboot2.workspace = true
+multiboot2-header.workspace = true
+util.workspace = true
+elf_rs = "0.3"

+ 8 - 2
integration-test/bins/multiboot2_chainloader/src/loader.rs

@@ -1,7 +1,8 @@
+use core::ops::Deref;
 use elf_rs::{ElfFile, ProgramHeaderEntry, ProgramType};
 use elf_rs::{ElfFile, ProgramHeaderEntry, ProgramType};
 use multiboot2::{
 use multiboot2::{
-    BootLoaderNameTag, CommandLineTag, MemoryArea, MemoryAreaType, MemoryMapTag,
-    ModuleTag,
+    BootLoaderNameTag, CommandLineTag, MemoryArea, MemoryAreaType, MemoryMapTag, ModuleTag,
+    SmbiosTag,
 };
 };
 
 
 /// Loads the first module into memory. Assumes that the module is a ELF file.
 /// Loads the first module into memory. Assumes that the module is a ELF file.
@@ -56,6 +57,11 @@ pub fn load_module(mut modules: multiboot::information::ModuleIter) -> ! {
             elf_mod.end as u32,
             elf_mod.end as u32,
             elf_mod.string.unwrap(),
             elf_mod.string.unwrap(),
         ))
         ))
+        // Test that we can add SmbiosTag multiple times.
+        .add_tag(SmbiosTag::new(1, 1, &[1, 2, 3]).deref())
+        .unwrap()
+        .add_tag(SmbiosTag::new(1, 2, &[1, 2, 3]).deref())
+        .expect("should allow tag multiple times")
         .build();
         .build();
 
 
     log::info!(
     log::info!(

+ 6 - 6
integration-test/bins/multiboot2_payload/Cargo.toml

@@ -1,14 +1,14 @@
 [package]
 [package]
 name = "multiboot2_payload"
 name = "multiboot2_payload"
-description = "Multiboot2 integration test"
+description = "Integrationtest: Multiboot2 payload"
 version = "0.1.0"
 version = "0.1.0"
 edition = "2021"
 edition = "2021"
 publish = false
 publish = false
 
 
 [dependencies]
 [dependencies]
-multiboot2 = { path = "../../../multiboot2", features = ["builder", "unstable"] }
-util = { path = "../util" }
-anyhow = { version = "1.0", default-features = false }
-good_memory_allocator = "0.1"
-log = { version = "0.4", default-features = false }
+anyhow.workspace = true
+log.workspace = true
+good_memory_allocator.workspace = true
+multiboot2.workspace = true
+util.workspace = true
 x86 = "0.52"
 x86 = "0.52"

+ 1 - 1
integration-test/bins/rust-toolchain.toml

@@ -1,5 +1,5 @@
 [toolchain]
 [toolchain]
-channel = "nightly-2024-03-31" # rustc 1.79-nightly
+channel = "nightly-2024-04-30" # rustc 1.80-nightly
 profile = "default"
 profile = "default"
 components = [
 components = [
     "rust-src",
     "rust-src",

+ 2 - 1
integration-test/run.sh

@@ -15,7 +15,8 @@ function fn_main() {
 
 
 function fn_build_rust_bins() {
 function fn_build_rust_bins() {
     cd "bins"
     cd "bins"
-    cargo build --release
+    cargo --version
+    cargo build --release --verbose
     cd "$DIR"
     cd "$DIR"
 }
 }
 
 

+ 1 - 7
multiboot2-header/Cargo.toml

@@ -26,7 +26,7 @@ readme = "README.md"
 homepage = "https://github.com/rust-osdev/multiboot2-header"
 homepage = "https://github.com/rust-osdev/multiboot2-header"
 repository = "https://github.com/rust-osdev/multiboot2"
 repository = "https://github.com/rust-osdev/multiboot2"
 documentation = "https://docs.rs/multiboot2-header"
 documentation = "https://docs.rs/multiboot2-header"
-rust-version = "1.69"
+rust-version = "1.70"
 
 
 [[example]]
 [[example]]
 name = "minimal"
 name = "minimal"
@@ -40,13 +40,7 @@ builder = ["alloc"]
 unstable = []
 unstable = []
 
 
 [dependencies]
 [dependencies]
-# Not yet used.
-# bitflags.workspace = true
 derive_more.workspace = true
 derive_more.workspace = true
-# Not yet used.
-# log.workspace = true
-
-# Used for MBI tags.
 multiboot2 = { version = "0.19.0", default-features = false }
 multiboot2 = { version = "0.19.0", default-features = false }
 
 
 [package.metadata.docs.rs]
 [package.metadata.docs.rs]

+ 2 - 1
multiboot2-header/Changelog.md

@@ -3,7 +3,8 @@
 ## Unreleased
 ## Unreleased
 
 
 - added `EndHeaderTag::default()`
 - added `EndHeaderTag::default()`
-- MSRV is 1.69
+- MSRV is 1.70
+- Can add multiple `TagType::Smbios` tags in the builder.
 
 
 ## 0.3.2 (2023-11-30)
 ## 0.3.2 (2023-11-30)
 
 

+ 9 - 3
multiboot2-header/README.md

@@ -1,4 +1,5 @@
 # multiboot2-header
 # multiboot2-header
+
 ![Build](https://github.com/rust-osdev/multiboot2/actions/workflows/rust.yml/badge.svg)
 ![Build](https://github.com/rust-osdev/multiboot2/actions/workflows/rust.yml/badge.svg)
 [![crates.io](https://img.shields.io/crates/v/multiboot2-header.svg)](https://crates.io/crates/multiboot2-header)
 [![crates.io](https://img.shields.io/crates/v/multiboot2-header.svg)](https://crates.io/crates/multiboot2-header)
 [![docs](https://docs.rs/multiboot2-header/badge.svg)](https://docs.rs/multiboot2-header/)
 [![docs](https://docs.rs/multiboot2-header/badge.svg)](https://docs.rs/multiboot2-header/)
@@ -8,6 +9,7 @@ as well as a builder to build them at runtime. This library is `no_std` and can
 be used in bootloaders.
 be used in bootloaders.
 
 
 What this library is good for:
 What this library is good for:
+
 - construct a Multiboot2 header at runtime (constructing one at build-time with
 - construct a Multiboot2 header at runtime (constructing one at build-time with
   macros is not done yet, contributions are welcome!)
   macros is not done yet, contributions are welcome!)
 - write a Multiboot2-bootloader that parses a Multiboot2-header
 - write a Multiboot2-bootloader that parses a Multiboot2-header
@@ -60,20 +62,24 @@ fn main() {
 
 
 ## Example 2: Multiboot2 header as static data in Rust file
 ## 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:
+You can use the builder, construct a Multiboot2 header, write it to a file and
+include it like this:
+
 ```
 ```
 #[used]
 #[used]
 #[no_mangle]
 #[no_mangle]
 #[link_section = ".text.multiboot2_header"]
 #[link_section = ".text.multiboot2_header"]
 static MULTIBOOT2_HDR: [u8; 64] = *include_bytes!("mb2_hdr_dump.bin");
 static MULTIBOOT2_HDR: [u8; 64] = *include_bytes!("mb2_hdr_dump.bin");
 ```
 ```
+
 You may need a special linker script to place this symbol in the first 32768
 You may need a special linker script to place this symbol in the first 32768
 bytes of the ELF. See Multiboot2 specification.
 bytes of the ELF. See Multiboot2 specification.
 
 
 ## MSRV
 ## MSRV
 
 
-The MSRV is 1.69.0 stable.
+The MSRV is 1.70.0 stable.
 
 
 ## License & Contribution
 ## License & Contribution
 
 
-See main [README](https://github.com/rust-osdev/multiboot2/blob/main/README.md) file.
+See main [README](https://github.com/rust-osdev/multiboot2/blob/main/README.md)
+file.

+ 1 - 1
multiboot2-header/src/lib.rs

@@ -34,7 +34,7 @@
 //!
 //!
 //! ## MSRV
 //! ## MSRV
 //!
 //!
-//! The MSRV is 1.69.0 stable.
+//! The MSRV is 1.70.0 stable.
 
 
 #![no_std]
 #![no_std]
 #![cfg_attr(feature = "unstable", feature(error_in_core))]
 #![cfg_attr(feature = "unstable", feature(error_in_core))]

+ 3 - 3
multiboot2/Cargo.toml

@@ -31,7 +31,7 @@ readme = "README.md"
 homepage = "https://github.com/rust-osdev/multiboot2"
 homepage = "https://github.com/rust-osdev/multiboot2"
 repository = "https://github.com/rust-osdev/multiboot2"
 repository = "https://github.com/rust-osdev/multiboot2"
 documentation = "https://docs.rs/multiboot2"
 documentation = "https://docs.rs/multiboot2"
-rust-version = "1.69"
+rust-version = "1.70"
 
 
 [features]
 [features]
 default = ["builder"]
 default = ["builder"]
@@ -49,8 +49,8 @@ log.workspace = true
 # bumps from uefi-raw, I restrict this here. Upstream users are likely to have
 # bumps from uefi-raw, I restrict this here. Upstream users are likely to have
 # two versions of this library in it, which is no problem, as we only use the
 # two versions of this library in it, which is no problem, as we only use the
 # type definition.
 # type definition.
-uefi-raw = { version = "=0.3", default-features = false }
-ptr_meta = { version = "0.2", default-features = false }
+uefi-raw = { version = "~0.5", default-features = false }
+ptr_meta = { version = "~0.2", default-features = false }
 
 
 [package.metadata.docs.rs]
 [package.metadata.docs.rs]
 all-features = true
 all-features = true

+ 1 - 1
multiboot2/Changelog.md

@@ -3,7 +3,7 @@
 ## Unreleased
 ## Unreleased
 
 
 - added `InformationBuilder::default()`
 - added `InformationBuilder::default()`
-- MSRV is 1.69
+- MSRV is 1.70
 
 
 ## 0.19.0 (2023-09-21)
 ## 0.19.0 (2023-09-21)
 
 

+ 23 - 15
multiboot2/README.md

@@ -1,4 +1,5 @@
 # multiboot2
 # multiboot2
+
 ![Build](https://github.com/rust-osdev/multiboot2/actions/workflows/rust.yml/badge.svg)
 ![Build](https://github.com/rust-osdev/multiboot2/actions/workflows/rust.yml/badge.svg)
 [![crates.io](https://img.shields.io/crates/v/multiboot2.svg)](https://crates.io/crates/multiboot2)
 [![crates.io](https://img.shields.io/crates/v/multiboot2.svg)](https://crates.io/crates/multiboot2)
 [![docs](https://docs.rs/multiboot2/badge.svg)](https://docs.rs/multiboot2/)
 [![docs](https://docs.rs/multiboot2/badge.svg)](https://docs.rs/multiboot2/)
@@ -8,9 +9,12 @@ Multiboot2-compliant bootloaders, such as GRUB. It supports all tags from the
 specification including full support for the sections of ELF files. This library
 specification including full support for the sections of ELF files. This library
 is `no_std` and can be used in a Multiboot2-kernel.
 is `no_std` and can be used in a Multiboot2-kernel.
 
 
-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.
+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.
 
 
 ## Features and `no_std` Compatibility
 ## Features and `no_std` Compatibility
+
 This library is always `no_std` without `alloc`. However, the default `builder`-
 This library is always `no_std` without `alloc`. However, the default `builder`-
 feature requires the `alloc`-crate and an `#[global_allocator]` to be available.
 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
 You need the `builder` only if you want to construct new boot information
@@ -18,28 +22,32 @@ structures at runtime. For parsing, this is not relevant, and you can
 deactivate the default feature.
 deactivate the default feature.
 
 
 ## Background: The Multiboot 2 Information Structure
 ## Background: The Multiboot 2 Information Structure
+
 The Multiboot information structure looks like this:
 The Multiboot information structure looks like this:
 
 
-Field            | Type
----------------- | -----------
-total size       | u32
-reserved         | u32
-tags             | variable
-end tag = (0, 8) | (u32, u32)
+ 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:
 There are many different types of tags, but they all have the same beginning:
 
 
-Field         | Type
-------------- | -----------------
-type          | u32
-size          | u32
-other fields  | variable
+ Field        | Type
+--------------|----------
+ type         | u32
+ size         | u32
+ other fields | variable
 
 
-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`.
+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`.
 
 
 ## MSRV
 ## MSRV
-The MSRV is 1.69.0 stable.
+
+The MSRV is 1.70.0 stable.
 
 
 ## License & Contribution
 ## License & Contribution
 
 
-See main [README](https://github.com/rust-osdev/multiboot2/blob/main/README.md) file.
+See main [README](https://github.com/rust-osdev/multiboot2/blob/main/README.md)
+file.

+ 13 - 1
multiboot2/src/builder/boxed_dst.rs

@@ -12,7 +12,7 @@ use core::ptr::NonNull;
 /// builder. This is tricky in Rust. This type behaves similar to the regular
 /// builder. This is tricky in Rust. This type behaves similar to the regular
 /// `Box` type except that it ensure the same layout is used for the (explicit)
 /// `Box` type except that it ensure the same layout is used for the (explicit)
 /// allocation and the (implicit) deallocation of memory. Otherwise, I didn't
 /// allocation and the (implicit) deallocation of memory. Otherwise, I didn't
-/// found any way to figure out the right layout for a DST. Miri always reported
+/// find any way to figure out the right layout for a DST. Miri always reported
 /// issues that the deallocation used a wrong layout.
 /// issues that the deallocation used a wrong layout.
 ///
 ///
 /// Technically, I'm certain this code is memory safe. But with this type, I
 /// Technically, I'm certain this code is memory safe. But with this type, I
@@ -141,4 +141,16 @@ mod tests {
         assert_eq!(tag.size as usize, METADATA_SIZE + content.len());
         assert_eq!(tag.size as usize, METADATA_SIZE + content.len());
         assert_eq!(tag.string(), Ok(content_rust_str));
         assert_eq!(tag.string(), Ok(content_rust_str));
     }
     }
+
+    #[test]
+    fn can_hold_tag_trait() {
+        fn consume<T: TagTrait + ?Sized>(_: &T) {}
+        let content = b"hallo\0";
+
+        let tag = BoxedDst::<CustomTag>::new(content);
+        consume(tag.deref());
+        consume(&*tag);
+        // Compiler not smart enough?
+        // consume(&tag);
+    }
 }
 }

+ 1 - 1
multiboot2/src/builder/mod.rs

@@ -3,7 +3,7 @@
 mod boxed_dst;
 mod boxed_dst;
 mod information;
 mod information;
 
 
-// This must by public to support external people to create boxed DSTs.
+// This must be public to support external people to create boxed DSTs.
 pub use boxed_dst::BoxedDst;
 pub use boxed_dst::BoxedDst;
 pub use information::InformationBuilder;
 pub use information::InformationBuilder;
 
 

+ 1 - 1
multiboot2/src/lib.rs

@@ -33,7 +33,7 @@
 //! ```
 //! ```
 //!
 //!
 //! ## MSRV
 //! ## MSRV
-//! The MSRV is 1.69.0 stable.
+//! The MSRV is 1.70.0 stable.
 
 
 #[cfg(feature = "builder")]
 #[cfg(feature = "builder")]
 extern crate alloc;
 extern crate alloc;

+ 1 - 1
multiboot2/src/tag_trait.rs

@@ -5,7 +5,7 @@ use ptr_meta::Pointee;
 
 
 /// A trait to abstract over all sized and unsized tags (DSTs). For sized tags,
 /// A trait to abstract over all sized and unsized tags (DSTs). For sized tags,
 /// this trait does not much. For DSTs, a [`TagTrait::dst_size`] implementation
 /// this trait does not much. For DSTs, a [`TagTrait::dst_size`] implementation
-/// must me provided, which returns the right size hint for the dynamically
+/// must be provided, which returns the right size hint for the dynamically
 /// sized portion of the struct.
 /// sized portion of the struct.
 ///
 ///
 /// # Trivia
 /// # Trivia

+ 3 - 3
integration-test/nix/sources.json → nix/sources.json

@@ -5,10 +5,10 @@
         "homepage": null,
         "homepage": null,
         "owner": "NixOS",
         "owner": "NixOS",
         "repo": "nixpkgs",
         "repo": "nixpkgs",
-        "rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
-        "sha256": "065jy7qivlbdqmbvd7r9h97b23f21axmc4r7sqmq2h0j82rmymxv",
+        "rev": "576ecd43d3b864966b4423a853412d6177775e8b",
+        "sha256": "05gr8w09w7fqfi6zflx7df1n0hhsf8f4p9siikk3wb7k7by2d9sr",
         "type": "tarball",
         "type": "tarball",
-        "url": "https://github.com/NixOS/nixpkgs/archive/219951b495fc2eac67b1456824cc1ec1fd2ee659.tar.gz",
+        "url": "https://github.com/NixOS/nixpkgs/archive/576ecd43d3b864966b4423a853412d6177775e8b.tar.gz",
         "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
         "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
     }
     }
 }
 }

+ 0 - 0
integration-test/nix/sources.nix → nix/sources.nix


+ 11 - 2
integration-test/shell.nix → shell.nix

@@ -3,11 +3,20 @@ let
   pkgs = import sources.nixpkgs {};
   pkgs = import sources.nixpkgs {};
 in
 in
 pkgs.mkShell rec {
 pkgs.mkShell rec {
-  nativeBuildInputs = with pkgs; [
+  packages = with pkgs; [
+    # general
+    rustup
+    nixpkgs-fmt
+    niv
+
+    # integration test
     grub2
     grub2
     qemu
     qemu
-    rustup
     xorriso
     xorriso
+
+    (pkgs.writeShellScriptBin "run-integrationtest" ''
+    ./integration-test/run.sh
+    '')
   ];
   ];
 
 
   # To invoke "nix-shell" in the CI-runner, we need a global Nix channel.
   # To invoke "nix-shell" in the CI-runner, we need a global Nix channel.