Skip to content

Commit b2d0ee9

Browse files
committed
integration-test: Tests run now using Limine (no UEFI so far)
1 parent fac64d7 commit b2d0ee9

File tree

9 files changed

+32
-18
lines changed

9 files changed

+32
-18
lines changed

integration-test/bins/multiboot2_chainloader/Cargo.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[package]
22
name = "multiboot2_chainloader"
3-
description = "Integrationtest: Multiboot2 chainloader"
3+
description = """
4+
Integrationtest: Multiboot2 chainloader. The loader itself loads via Multiboot1,
5+
but the payload is loaded via Multiboot2 by the loader.
6+
"""
47
version = "0.1.0"
58
edition = "2021"
69
publish = false

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

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ core::arch::global_asm!(include_str!("start.S"), options(att_syntax));
1919
#[no_mangle]
2020
fn rust_entry(multiboot_magic: u32, multiboot_hdr: *const u32) -> ! {
2121
init_environment();
22-
let x = 0.12 + 0.56;
23-
log::debug!("{x}");
2422
log::debug!("multiboot_hdr={multiboot_hdr:x?}, multiboot_magic=0x{multiboot_magic:x?}");
2523
let mbi = multiboot::get_mbi(multiboot_magic, multiboot_hdr as u32).unwrap();
2624
let module_iter = mbi.modules().expect("Should provide modules");

integration-test/bins/multiboot2_payload/src/main.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ fn main(multiboot2_magic: u32, multiboot2_hdr: u32) -> anyhow::Result<()> {
2929
if multiboot2_magic != multiboot2::MAGIC {
3030
Err(anyhow::Error::msg("Invalid bootloader magic"))?
3131
}
32-
log::debug!("multiboot2_hdr={multiboot2_hdr:x?}, multiboot2_magic=0x{multiboot2_magic:x?}");
32+
log::debug!(
33+
"multiboot2_hdr=0x{multiboot2_hdr:08x?}, multiboot2_magic=0x{multiboot2_magic:08x?}"
34+
);
3335

3436
let mbi_ptr = (multiboot2_hdr as *const u8).cast();
3537
let mbi = unsafe { BootInformation::load(mbi_ptr) }.map_err(anyhow::Error::msg)?;

integration-test/bins/multiboot2_payload/src/multiboot2_header.S

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
.align 8
2222
.Lmb2_header_tag_information_request_start:
2323
.word 1 # type (16bit)
24-
.word 0 # flags (16bit)
24+
.word 1 # flags (16bit)
2525
.long .Lmb2_header_tag_information_request_end - .Lmb2_header_tag_information_request_start # size (32bit)
2626
.long 1
2727
.long 2

integration-test/bins/multiboot2_payload/src/verify/grub.rs renamed to integration-test/bins/multiboot2_payload/src/verify/limine.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!(bootloader_name.starts_with("GRUB 2."));
26+
assert!(bootloader_name.starts_with("Limine 7."));
2727
assert_eq!(cmdline, "some commandline arguments");
2828

2929
Ok(())

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

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mod chainloader;
2-
mod grub;
2+
mod limine;
33

44
use alloc::format;
55
use alloc::vec::Vec;
@@ -16,9 +16,9 @@ pub fn run(mbi: &BootInformation) -> anyhow::Result<()> {
1616
.name()
1717
.map_err(anyhow::Error::msg)?;
1818

19-
if bootloader.to_lowercase().contains("grub") {
20-
log::info!("loaded by grub");
21-
grub::run(mbi)?;
19+
if bootloader.to_lowercase().contains("limine") {
20+
log::info!("loaded by Limine");
21+
limine::run(mbi)?;
2222
} else {
2323
log::info!("loaded by chainloader");
2424
chainloader::run(mbi)?;
@@ -78,6 +78,15 @@ pub(self) fn print_module_info(mbi: &BootInformation) -> anyhow::Result<()> {
7878
}
7979
let module = modules.first().unwrap();
8080
let module_cmdline = module.cmdline().map_err(anyhow::Error::msg)?;
81+
82+
let allowed_module_cmdlines = ["Limine bootloader config", "multiboot2_payload"];
83+
assert!(
84+
allowed_module_cmdlines
85+
.iter()
86+
.any(|&str| module_cmdline == str),
87+
"The module cmdline must be one of {allowed_module_cmdlines:?} but is {module_cmdline}"
88+
);
89+
8190
println!("Modules:");
8291
println!(
8392
" 0x{:010x} - 0x{:010x} ({} B, cmdline='{}')",
@@ -86,13 +95,13 @@ pub(self) fn print_module_info(mbi: &BootInformation) -> anyhow::Result<()> {
8695
module.module_size(),
8796
module_cmdline
8897
);
89-
println!(" grub cfg passed as boot module:");
98+
println!(" bootloader cfg passed as boot module:");
9099
let grup_cfg_ptr = module.start_address() as *const u32 as *const u8;
91100
let grub_cfg =
92101
unsafe { core::slice::from_raw_parts(grup_cfg_ptr, module.module_size() as usize) };
93102

94-
// In the GRUB bootflow case, we pass the config as module with it. This is
95-
// not done for the chainloaded case.
103+
// In the Limine bootflow case, we pass the config as module with it. This
104+
// is not done for the chainloaded case.
96105
if let Ok(str) = core::str::from_utf8(grub_cfg) {
97106
println!("=== file begin ===");
98107
for line in str.lines() {

integration-test/run.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function fn_test_payload() {
141141
fn_build_limine_iso
142142

143143
fn_run_test_bios $TEST_DIR/image.iso
144-
fn_run_test_uefi $TEST_DIR/image.iso
144+
#fn_run_test_uefi $TEST_DIR/image.iso
145145
}
146146

147147
# Tests the loader by chainloading the Multiboot2 payload.
@@ -155,7 +155,7 @@ function fn_test_loader() {
155155
fn_build_limine_iso
156156

157157
fn_run_test_bios $TEST_DIR/image.iso
158-
fn_run_test_uefi $TEST_DIR/image.iso
158+
#fn_run_test_uefi $TEST_DIR/image.iso
159159
}
160160

161161
fn_main

integration-test/tests/01-boot-payload/limine.cfg

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ INTERFACE_BRANDING=integration-test
66
:integration-test
77
PROTOCOL=multiboot2
88
KERNEL_PATH=boot:///kernel
9-
KERNEL_CMDLINE=some kernel cmdline
9+
KERNEL_CMDLINE=some commandline arguments
10+
MODULE_PATH=boot:///limine.cfg
11+
MODULE_STRING=Limine bootloader config

integration-test/tests/02-boot-loader-and-chainload/limine.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ VERBOSE=yes
44
INTERFACE_BRANDING=integration-test
55

66
:integration-test
7-
# For legacy reasons, the loader itself boots via Multiboot 1. Sufficient.
7+
# For simplicity reasons, the loader itself boots via Multiboot 1. Sufficient.
88
PROTOCOL=multiboot
99
KERNEL_PATH=boot:///kernel
1010
KERNEL_CMDLINE=some kernel cmdline
1111
MODULE_PATH=boot:///payload
12-
KERNEL_CMDLINE=some payload cmdline
12+
MODULE_STRING=multiboot2_payload

0 commit comments

Comments
 (0)