Skip to content

Minor improvements to BootConfig #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 12, 2023
Merged
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
15 changes: 9 additions & 6 deletions common/config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@

use serde::{Deserialize, Serialize};

/// Configures the boot behavior of the bootloader.
#[derive(Serialize, Deserialize)]
#[serde(default)]
#[non_exhaustive]
pub struct BootConfig {
/// Configuration for the frame buffer that can be used by the kernel to display pixels
/// on the screen.
/// Configuration for the frame buffer setup.
pub frame_buffer: FrameBuffer,

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

/// Whether the bootloader should print log messages to the framebuffer when booting.
/// Whether the bootloader should print log messages to the framebuffer during boot.
///
/// Enabled by default.
pub frame_buffer_logging: bool,

/// Whether the bootloader should print log messages to the serial port when booting.
/// Whether the bootloader should print log messages to the serial port during boot.
///
/// Enabled by default.
pub serial_logging: bool,

#[doc(hidden)]
pub _test_sentinel: u64,
}

Expand Down
11 changes: 4 additions & 7 deletions tests/config_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ fn default_config() {

#[test]
fn custom_boot_config() {
let config = BootConfig {
frame_buffer: Default::default(),
log_level: Default::default(),
frame_buffer_logging: false,
serial_logging: true,
_test_sentinel: 0xb001b001b001,
};
let mut config = BootConfig::default();
config.frame_buffer_logging = false;
config.serial_logging = true;
config._test_sentinel = 0xb001b001b001;
run_test_kernel_internal(
env!("CARGO_BIN_FILE_TEST_KERNEL_CONFIG_FILE_custom_config"),
None,
Expand Down