Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package.license = "MIT/Apache-2.0"
[workspace.dependencies]
# Dependencies of multiboot2 et al.
bitflags = { version = "2.11", default-features = false }
elf = { version = "0.8", default-features = false }
log = { version = "~0.4", default-features = false }
ptr_meta = { version = "~0.3", default-features = false }
thiserror = { version = "2.0", default-features = false }
Expand Down
26 changes: 19 additions & 7 deletions integration-test/bins/multiboot2_payload/src/verify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod grub;

use alloc::format;
use alloc::vec::Vec;
use multiboot2::BootInformation;
use multiboot2::{BootInformation, ElfSectionExt};

pub fn run(mbi: &BootInformation) -> anyhow::Result<()> {
println!("MBI: {mbi:#x?}");
Expand Down Expand Up @@ -52,20 +52,32 @@ pub(self) fn print_elf_info(mbi: &BootInformation) -> anyhow::Result<()> {
.ok_or("Should have elf sections")
.map(|tag| tag.sections())
.map_err(anyhow::Error::msg)?;
let string_table = mbi
.elf_sections_tag()
.ok_or("Should have elf sections")
.map(|tag| tag.string_table())
.map_err(anyhow::Error::msg)?
.ok_or("String table section should be present")
.map_err(anyhow::Error::msg)?;

println!("ELF sections:");
for s in sections_iter {
let typ = format!("{:?}", s.section_type());
let typ = format!("{:?}", s.sh_type);
let flags = format!("{:?}", s.flags());
let name = s.name().map_err(anyhow::Error::msg)?;
let name = s
.name_from_string_table(string_table)
.map_err(anyhow::Error::msg)?
.to_str()
.map_err(anyhow::Error::msg)?;
println!(
" {:<13} {:<17} {:<22} 0x{:010x} 0x{:010x} {:>5.2} MiB align={}",
name,
typ,
flags,
s.start_address(),
s.end_address(),
s.size() as f32 / 1024.0,
s.addralign(),
s.sh_addr,
s.sh_addr + s.sh_size,
s.sh_size as f32 / 1024.0,
s.sh_addralign,
);
}
println!();
Expand Down
1 change: 1 addition & 0 deletions multiboot2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ builder = ["alloc", "multiboot2-common/builder"]

[dependencies]
bitflags = { workspace = true }
elf = { workspace = true }
log = { workspace = true }
multiboot2-common = { workspace = true }
ptr_meta = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion multiboot2/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ mod tests {
8,
FramebufferType::Text,
))
.elf_sections(ElfSectionsTag::new(0, 32, 0, &[]))
.elf_sections(ElfSectionsTag::new(0, 40, 0, &[]))
.apm(ApmTag::new(0, 0, 0, 0, 0, 0, 0, 0, 0))
.efi32(EFISdt32Tag::new(0x1000))
.efi64(EFISdt64Tag::new(0x1000))
Expand Down
Loading