Skip to content

Commit e8b2e2e

Browse files
authored
Merge pull request #208 from rust-osdev/dev
misc: various improvements
2 parents aefff50 + 7a7ac8d commit e8b2e2e

File tree

18 files changed

+134
-70
lines changed

18 files changed

+134
-70
lines changed

Cargo.lock

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-test/bins/multiboot2_chainloader/src/multiboot.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! Parsing the Multiboot information. Glue code for the [`multiboot`] code.
22
33
use anyhow::anyhow;
4+
use core::ptr::addr_of_mut;
45
use core::slice;
5-
pub use multiboot::information::ModuleIter;
6-
pub use multiboot::information::Multiboot as Mbi;
76
use multiboot::information::{MemoryManagement, Multiboot, PAddr, SIGNATURE_EAX};
87

98
static mut MEMORY_MANAGEMENT: Mem = Mem;
@@ -14,7 +13,8 @@ pub fn get_mbi<'a>(magic: u32, ptr: u32) -> anyhow::Result<Multiboot<'a, 'static
1413
if magic != SIGNATURE_EAX {
1514
return Err(anyhow!("Unknown Multiboot signature {magic:x}"));
1615
}
17-
unsafe { Multiboot::from_ptr(ptr as u64, &mut MEMORY_MANAGEMENT) }.ok_or(anyhow!(
16+
let mmgmt: &mut dyn MemoryManagement = unsafe { &mut *addr_of_mut!(MEMORY_MANAGEMENT) };
17+
unsafe { Multiboot::from_ptr(ptr as u64, mmgmt) }.ok_or(anyhow!(
1818
"Can't read Multiboot boot information from pointer"
1919
))
2020
}

integration-test/bins/multiboot2_payload/src/verify/grub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn basic_sanity_checks(mbi: &BootInformation) -> anyhow::Result<()> {
2323
.map_err(anyhow::Error::msg)?
2424
.cmdline()
2525
.map_err(anyhow::Error::msg)?;
26-
assert_eq!(bootloader_name, "GRUB 2.06");
26+
assert!(bootloader_name.starts_with("GRUB 2."));
2727
assert_eq!(cmdline, "some commandline arguments");
2828

2929
Ok(())

integration-test/bins/rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[toolchain]
2-
channel = "nightly-2023-06-22"
2+
channel = "nightly-2024-03-31" # rustc 1.79-nightly
33
profile = "default"
44
components = [
55
"rust-src",

integration-test/bins/x86-unknown-none.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"llvm-target": "i686-unknown-none",
3-
"data-layout": "e-m:e-i32:32-f80:128-n8:16:32-S128-p:32:32",
3+
"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",
44
"arch": "x86",
55
"target-endian": "little",
66
"target-pointer-width": "32",

integration-test/nix/sources.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"nixpkgs": {
3-
"branch": "nixos-23.05",
3+
"branch": "nixos-23.11",
44
"description": "Nix Packages collection",
55
"homepage": null,
66
"owner": "NixOS",
77
"repo": "nixpkgs",
8-
"rev": "ad157fe26e74211e7dde0456cb3fd9ab78b6e552",
9-
"sha256": "0l5gimzlbzq1svw48p4h3wf24ry21icl9198jk5x4xqvs6k2gffx",
8+
"rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
9+
"sha256": "065jy7qivlbdqmbvd7r9h97b23f21axmc4r7sqmq2h0j82rmymxv",
1010
"type": "tarball",
11-
"url": "https://github.com/NixOS/nixpkgs/archive/ad157fe26e74211e7dde0456cb3fd9ab78b6e552.tar.gz",
11+
"url": "https://github.com/NixOS/nixpkgs/archive/219951b495fc2eac67b1456824cc1ec1fd2ee659.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
}
1414
}

integration-test/tests/multiboot2/build_img.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ cp grub.cfg .vol/boot/grub
2525
cp "$MULTIBOOT2_PAYLOAD_PATH" .vol
2626

2727
# Create a GRUB image with the files in ".vol" being embedded.
28-
grub-mkrescue -o "grub_boot.img" ".vol" 2>/dev/null
28+
echo "Creating bootable image..."
29+
grub-mkrescue -o "grub_boot.img" ".vol"

multiboot2-header/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ readme = "README.md"
2626
homepage = "https://github.com/rust-osdev/multiboot2-header"
2727
repository = "https://github.com/rust-osdev/multiboot2"
2828
documentation = "https://docs.rs/multiboot2-header"
29-
rust-version = "1.68"
29+
rust-version = "1.69"
3030

3131
[[example]]
3232
name = "minimal"

multiboot2-header/Changelog.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG for crate `multiboot2-header`
22

3+
## Unreleased
4+
5+
- added `EndHeaderTag::default()`
6+
- MSRV is 1.69
7+
38
## 0.3.2 (2023-11-30)
49

510
- **BREAKING** bumped `multiboot2` dependency to `v0.19.0`
@@ -13,7 +18,7 @@
1318

1419
## 0.3.0 (2023-06-23)
1520

16-
- **BREAKING** MSRV is 1.68.0
21+
- **BREAKING** MSRV is 1.68.0 (UPDATE: This is actually 1.69.)
1722
- **BREAKING** renamed the `std` feature to `alloc`
1823
- **BREAKING** bumped `multiboot2` dependency to `v0.16.0`
1924
- **BREAKING** renamed `MULTIBOOT2_HEADER_MAGIC` to `MAGIC`
@@ -22,20 +27,23 @@
2227
- **BREAKING** `HeaderBuilder::build` now returns a value of type `HeaderBytes`
2328
The old builder could produce misaligned structures.
2429
- added the optional `unstable` feature (requires nightly)
25-
- implement `core::error::Error` for `LoadError`
30+
- implement `core::error::Error` for `LoadError`
2631

2732
## 0.2.0 (2022-05-03)
2833

2934
- **BREAKING** renamed `EntryHeaderTag` to `EntryAddressHeaderTag`
30-
- **BREAKING** some paths changed from `multiboot2_header::header` to `multiboot2_header::builder`
31-
-> thus, import paths are much more logically now
35+
- **BREAKING** some paths changed from `multiboot2_header::header`
36+
to `multiboot2_header::builder`
37+
-> thus, import paths are much more logically now
3238
- internal code improvements
3339

3440
## 0.1.1 (2022-05-02)
3541

3642
- fixed a bug that prevented the usage of the crate in `no_std` environments
37-
- added a new default `builder`-feature to Cargo which requires the `alloc`-crate
38-
(this feature can be disabled which will also remove the dependency to the `alloc` crate)
43+
- added a new default `builder`-feature to Cargo which requires the `alloc`
44+
-crate
45+
(this feature can be disabled which will also remove the dependency to
46+
the `alloc` crate)
3947

4048
## 0.1.0 (2021-10-08)
4149

multiboot2-header/src/end.rs

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ pub struct EndHeaderTag {
1212
size: u32,
1313
}
1414

15+
impl Default for EndHeaderTag {
16+
fn default() -> Self {
17+
Self::new()
18+
}
19+
}
20+
1521
impl EndHeaderTag {
1622
pub const fn new() -> Self {
1723
EndHeaderTag {

multiboot2-header/src/header.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::{
44
HeaderTag, HeaderTagISA, HeaderTagType, InformationRequestHeaderTag, ModuleAlignHeaderTag,
55
RelocatableHeaderTag,
66
};
7-
use core::convert::TryInto;
87
use core::fmt::{Debug, Formatter};
98
use core::mem::size_of;
109

multiboot2/Cargo.toml

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ readme = "README.md"
3131
homepage = "https://github.com/rust-osdev/multiboot2"
3232
repository = "https://github.com/rust-osdev/multiboot2"
3333
documentation = "https://docs.rs/multiboot2"
34-
rust-version = "1.68"
34+
rust-version = "1.69"
3535

3636
[features]
3737
default = ["builder"]
@@ -45,7 +45,11 @@ bitflags.workspace = true
4545
derive_more.workspace = true
4646
log.workspace = true
4747

48-
uefi-raw = { version = "0.3", default-features = false }
48+
# We only use a very basic type definition from this crate. To prevent MSRV
49+
# bumps from uefi-raw, I restrict this here. Upstream users are likely to have
50+
# two versions of this library in it, which is no problem, as we only use the
51+
# type definition.
52+
uefi-raw = { version = "=0.3", default-features = false }
4953
ptr_meta = { version = "0.2", default-features = false }
5054

5155
[package.metadata.docs.rs]

0 commit comments

Comments
 (0)