Skip to content

Commit 5a24373

Browse files
authored
Merge pull request #349 from rust-osdev/boot-config-improvements
Minor improvements to `BootConfig`
2 parents 5f4677b + 715970b commit 5a24373

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

common/config/src/lib.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,30 @@
22

33
use serde::{Deserialize, Serialize};
44

5+
/// Configures the boot behavior of the bootloader.
56
#[derive(Serialize, Deserialize)]
67
#[serde(default)]
8+
#[non_exhaustive]
79
pub struct BootConfig {
8-
/// Configuration for the frame buffer that can be used by the kernel to display pixels
9-
/// on the screen.
10+
/// Configuration for the frame buffer setup.
1011
pub frame_buffer: FrameBuffer,
1112

12-
/// Configuration for changing the level of the filter of the messages that are shown in the
13-
/// screen when booting. The default is 'Trace'.
13+
/// The minimum log level that is printed to the screen during boot.
14+
///
15+
/// The default is [`LevelFilter::Trace`].
1416
pub log_level: LevelFilter,
1517

16-
/// Whether the bootloader should print log messages to the framebuffer when booting.
18+
/// Whether the bootloader should print log messages to the framebuffer during boot.
1719
///
1820
/// Enabled by default.
1921
pub frame_buffer_logging: bool,
2022

21-
/// Whether the bootloader should print log messages to the serial port when booting.
23+
/// Whether the bootloader should print log messages to the serial port during boot.
2224
///
2325
/// Enabled by default.
2426
pub serial_logging: bool,
2527

28+
#[doc(hidden)]
2629
pub _test_sentinel: u64,
2730
}
2831

tests/config_file.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ fn default_config() {
1313

1414
#[test]
1515
fn custom_boot_config() {
16-
let config = BootConfig {
17-
frame_buffer: Default::default(),
18-
log_level: Default::default(),
19-
frame_buffer_logging: false,
20-
serial_logging: true,
21-
_test_sentinel: 0xb001b001b001,
22-
};
16+
let mut config = BootConfig::default();
17+
config.frame_buffer_logging = false;
18+
config.serial_logging = true;
19+
config._test_sentinel = 0xb001b001b001;
2320
run_test_kernel_internal(
2421
env!("CARGO_BIN_FILE_TEST_KERNEL_CONFIG_FILE_custom_config"),
2522
None,

0 commit comments

Comments
 (0)