From 7212b3db88b07a752f19beb6fa0145c9b4998907 Mon Sep 17 00:00:00 2001 From: nokosaaan Date: Tue, 17 Mar 2026 15:56:46 +0900 Subject: [PATCH 1/4] fix: bootloader settings Signed-off-by: nokosaaan --- Makefile | 4 ++-- mdbook/book.toml | 1 - userland/Cargo.toml | 2 +- x86bootdisk/Cargo.toml | 7 ++++++- x86bootdisk/src/main.rs | 26 +++++++++++++++++++++++--- 5 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index cf0f49e35..a6ac1121a 100644 --- a/Makefile +++ b/Makefile @@ -147,10 +147,10 @@ kernel-x86_64.elf: $(X86ASM) FORCE python3 scripts/embed_debug_info.py $@ x86_64_boot.img: kernel-x86_64.elf - RUSTFLAGS="$(RUSTC_MISC_ARGS)" cargo +$(RUSTV) run --release --package x86bootdisk -- --kernel $< --output $@ + RUSTFLAGS="$(RUSTC_MISC_ARGS)" cargo +$(RUSTV) run --release --package x86bootdisk --no-default-features --features bios -- --kernel $< --output $@ x86_64_uefi.img: kernel-x86_64.elf - RUSTFLAGS="$(RUSTC_MISC_ARGS)" cargo +$(RUSTV) run --release --package x86bootdisk -- --kernel $< --output $@ --pxe x86_64_uefi_pxe_boot --boot-type uefi + RUSTFLAGS="$(RUSTC_MISC_ARGS)" cargo +$(RUSTV) run --release --package x86bootdisk --no-default-features --features uefi -- --kernel $< --output $@ --pxe x86_64_uefi_pxe_boot --boot-type uefi $(X86ASM): FORCE $(MAKE) -C $@ diff --git a/mdbook/book.toml b/mdbook/book.toml index 8f5c1c4a3..4bf31f613 100644 --- a/mdbook/book.toml +++ b/mdbook/book.toml @@ -1,7 +1,6 @@ [book] authors = ["Yuuki Takano"] language = "en" -multilingual = false src = "src" title = "Awkernel" diff --git a/userland/Cargo.toml b/userland/Cargo.toml index 664ec35f3..ab94f86dc 100644 --- a/userland/Cargo.toml +++ b/userland/Cargo.toml @@ -75,7 +75,7 @@ path = "../applications/tests/test_voluntary_preemption" optional = true [features] -default = [] +default = ["test_dag"] perf = ["awkernel_services/perf"] # Evaluation applications diff --git a/x86bootdisk/Cargo.toml b/x86bootdisk/Cargo.toml index 563cbb660..49afc75ae 100644 --- a/x86bootdisk/Cargo.toml +++ b/x86bootdisk/Cargo.toml @@ -5,8 +5,13 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = ["bios", "uefi"] +bios = ["bootloader/bios"] +uefi = ["bootloader/uefi"] + [dependencies] -bootloader = "0.11" +bootloader = { version = "0.11", default-features = false } ovmf-prebuilt = "0.2" clap = { version = "4.2", features = ["derive"] } home = "0.5" diff --git a/x86bootdisk/src/main.rs b/x86bootdisk/src/main.rs index 5098d11d3..03d87bc4f 100644 --- a/x86bootdisk/src/main.rs +++ b/x86bootdisk/src/main.rs @@ -1,14 +1,32 @@ -use bootloader::{BiosBoot, UefiBoot}; use clap::Parser; use ovmf_prebuilt::{Prebuilt, Source}; use std::{fs::File, io::Write, path::Path}; +#[cfg(feature = "bios")] +use bootloader::BiosBoot; +#[cfg(feature = "uefi")] +use bootloader::UefiBoot; + #[derive(Debug, clap::ValueEnum, Clone)] enum BootType { + #[cfg(feature = "uefi")] Uefi, + #[cfg(feature = "bios")] Bios, } +impl Default for BootType { + #[cfg(feature = "bios")] + fn default() -> Self { + Self::Bios + } + + #[cfg(all(not(feature = "bios"), feature = "uefi"))] + fn default() -> Self { + Self::Uefi + } +} + /// Simple program to greet a person #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] @@ -26,7 +44,7 @@ struct Args { pxe: String, /// uefi or bios. - #[arg(value_enum, long, default_value_t = BootType::Bios)] + #[arg(value_enum, long, default_value_t = BootType::default())] boot_type: BootType, } @@ -38,6 +56,7 @@ fn main() { let pxe_path = Path::new(&args.pxe); match args.boot_type { + #[cfg(feature = "uefi")] BootType::Uefi => { let uefi = UefiBoot::new(kernel_path); uefi.create_disk_image(output_path).unwrap(); @@ -61,6 +80,7 @@ fn main() { output_path.display() ) } + #[cfg(feature = "bios")] BootType::Bios => { BiosBoot::new(kernel_path) .create_disk_image(output_path) @@ -71,4 +91,4 @@ fn main() { ) } } -} +} \ No newline at end of file From bc02e1d56490200b614338dbeaf2ad9dea0ed042 Mon Sep 17 00:00:00 2001 From: nokosaaan Date: Tue, 7 Apr 2026 14:25:43 +0900 Subject: [PATCH 2/4] fix: reset userland features Signed-off-by: nokosaaan --- userland/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userland/Cargo.toml b/userland/Cargo.toml index ab94f86dc..664ec35f3 100644 --- a/userland/Cargo.toml +++ b/userland/Cargo.toml @@ -75,7 +75,7 @@ path = "../applications/tests/test_voluntary_preemption" optional = true [features] -default = ["test_dag"] +default = [] perf = ["awkernel_services/perf"] # Evaluation applications From 884183937ecf23f854a56903a188d7ce7a247ff8 Mon Sep 17 00:00:00 2001 From: nokosaaan Date: Tue, 7 Apr 2026 15:01:35 +0900 Subject: [PATCH 3/4] fix: line break Signed-off-by: nokosaaan --- x86bootdisk/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x86bootdisk/src/main.rs b/x86bootdisk/src/main.rs index 03d87bc4f..d03aecedf 100644 --- a/x86bootdisk/src/main.rs +++ b/x86bootdisk/src/main.rs @@ -91,4 +91,4 @@ fn main() { ) } } -} \ No newline at end of file +} From d69ffdc71b2b282e5bca483fb45be836b0cd0b7b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 7 Apr 2026 06:16:54 +0000 Subject: [PATCH 4/4] fix: add compile_error guard when neither bios nor uefi feature is enabled Agent-Logs-Url: https://github.com/tier4/awkernel/sessions/ee6a4be0-5fde-4c35-98e0-5c7ccceb9941 Co-authored-by: nokosaaan <106376734+nokosaaan@users.noreply.github.com> --- x86bootdisk/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x86bootdisk/src/main.rs b/x86bootdisk/src/main.rs index d03aecedf..37a3899df 100644 --- a/x86bootdisk/src/main.rs +++ b/x86bootdisk/src/main.rs @@ -2,6 +2,9 @@ use clap::Parser; use ovmf_prebuilt::{Prebuilt, Source}; use std::{fs::File, io::Write, path::Path}; +#[cfg(not(any(feature = "bios", feature = "uefi")))] +compile_error!("At least one of the `bios` or `uefi` features must be enabled."); + #[cfg(feature = "bios")] use bootloader::BiosBoot; #[cfg(feature = "uefi")]