diff --git a/integration-test/.envrc b/.envrc similarity index 100% rename from integration-test/.envrc rename to .envrc diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cf002a05..b1f8bfa2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,7 +3,7 @@ updates: - package-ecosystem: cargo directory: "/" schedule: - interval: daily + interval: weekly open-pull-requests-limit: 10 ignore: - dependency-name: "*" @@ -11,7 +11,7 @@ updates: - package-ecosystem: cargo directory: "/integration-test/bins" schedule: - interval: daily + interval: weekly open-pull-requests-limit: 10 ignore: - dependency-name: "*" @@ -19,5 +19,5 @@ updates: - package-ecosystem: github-actions directory: "/" schedule: - interval: daily + interval: monthly open-pull-requests-limit: 10 diff --git a/.github/workflows/_build-rust.yml b/.github/workflows/_build-rust.yml index a00fc730..2c834c64 100644 --- a/.github/workflows/_build-rust.yml +++ b/.github/workflows/_build-rust.yml @@ -69,7 +69,7 @@ jobs: targets: ${{ inputs.rust-target }} components: clippy, rustfmt - name: Set up cargo cache - uses: actions/cache@v3 + uses: actions/cache@v4 continue-on-error: false with: path: | diff --git a/.github/workflows/integrationtest.yml b/.github/workflows/integrationtest.yml index 6343bea8..13de84fd 100644 --- a/.github/workflows/integrationtest.yml +++ b/.github/workflows/integrationtest.yml @@ -9,7 +9,7 @@ name: "Integration Test" # Run on every push (tag, branch) and pull_request -on: [pull_request, push, merge_group] +on: [ pull_request, push, merge_group ] env: CARGO_TERM_COLOR: always @@ -22,15 +22,15 @@ jobs: steps: - name: Check out uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v23 + - uses: cachix/install-nix-action@v26 with: # This channel is only required to invoke "nix-shell". # Everything inside that nix-shell will use a pinned version of # nixpkgs. - nix_path: nixpkgs=channel:nixos-23.05 + nix_path: nixpkgs=channel:nixos-23.11 - uses: DeterminateSystems/magic-nix-cache-action@main - name: Set up cargo cache - uses: actions/cache@v3 + uses: actions/cache@v4 continue-on-error: false with: path: | @@ -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') }} # Have all the "copying into Nix store" messages in a dedicated step for # better log visibility. - - run: cd integration-test && nix-shell --run "echo OK" && cd .. + - run: nix-shell --run "echo OK" # Now, run the actual test. - - run: cd integration-test && nix-shell --run ./run.sh && cd .. + - run: nix-shell --run run-integrationtest diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index a1a3a741..02fb711c 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -9,4 +9,4 @@ jobs: steps: - uses: actions/checkout@v4 # Executes "typos ." - - uses: crate-ci/typos@v1.16.12 + - uses: crate-ci/typos@v1.21.0 diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 22afdc1f..6c9eb137 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -9,7 +9,7 @@ name: "Cargo workspace" # 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: CARGO_TERM_COLOR: always @@ -20,7 +20,7 @@ jobs: name: build (msrv) uses: ./.github/workflows/_build-rust.yml with: - rust-version: 1.69.0 # MSRV + rust-version: 1.70.0 # MSRV do-style-check: false features: builder @@ -46,7 +46,7 @@ jobs: needs: build_msrv uses: ./.github/workflows/_build-rust.yml with: - rust-version: 1.69.0 # MSRV + rust-version: 1.70.0 # MSRV do-style-check: false rust-target: thumbv7em-none-eabihf features: builder @@ -103,7 +103,7 @@ jobs: needs: build_msrv uses: ./.github/workflows/_build-rust.yml with: - rust-version: 1.69.0 # MSRV + rust-version: 1.70.0 # MSRV do-style-check: true do-test: false features: builder diff --git a/Cargo.lock b/Cargo.lock index d9d54e11..6d96a4d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "bitflags" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "derive_more" @@ -21,47 +21,47 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "multiboot2" -version = "0.16.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b624a7b3f704734d98d21455b617607eb7043d4509d1c34bf9e7ff7dd47b31a" +checksum = "be7a13d71fc2f7747af3ce60e5eccb638acd687b3a580d0bd579c6d0f7b9d010" dependencies = [ "bitflags", "derive_more", "log", "ptr_meta", - "uefi-raw", + "uefi-raw 0.3.0", ] [[package]] name = "multiboot2" -version = "0.19.0" +version = "0.20.0" dependencies = [ "bitflags", "derive_more", "log", "ptr_meta", - "uefi-raw", + "uefi-raw 0.5.2", ] [[package]] name = "multiboot2-header" -version = "0.3.1" +version = "0.3.2" dependencies = [ "derive_more", - "multiboot2 0.16.0", + "multiboot2 0.19.0", ] [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -88,9 +88,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -117,11 +117,22 @@ dependencies = [ "uguid", ] +[[package]] +name = "uefi-raw" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efa8716f52e8cab8bcedfd5052388a0f263b69fe5cc2561548dc6a530678333c" +dependencies = [ + "bitflags", + "ptr_meta", + "uguid", +] + [[package]] name = "uguid" -version = "2.0.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16dfbd255defbd727b3a30e8950695d2e6d045841ee250ff0f1f7ced17917f8d" +checksum = "ab14ea9660d240e7865ce9d54ecdbd1cd9fa5802ae6f4512f093c7907e921533" [[package]] name = "unicode-ident" diff --git a/Cargo.toml b/Cargo.toml index 3b6f2682..f4e5b0ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,9 +9,9 @@ exclude = [ ] [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 # referenced by version, while still the repository version is used diff --git a/integration-test/bins/Cargo.lock b/integration-test/bins/Cargo.lock index ff272cbd..e55bdca7 100644 --- a/integration-test/bins/Cargo.lock +++ b/integration-test/bins/Cargo.lock @@ -4,15 +4,15 @@ version = 3 [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "bit_field" @@ -28,9 +28,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "derive_more" @@ -45,17 +45,17 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" [[package]] name = "elf_rs" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf723f70efb0373c0b2501d943cf20ac1adbbd8e7c8eef926b2be545e5a33e8" +checksum = "894d710b6b07dae25ce69f9227ec2ffa3a3f71dc7f071acea3e1928ab4aeafdf" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", "num-traits", ] @@ -71,9 +71,9 @@ dependencies = [ [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -81,9 +81,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "multiboot" @@ -96,34 +96,34 @@ dependencies = [ [[package]] name = "multiboot2" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b624a7b3f704734d98d21455b617607eb7043d4509d1c34bf9e7ff7dd47b31a" +version = "0.19.0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.5.0", "derive_more", "log", "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.4.0", + "bitflags 2.5.0", "derive_more", "log", "ptr_meta", - "uefi-raw", + "uefi-raw 0.3.0", ] [[package]] name = "multiboot2-header" -version = "0.3.1" +version = "0.3.2" dependencies = [ "derive_more", - "multiboot2 0.16.0", + "multiboot2 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -154,9 +154,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -169,9 +169,9 @@ checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "proc-macro2" -version = "1.0.67" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d433d9f1a3e8c1263d9456598b16fec66f4acc9a74dacffd35c7bb09b3a1328" +checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" dependencies = [ "unicode-ident", ] @@ -204,9 +204,9 @@ checksum = "8bb0fd6580eeed0103c054e3fba2c2618ff476943762f28a645b63b8692b21c9" [[package]] name = "quote" -version = "1.0.33" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -252,16 +252,27 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62642516099c6441a5f41b0da8486d5fc3515a0603b0fdaea67b31600e22082e" dependencies = [ - "bitflags 2.4.0", + "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", "uguid", ] [[package]] name = "uguid" -version = "2.0.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16dfbd255defbd727b3a30e8950695d2e6d045841ee250ff0f1f7ced17917f8d" +checksum = "ab14ea9660d240e7865ce9d54ecdbd1cd9fa5802ae6f4512f093c7907e921533" [[package]] name = "unicode-ident" diff --git a/integration-test/bins/Cargo.toml b/integration-test/bins/Cargo.toml index 9c58b106..ddd6e60e 100644 --- a/integration-test/bins/Cargo.toml +++ b/integration-test/bins/Cargo.toml @@ -10,5 +10,11 @@ members = [ codegen-units = 1 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" } diff --git a/integration-test/bins/multiboot2_chainloader/Cargo.toml b/integration-test/bins/multiboot2_chainloader/Cargo.toml index dd5f2205..e3089f53 100644 --- a/integration-test/bins/multiboot2_chainloader/Cargo.toml +++ b/integration-test/bins/multiboot2_chainloader/Cargo.toml @@ -1,16 +1,16 @@ [package] name = "multiboot2_chainloader" -description = "Multiboot chainloader that loads a Multiboot2 payload" +description = "Integrationtest: Multiboot2 chainloader" version = "0.1.0" edition = "2021" publish = false [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" +multiboot2.workspace = true +multiboot2-header.workspace = true +util.workspace = true +elf_rs = "0.3" diff --git a/integration-test/bins/multiboot2_chainloader/src/loader.rs b/integration-test/bins/multiboot2_chainloader/src/loader.rs index fa613b85..896cf2af 100644 --- a/integration-test/bins/multiboot2_chainloader/src/loader.rs +++ b/integration-test/bins/multiboot2_chainloader/src/loader.rs @@ -1,7 +1,8 @@ +use core::ops::Deref; use elf_rs::{ElfFile, ProgramHeaderEntry, ProgramType}; 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. @@ -56,6 +57,11 @@ pub fn load_module(mut modules: multiboot::information::ModuleIter) -> ! { elf_mod.end as u32, 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(); log::info!( diff --git a/integration-test/bins/multiboot2_chainloader/src/multiboot.rs b/integration-test/bins/multiboot2_chainloader/src/multiboot.rs index 31aa0052..0a0bd5f6 100644 --- a/integration-test/bins/multiboot2_chainloader/src/multiboot.rs +++ b/integration-test/bins/multiboot2_chainloader/src/multiboot.rs @@ -1,9 +1,8 @@ //! Parsing the Multiboot information. Glue code for the [`multiboot`] code. use anyhow::anyhow; +use core::ptr::addr_of_mut; use core::slice; -pub use multiboot::information::ModuleIter; -pub use multiboot::information::Multiboot as Mbi; use multiboot::information::{MemoryManagement, Multiboot, PAddr, SIGNATURE_EAX}; static mut MEMORY_MANAGEMENT: Mem = Mem; @@ -14,7 +13,8 @@ pub fn get_mbi<'a>(magic: u32, ptr: u32) -> anyhow::Result anyhow::Result<()> { .map_err(anyhow::Error::msg)? .cmdline() .map_err(anyhow::Error::msg)?; - assert_eq!(bootloader_name, "GRUB 2.06"); + assert!(bootloader_name.starts_with("GRUB 2.")); assert_eq!(cmdline, "some commandline arguments"); Ok(()) diff --git a/integration-test/bins/rust-toolchain.toml b/integration-test/bins/rust-toolchain.toml index 0aa1490d..4349337f 100644 --- a/integration-test/bins/rust-toolchain.toml +++ b/integration-test/bins/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "nightly-2023-06-22" +channel = "nightly-2024-04-30" # rustc 1.80-nightly profile = "default" components = [ "rust-src", diff --git a/integration-test/bins/x86-unknown-none.json b/integration-test/bins/x86-unknown-none.json index 3e5359f6..7b294d42 100644 --- a/integration-test/bins/x86-unknown-none.json +++ b/integration-test/bins/x86-unknown-none.json @@ -1,6 +1,6 @@ { "llvm-target": "i686-unknown-none", - "data-layout": "e-m:e-i32:32-f80:128-n8:16:32-S128-p:32:32", + "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128", "arch": "x86", "target-endian": "little", "target-pointer-width": "32", diff --git a/integration-test/nix/sources.json b/integration-test/nix/sources.json deleted file mode 100644 index f5049a96..00000000 --- a/integration-test/nix/sources.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "nixpkgs": { - "branch": "nixos-23.05", - "description": "Nix Packages collection", - "homepage": null, - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "ad157fe26e74211e7dde0456cb3fd9ab78b6e552", - "sha256": "0l5gimzlbzq1svw48p4h3wf24ry21icl9198jk5x4xqvs6k2gffx", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/ad157fe26e74211e7dde0456cb3fd9ab78b6e552.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - } -} diff --git a/integration-test/run.sh b/integration-test/run.sh index 318557b5..9f4fd36c 100755 --- a/integration-test/run.sh +++ b/integration-test/run.sh @@ -15,7 +15,8 @@ function fn_main() { function fn_build_rust_bins() { cd "bins" - cargo build --release + cargo --version + cargo build --release --verbose cd "$DIR" } diff --git a/integration-test/tests/multiboot2/build_img.sh b/integration-test/tests/multiboot2/build_img.sh index ff528557..026e80cf 100755 --- a/integration-test/tests/multiboot2/build_img.sh +++ b/integration-test/tests/multiboot2/build_img.sh @@ -25,4 +25,5 @@ cp grub.cfg .vol/boot/grub cp "$MULTIBOOT2_PAYLOAD_PATH" .vol # Create a GRUB image with the files in ".vol" being embedded. -grub-mkrescue -o "grub_boot.img" ".vol" 2>/dev/null +echo "Creating bootable image..." +grub-mkrescue -o "grub_boot.img" ".vol" diff --git a/multiboot2-header/Cargo.toml b/multiboot2-header/Cargo.toml index ba84e644..6ed1c755 100644 --- a/multiboot2-header/Cargo.toml +++ b/multiboot2-header/Cargo.toml @@ -4,7 +4,7 @@ description = """ Library with type definitions and parsing functions for Multiboot2 headers. This library is `no_std` and can be used in bootloaders. """ -version = "0.3.1" +version = "0.3.2" authors = [ "Philipp Schuster " ] @@ -26,7 +26,7 @@ readme = "README.md" homepage = "https://github.com/rust-osdev/multiboot2-header" repository = "https://github.com/rust-osdev/multiboot2" documentation = "https://docs.rs/multiboot2-header" -rust-version = "1.68" +rust-version = "1.70" [[example]] name = "minimal" @@ -40,14 +40,8 @@ builder = ["alloc"] unstable = [] [dependencies] -# Not yet used. -# bitflags.workspace = true derive_more.workspace = true -# Not yet used. -# log.workspace = true - -# used for MBI tags -multiboot2 = "0.16.0" +multiboot2 = { version = "0.19.0", default-features = false } [package.metadata.docs.rs] all-features = true diff --git a/multiboot2-header/Changelog.md b/multiboot2-header/Changelog.md index 4d0f9bca..aebf8dde 100644 --- a/multiboot2-header/Changelog.md +++ b/multiboot2-header/Changelog.md @@ -1,30 +1,55 @@ # CHANGELOG for crate `multiboot2-header` +## Unreleased + +- added `EndHeaderTag::default()` +- MSRV is 1.70 +- Can add multiple `TagType::Smbios` tags in the builder. + +## 0.3.2 (2023-11-30) + +- **BREAKING** bumped `multiboot2` dependency to `v0.19.0` +- the `multiboot2` dependency doesn't pull in the `multiboot2/builder` feature + anymore +- doc update + +## 0.3.1 (2023-06-28) + +- doc update + ## 0.3.0 (2023-06-23) -- **BREAKING** MSRV is 1.68.0 + +- **BREAKING** MSRV is 1.68.0 (UPDATE: This is actually 1.69.) - **BREAKING** renamed the `std` feature to `alloc` -- **BREAKING** bumped dependency to `multiboot2@v0.16.0` +- **BREAKING** bumped `multiboot2` dependency to `v0.16.0` - **BREAKING** renamed `MULTIBOOT2_HEADER_MAGIC` to `MAGIC` - **BREAKING** renamed `Multiboot2HeaderBuilder` to `HeaderBuilder` - **BREAKING** renamed `from_addr` to `load`. The function now consumes a ptr. - **BREAKING** `HeaderBuilder::build` now returns a value of type `HeaderBytes` The old builder could produce misaligned structures. - added the optional `unstable` feature (requires nightly) - - implement `core::error::Error` for `LoadError` + - implement `core::error::Error` for `LoadError` ## 0.2.0 (2022-05-03) + - **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag` -- **BREAKING** some paths changed from `multiboot2_header::header` to `multiboot2_header::builder` - -> thus, import paths are much more logically now +- **BREAKING** some paths changed from `multiboot2_header::header` + to `multiboot2_header::builder` + -> thus, import paths are much more logically now - internal code improvements ## 0.1.1 (2022-05-02) + - fixed a bug that prevented the usage of the crate in `no_std` environments -- added a new default `builder`-feature to Cargo which requires the `alloc`-crate - (this feature can be disabled which will also remove the dependency to the `alloc` crate) +- added a new default `builder`-feature to Cargo which requires the `alloc` + -crate + (this feature can be disabled which will also remove the dependency to + the `alloc` crate) ## 0.1.0 (2021-10-08) + - initial release ## 0.0.0 + Empty release to save the name on crates.io diff --git a/multiboot2-header/README.md b/multiboot2-header/README.md index 6110293e..eebac8d0 100644 --- a/multiboot2-header/README.md +++ b/multiboot2-header/README.md @@ -1,25 +1,27 @@ # multiboot2-header + ![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) [![docs](https://docs.rs/multiboot2-header/badge.svg)](https://docs.rs/multiboot2-header/) -Rust library with type definitions and parsing functions for Multiboot2 headers. -This library is `no_std` and can be used in bootloaders. +Rust library with type definitions and parsing functions for Multiboot2 headers, +as well as a builder to build them at runtime. This library is `no_std` and can +be used in bootloaders. What this library is good for: -- writing a small binary which writes you a valid Multiboot2 header - into a file (such as `header.bin`) + +- 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 - understanding Multiboot2 headers better - analyze Multiboot2 headers at runtime -What this library is not optimal for: -- compiling a Multiboot2 header statically into an object file using only Rust code - ## 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 headers at runtime. -For parsing, this is not relevant, and you can deactivate the default feature. +For parsing, the feature is not relevant, and you can deactivate it. ```toml # without `builder`-feature (and without `alloc`-crate) @@ -29,6 +31,7 @@ multiboot2-header = "" ``` ## Example 1: Builder + Parse + ```rust use multiboot2_header::builder::{InformationRequestHeaderTagBuilder, Multiboot2HeaderBuilder}; use multiboot2_header::{HeaderTagFlag, HeaderTagISA, MbiTagType, RelocatableHeaderTag, RelocatableHeaderTagPreference, Multiboot2Header}; @@ -58,19 +61,25 @@ fn main() { ``` ## 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] #[no_mangle] #[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 in a LOAD segment with a file offset with less than 32768 bytes. -See specification. + +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.68.0 stable. + +The MSRV is 1.70.0 stable. ## 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. diff --git a/multiboot2-header/src/end.rs b/multiboot2-header/src/end.rs index 271b1254..15f8c76f 100644 --- a/multiboot2-header/src/end.rs +++ b/multiboot2-header/src/end.rs @@ -12,6 +12,12 @@ pub struct EndHeaderTag { size: u32, } +impl Default for EndHeaderTag { + fn default() -> Self { + Self::new() + } +} + impl EndHeaderTag { pub const fn new() -> Self { EndHeaderTag { diff --git a/multiboot2-header/src/header.rs b/multiboot2-header/src/header.rs index bff62778..cb256f92 100644 --- a/multiboot2-header/src/header.rs +++ b/multiboot2-header/src/header.rs @@ -4,7 +4,6 @@ use crate::{ HeaderTag, HeaderTagISA, HeaderTagType, InformationRequestHeaderTag, ModuleAlignHeaderTag, RelocatableHeaderTag, }; -use core::convert::TryInto; use core::fmt::{Debug, Formatter}; use core::mem::size_of; diff --git a/multiboot2-header/src/lib.rs b/multiboot2-header/src/lib.rs index 4995b028..456f4682 100644 --- a/multiboot2-header/src/lib.rs +++ b/multiboot2-header/src/lib.rs @@ -1,7 +1,9 @@ -//! Library with type definitions and parsing functions for Multiboot2 headers. -//! This library is `no_std` and can be used in bootloaders. +//! Rust library with type definitions and parsing functions for Multiboot2 +//! headers, as well as a builder to build them at runtime. This library is +//! `no_std` and can be used in bootloaders. //! //! # Example +//! //! ```rust //! use multiboot2_header::builder::{InformationRequestHeaderTagBuilder, HeaderBuilder}; //! use multiboot2_header::{HeaderTagFlag, HeaderTagISA, MbiTagType, RelocatableHeaderTag, RelocatableHeaderTagPreference, Multiboot2Header}; @@ -31,7 +33,8 @@ //! ``` //! //! ## MSRV -//! The MSRV is 1.68.0 stable. +//! +//! The MSRV is 1.70.0 stable. #![no_std] #![cfg_attr(feature = "unstable", feature(error_in_core))] diff --git a/multiboot2/Cargo.toml b/multiboot2/Cargo.toml index 3a31f84b..20d30a3d 100644 --- a/multiboot2/Cargo.toml +++ b/multiboot2/Cargo.toml @@ -6,7 +6,7 @@ Multiboot2-compliant bootloaders, such as GRUB. It supports all tags from the specification including full support for the sections of ELF files. This library is `no_std` and can be used in a Multiboot2-kernel. """ -version = "0.19.0" +version = "0.20.0" authors = [ "Philipp Oppermann ", "Calvin Lee ", @@ -31,7 +31,7 @@ readme = "README.md" homepage = "https://github.com/rust-osdev/multiboot2" repository = "https://github.com/rust-osdev/multiboot2" documentation = "https://docs.rs/multiboot2" -rust-version = "1.68" +rust-version = "1.70" [features] default = ["builder"] @@ -45,8 +45,12 @@ bitflags.workspace = true derive_more.workspace = true log.workspace = true -uefi-raw = { version = "0.3", default-features = false } -ptr_meta = { version = "0.2", default-features = false } +# We only use a very basic type definition from this crate. To prevent MSRV +# 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 +# type definition. +uefi-raw = { version = "~0.5", default-features = false } +ptr_meta = { version = "~0.2", default-features = false } [package.metadata.docs.rs] all-features = true diff --git a/multiboot2/Changelog.md b/multiboot2/Changelog.md index 20c1124b..fc1ce89a 100644 --- a/multiboot2/Changelog.md +++ b/multiboot2/Changelog.md @@ -1,6 +1,14 @@ # CHANGELOG for crate `multiboot2` -## 0.19.0 (2023-09-XX) +## Unreleased + +## 0.20.0 (2024-05-01) + +- added `InformationBuilder::default()` +- MSRV is 1.70 + +## 0.19.0 (2023-09-21) + - **BREAKING** MSRV is 1.69.0 - **BREAKING** `Tag::get_dst_str_slice` renamed to `Tag::parse_slice_as_string` and now returns `Result<&str, StringError>` @@ -14,9 +22,11 @@ `add_tag` was introduced for that. ## 0.18.1 (2023-07-13) + - Documentation improvements ## 0.18.0 (2023-07-13) + - **BREAKING** The `TagTrait` was enhanced and now has an associated `ID` constant. This is only breaking to users that used `BootInformation::get_tag` or that implement custom tags. `BootInformation::get_tag` doesn't need the @@ -37,29 +47,39 @@ - Internal code cleanup. ## 0.17.0 (2023-07-12) -- **BREAKING** Make functions of `InformationBuilder` chainable. They now consume the builder. + +- **BREAKING** Make functions of `InformationBuilder` chainable. They now + consume the builder. - **BREAKING** Allow non-standard memory area types by using new pair of corresponding types: `MemoryAreaTypeId` and `MemoryAreaType`. ## 0.16.0 (2023-06-23) + - **BREAKING** renamed `MULTIBOOT2_BOOTLOADER_MAGIC` to `MAGIC` - **BREAKING** `EFIMemoryDesc` was removed and is now an alias of `uefi_raw::table::boot::MemoryDescriptor` - **BREAKING** `EFIMemoryAreaType` was removed and is now an alias of `uefi_raw::table::boot::MemoryType` - **BREAKING** MSRV is 1.68.0 -- **BREAKING** Removed `MemoryAreaIter` and `MemoryMapTag::available_memory_areas` -- **BREAKING** Renamed `BootInformation::load_base_addr` to `BootInformation::load_base_addr_tag` -- **BREAKING** Renamed `BootInformation::efi_32_ih` to `BootInformation::efi_32_ih_tag` -- **BREAKING** Renamed `BootInformation::efi_32_ih` to `BootInformation::efi_32_ih_tag` +- **BREAKING** Removed `MemoryAreaIter` + and `MemoryMapTag::available_memory_areas` +- **BREAKING** Renamed `BootInformation::load_base_addr` + to `BootInformation::load_base_addr_tag` +- **BREAKING** Renamed `BootInformation::efi_32_ih` + to `BootInformation::efi_32_ih_tag` +- **BREAKING** Renamed `BootInformation::efi_32_ih` + to `BootInformation::efi_32_ih_tag` - **BREAKING** Renamed `ImageLoadPhysAddr` to `ImageLoadPhysAddrTag` - **BREAKING** Renamed `EFIImageHandle32` to `EFIImageHandle32Tag` - **BREAKING** Renamed `EFIImageHandle64` to `EFIImageHandle64Tag` - **BREAKING** Renamed `EFISdt32` to `EFISdt32Tag` - **BREAKING** Renamed `EFISdt64` to `EFISdt64Tag` -- **BREAKING** Renamed `EFIBootServicesNotExited` to `EFIBootServicesNotExitedTag` -- **BREAKING** Renamed `CommandLineTag::command_line` renamed to `CommandLineTag::cmdline` -- **\[Might be\] BREAKING** Added `TagTrait` trait which enables to use DSTs as multiboot2 tags. This is +- **BREAKING** Renamed `EFIBootServicesNotExited` + to `EFIBootServicesNotExitedTag` +- **BREAKING** Renamed `CommandLineTag::command_line` renamed + to `CommandLineTag::cmdline` +- **\[Might be\] BREAKING** Added `TagTrait` trait which enables to use DSTs as + multiboot2 tags. This is mostly relevant for the command line tag, the modules tag, and the bootloader name tag. However, this might also be relevant for users of custom multiboot2 tags that use DSTs as types. See the example provided in the doc of the @@ -72,6 +92,7 @@ - added `MemoryMapTag::entry_size` and `MemoryMapTag::entry_version` ## 0.15.1 (2023-03-18) + - **BREAKING** `MemoryMapTag::all_memory_areas()` was renamed to `memory_areas` and now returns `MemoryAreaIter` instead of `impl Iterator`. Experience showed that its better to @@ -86,14 +107,16 @@ - fix: prevent a possible panic in `ElfSection::section_type()` ## 0.15.0 (2023-03-17) + - **BREAKING** MSRV is 1.56.1 - **BREAKING** fixed lifetime issues: `VBEInfoTag` is no longer `&static` - **BREAKING:** `TagType` is now split into `TagTypeId` and `TagType` - - `TagTypeId` is a binary-compatible form of a Multiboot2 tag id - - `TagType` is a higher-level abstraction for either specified or custom tags - but not ABI compatible. - - There exists a seamless integration between `u32`, `TagType`, and - `TagTypeId` via `From` and `PartialEq`-implementations. + - `TagTypeId` is a binary-compatible form of a Multiboot2 tag id + - `TagType` is a higher-level abstraction for either specified or custom + tags + but not ABI compatible. + - There exists a seamless integration between `u32`, `TagType`, and + `TagTypeId` via `From` and `PartialEq`-implementations. - fixed another internal lifetime issue - `BootInformation::framebuffer_tag()` now returns `Option>` instead of @@ -106,6 +129,7 @@ from. ## 0.14.2 (2023-03-17) + - documentation fixes - `MbiLoadError` now implements `Display` - Added the `unstable` feature, which enables nightly-only functionality. @@ -113,53 +137,67 @@ be used with `anyhow::Result` for example. ## 0.14.1 (2023-03-09) -- fixed the calculation of the last area of the memory map tag ([#119](https://github.com/rust-osdev/multiboot2/pull/119)) - (Previously, iterating the EFI Memory map resulted in a superfluous entry as it ran over the next tag) + +- fixed the calculation of the last area of the memory map + tag ([#119](https://github.com/rust-osdev/multiboot2/pull/119)) + (Previously, iterating the EFI Memory map resulted in a superfluous entry as + it ran over the next tag) ## 0.14.0 (2022-06-30) + - **BREAKING CHANGES** \ - This version includes a few small breaking changes that brings more safety when parsing strings from the + This version includes a few small breaking changes that brings more safety + when parsing strings from the multiboot information structure. - - `BootLoaderNameTag::name` now returns a Result instead of just the value - - `CommandLineTag::command_line` now returns a Result instead of just the value - - `ModuleTag::cmdline` now returns a Result instead of just the value - - `RsdpV1Tag::signature` now returns a Result instead of an Option - - `RsdpV1Tag::oem_id` now returns a Result instead of an Option - - `RsdpV2Tag::signature` now returns a Result instead of an Option - - `RsdpV2Tag::oem_id` now returns a Result instead of an Option + - `BootLoaderNameTag::name` now returns a Result instead of just the value + - `CommandLineTag::command_line` now returns a Result instead of just the + value + - `ModuleTag::cmdline` now returns a Result instead of just the value + - `RsdpV1Tag::signature` now returns a Result instead of an Option + - `RsdpV1Tag::oem_id` now returns a Result instead of an Option + - `RsdpV2Tag::signature` now returns a Result instead of an Option + - `RsdpV2Tag::oem_id` now returns a Result instead of an Option - internal code improvements ## 0.13.3 (2022-06-03) + - impl `Send` for `BootInformation` ## 0.13.2 (2022-05-02) + - `TagType` now implements `Ord` so that it can be used in `BTreeSet` -- small internal improvements and restructuring of the code (no breaking changes to public API) +- small internal improvements and restructuring of the code (no breaking changes + to public API) ## 0.13.1 (2022-01-09) + - minor fix ## 0.13.0 (**yanked**) + - added missing getters for tag `ImageLoadPhysAddr` - added missing getters for tags `EFIImageHandle32` and `EFIImageHandle64` ## 0.12.2 (2021-10-02) + - `TagType` now implements `Eq` and `Hash` - internal improvements - - `std` can be used in tests; the crate is still `no_std` - - this implies that `cargo test` doesn't work on "non-standard" targets - - CI (Ubuntu) still works. - - code formatting/style - - sensible style checks as optional CI job - - `.editorconfig` file - - prepared co-existence of crates `multiboot2` and `multiboot2-header` - in a Cargo workspace inside the same repository + - `std` can be used in tests; the crate is still `no_std` + - this implies that `cargo test` doesn't work on "non-standard" targets + - CI (Ubuntu) still works. + - code formatting/style + - sensible style checks as optional CI job + - `.editorconfig` file + - prepared co-existence of crates `multiboot2` and `multiboot2-header` + in a Cargo workspace inside the same repository ## 0.12.1 (2021-08-11) + - `TagType`-enum introduced in `v0.11` is now actually public - internal code improvements ## 0.12.0 (2021-08-06) + - **breaking:** `load()` and `load_with_offset` now returns a result - added public constant `MULTIBOOT2_BOOTLOADER_MAGIC` - Rust edition 2018 (instead of 2015) @@ -167,21 +205,26 @@ ## 0.11.0 (2021-07-07) -- **breaking:** iterator functions (e.g. `ElfSectionsTag::sections()`) return `impl Iterator` instead of a concrete type +- **breaking:** iterator functions (e.g. `ElfSectionsTag::sections()`) + return `impl Iterator` instead of a concrete type - lib now contains `TagType`-enum that contains all possible mbi tags that are specified (taken from spec) - much improved debug-formatting of `BootInformation` - internal code improvements / formatting ## 0.10.0 (2020-11-03) + - allow access to all memory regions (MemoryMap-Tag) - internal code improvements ## 0.9.0 (2020-07-06) -- Add a `checksum_is_valid` method to the RSDP tags ([#64](https://github.com/rust-osdev/multiboot2/pull/64)) +- Add a `checksum_is_valid` method to the RSDP + tags ([#64](https://github.com/rust-osdev/multiboot2/pull/64)) ## 0.8.2 (2022-03-02) -- Add some basic documentation ([#62](https://github.com/rust-osdev/multiboot2/pull/62)) -- Add MemoryAreaType, to allow users to access memory area types in a type-safe way ([#61](https://github.com/rust-osdev/multiboot2/pull/61)) +- Add some basic + documentation ([#62](https://github.com/rust-osdev/multiboot2/pull/62)) +- Add MemoryAreaType, to allow users to access memory area types in a type-safe + way ([#61](https://github.com/rust-osdev/multiboot2/pull/61)) diff --git a/multiboot2/README.md b/multiboot2/README.md index ea616127..4bdd1893 100644 --- a/multiboot2/README.md +++ b/multiboot2/README.md @@ -1,4 +1,5 @@ # multiboot2 + ![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) [![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 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 + 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 @@ -18,28 +22,32 @@ structures at runtime. For parsing, this is not relevant, and you can deactivate the default feature. ## 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) + 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 + 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 -The MSRV is 1.69.0 stable. + +The MSRV is 1.70.0 stable. ## 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. diff --git a/multiboot2/src/builder/boxed_dst.rs b/multiboot2/src/builder/boxed_dst.rs index 9106457f..bafb8df3 100644 --- a/multiboot2/src/builder/boxed_dst.rs +++ b/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 /// `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 -/// 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. /// /// 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.string(), Ok(content_rust_str)); } + + #[test] + fn can_hold_tag_trait() { + fn consume(_: &T) {} + let content = b"hallo\0"; + + let tag = BoxedDst::::new(content); + consume(tag.deref()); + consume(&*tag); + // Compiler not smart enough? + // consume(&tag); + } } diff --git a/multiboot2/src/builder/information.rs b/multiboot2/src/builder/information.rs index 7b6fe990..8d16a903 100644 --- a/multiboot2/src/builder/information.rs +++ b/multiboot2/src/builder/information.rs @@ -47,6 +47,7 @@ type SerializedTag = Vec; /// Error that indicates a tag was added multiple times that is not allowed to /// be there multiple times. #[derive(Debug)] +#[allow(unused)] pub struct RedundantTagError(TagType); impl Display for RedundantTagError { @@ -64,6 +65,12 @@ impl core::error::Error for RedundantTagError {} #[derive(Debug, PartialEq, Eq)] pub struct InformationBuilder(Vec<(TagType, SerializedTag)>); +impl Default for InformationBuilder { + fn default() -> Self { + Self::new() + } +} + impl InformationBuilder { /// Creates a new builder. pub const fn new() -> Self { @@ -281,7 +288,10 @@ impl InformationBuilder { } fn tag_is_allowed_multiple_times(tag_type: TagType) -> bool { - matches!(tag_type, TagType::Module | TagType::Custom(_)) + matches!( + tag_type, + TagType::Module | TagType::Smbios | TagType::Custom(_) + ) } } diff --git a/multiboot2/src/builder/mod.rs b/multiboot2/src/builder/mod.rs index 1a1d7425..93b68528 100644 --- a/multiboot2/src/builder/mod.rs +++ b/multiboot2/src/builder/mod.rs @@ -3,7 +3,7 @@ mod boxed_dst; 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 information::InformationBuilder; diff --git a/multiboot2/src/efi.rs b/multiboot2/src/efi.rs index a80325ca..230b1bd8 100644 --- a/multiboot2/src/efi.rs +++ b/multiboot2/src/efi.rs @@ -8,7 +8,6 @@ use crate::TagTypeId; use crate::{Tag, TagTrait, TagType}; -use core::convert::TryInto; use core::mem::size_of; /// EFI system table in 32 bit mode tag. diff --git a/multiboot2/src/image_load_addr.rs b/multiboot2/src/image_load_addr.rs index efb1b49e..fbc6645d 100644 --- a/multiboot2/src/image_load_addr.rs +++ b/multiboot2/src/image_load_addr.rs @@ -2,7 +2,7 @@ use crate::{Tag, TagTrait, TagType, TagTypeId}; #[cfg(feature = "builder")] -use {core::convert::TryInto, core::mem::size_of}; +use core::mem::size_of; /// The physical load address tag. Typically, this is only available if the /// binary was relocated, for example if the relocatable header tag was diff --git a/multiboot2/src/lib.rs b/multiboot2/src/lib.rs index 4f8b05cf..ee6e4767 100644 --- a/multiboot2/src/lib.rs +++ b/multiboot2/src/lib.rs @@ -33,7 +33,7 @@ //! ``` //! //! ## MSRV -//! The MSRV is 1.69.0 stable. +//! The MSRV is 1.70.0 stable. #[cfg(feature = "builder")] extern crate alloc; diff --git a/multiboot2/src/memory_map.rs b/multiboot2/src/memory_map.rs index c502551e..a5197ec5 100644 --- a/multiboot2/src/memory_map.rs +++ b/multiboot2/src/memory_map.rs @@ -5,7 +5,6 @@ pub use uefi_raw::table::boot::MemoryDescriptor as EFIMemoryDesc; pub use uefi_raw::table::boot::MemoryType as EFIMemoryAreaType; use crate::{Tag, TagTrait, TagType, TagTypeId}; -use core::convert::TryInto; use core::fmt::{Debug, Formatter}; use core::marker::PhantomData; use core::mem; diff --git a/multiboot2/src/rsdp.rs b/multiboot2/src/rsdp.rs index 12a5b723..d8526157 100644 --- a/multiboot2/src/rsdp.rs +++ b/multiboot2/src/rsdp.rs @@ -13,11 +13,11 @@ //! use crate::{Tag, TagTrait, TagType, TagTypeId}; +#[cfg(feature = "builder")] +use core::mem::size_of; use core::slice; use core::str; use core::str::Utf8Error; -#[cfg(feature = "builder")] -use {core::convert::TryInto, core::mem::size_of}; const RSDPV1_LENGTH: usize = 20; diff --git a/multiboot2/src/tag_trait.rs b/multiboot2/src/tag_trait.rs index 5c42e8a8..7e3ce9ab 100644 --- a/multiboot2/src/tag_trait.rs +++ b/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, /// 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. /// /// # Trivia diff --git a/nix/sources.json b/nix/sources.json new file mode 100644 index 00000000..5da91e3a --- /dev/null +++ b/nix/sources.json @@ -0,0 +1,14 @@ +{ + "nixpkgs": { + "branch": "nixos-23.11", + "description": "Nix Packages collection", + "homepage": null, + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "576ecd43d3b864966b4423a853412d6177775e8b", + "sha256": "05gr8w09w7fqfi6zflx7df1n0hhsf8f4p9siikk3wb7k7by2d9sr", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/576ecd43d3b864966b4423a853412d6177775e8b.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + } +} diff --git a/integration-test/nix/sources.nix b/nix/sources.nix similarity index 100% rename from integration-test/nix/sources.nix rename to nix/sources.nix diff --git a/integration-test/shell.nix b/shell.nix similarity index 67% rename from integration-test/shell.nix rename to shell.nix index 1871b0df..178c58af 100644 --- a/integration-test/shell.nix +++ b/shell.nix @@ -3,11 +3,20 @@ let pkgs = import sources.nixpkgs {}; in pkgs.mkShell rec { - nativeBuildInputs = with pkgs; [ + packages = with pkgs; [ + # general + rustup + nixpkgs-fmt + niv + + # integration test grub2 qemu - rustup xorriso + + (pkgs.writeShellScriptBin "run-integrationtest" '' + ./integration-test/run.sh + '') ]; # To invoke "nix-shell" in the CI-runner, we need a global Nix channel.