Skip to content

Commit eb6d71f

Browse files
committed
Start integrating BIOS bootloader into build system
We can use an artifact dependency on the outer level since the x86_64-unknown-none target is Tier 2 and thus requires no -Zbuild-std. For the boot_sector, we need to compile with a specific linker script and profile. We might need to duplicate the profile settings in the boot_sector Cargo.toml when publishing.
1 parent 0b8f95d commit eb6d71f

19 files changed

+355
-103
lines changed

Cargo.lock

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ members = [
1515
"common",
1616
"uefi",
1717
"bios",
18-
"bios/first_stage",
18+
"bios/boot_sector",
1919
"tests/runner",
2020
"tests/test_kernels/default_settings",
2121
"tests/test_kernels/map_phys_mem",
@@ -30,20 +30,19 @@ anyhow = "1.0.32"
3030
fatfs = "0.3.4"
3131
gpt = "3.0.0"
3232

33+
[dependencies.bootloader-x86_64-bios]
34+
version = "0.1.0-alpha.0"
35+
path = "bios"
36+
artifact = ["bin"]
37+
target = "x86_64-unknown-none"
38+
3339
[dev-dependencies]
3440
bootloader_test_runner = { path = "tests/runner" }
3541
test_kernel_default_settings = { path = "tests/test_kernels/default_settings", artifact = "bin", target = "x86_64-unknown-none" }
3642
test_kernel_higher_half = { path = "tests/test_kernels/higher_half", artifact = "bin", target = "x86_64-unknown-none" }
3743
test_kernel_map_phys_mem = { path = "tests/test_kernels/map_phys_mem", artifact = "bin", target = "x86_64-unknown-none" }
3844
test_kernel_pie = { path = "tests/test_kernels/pie", artifact = "bin", target = "x86_64-unknown-none" }
3945

40-
# [dependencies.bootloader-x86_64-uefi]
41-
# version = "0.1.0"
42-
# path = "uefi"
43-
# artifact = ["bin"]
44-
# target = "x86_64-unknown-uefi"
45-
46-
4746
[profile.dev]
4847
panic = "abort"
4948

bios/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "bootloader-x86_64-bios"
3-
version = "0.1.0"
3+
version = "0.1.0-alpha.0"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
File renamed without changes.
File renamed without changes.

bios/first_stage/Cargo.toml renamed to bios/boot_sector/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "bootloader_first_stage"
2+
name = "bootloader-x86_64-bios-boot-sector"
33
version = "0.1.0"
44
authors = ["Philipp Oppermann <[email protected]>"]
55
edition = "2021"
File renamed without changes.

bios/boot_sector/build.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use std::path::Path;
2+
3+
fn main() {
4+
let local_path = Path::new(env!("CARGO_MANIFEST_DIR"));
5+
println!(
6+
"cargo:rustc-link-arg-bins=--script={}",
7+
local_path.join("16-bit-linker.ld").display()
8+
)
9+
}
File renamed without changes.

0 commit comments

Comments
 (0)