Skip to content

Commit 3f4f594

Browse files
committed
Revert "Merge pull request rust-osdev#304 from AlexJMohr/cargo-features"
This reverts commit 5e42ad0, reversing changes made to 94c71d5.
1 parent 5e42ad0 commit 3f4f594

File tree

11 files changed

+185
-235
lines changed

11 files changed

+185
-235
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ jobs:
6262
- name: Run integration tests
6363
run: cargo test
6464

65-
# test feature gates (only on one OS is enough)
66-
- name: Test with only UEFI feature
67-
if: runner.os == 'Linux'
68-
run: cargo test --no-default-features --features uefi
69-
- name: Test with only BIOS feature
70-
if: runner.os == 'Linux'
71-
run: cargo test --no-default-features --features bios
72-
7365
fmt:
7466
name: Check Formatting
7567
runs-on: ubuntu-latest

Cargo.toml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,12 @@ bootloader_api = { version = "0.11.0", path = "api" }
3737
bootloader-x86_64-common = { version = "0.11.0", path = "common" }
3838
bootloader-x86_64-bios-common = { version = "0.11.0", path = "bios/common" }
3939

40-
[features]
41-
default = ["bios", "uefi"]
42-
bios = ["dep:mbrman", "bootloader_test_runner/bios"]
43-
uefi = ["dep:gpt", "bootloader_test_runner/uefi"]
44-
4540
[dependencies]
4641
anyhow = "1.0.32"
4742
fatfs = "0.3.4"
43+
gpt = "3.0.0"
44+
mbrman = "0.5.1"
4845
tempfile = "3.3.0"
49-
mbrman = { version = "0.5.1", optional = true }
50-
gpt = { version = "3.0.0", optional = true }
5146

5247
[dev-dependencies]
5348
bootloader_test_runner = { path = "tests/runner" }

build.rs

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,47 @@ use std::{
33
process::Command,
44
};
55

6-
const BOOTLOADER_VERSION: &str = env!("CARGO_PKG_VERSION");
6+
const BOOTLOADER_X86_64_UEFI_VERSION: &str = env!("CARGO_PKG_VERSION");
7+
8+
const BOOTLOADER_X86_64_BIOS_BOOT_SECTOR_VERSION: &str = env!("CARGO_PKG_VERSION");
9+
const BOOTLOADER_X86_64_BIOS_STAGE_2_VERSION: &str = env!("CARGO_PKG_VERSION");
10+
const BOOTLOADER_X86_64_BIOS_STAGE_3_VERSION: &str = env!("CARGO_PKG_VERSION");
11+
const BOOTLOADER_X86_64_BIOS_STAGE_4_VERSION: &str = env!("CARGO_PKG_VERSION");
712

813
fn main() {
914
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
1015

11-
#[cfg(feature = "uefi")]
12-
{
13-
let uefi_path = build_uefi_bootloader(&out_dir);
14-
println!(
15-
"cargo:rustc-env=UEFI_BOOTLOADER_PATH={}",
16-
uefi_path.display()
17-
);
18-
}
16+
let uefi_path = build_uefi_bootloader(&out_dir);
17+
println!(
18+
"cargo:rustc-env=UEFI_BOOTLOADER_PATH={}",
19+
uefi_path.display()
20+
);
1921

20-
#[cfg(feature = "bios")]
21-
{
22-
let bios_boot_sector_path = build_bios_boot_sector(&out_dir);
23-
println!(
24-
"cargo:rustc-env=BIOS_BOOT_SECTOR_PATH={}",
25-
bios_boot_sector_path.display()
26-
);
27-
let bios_stage_2_path = build_bios_stage_2(&out_dir);
28-
println!(
29-
"cargo:rustc-env=BIOS_STAGE_2_PATH={}",
30-
bios_stage_2_path.display()
31-
);
22+
let bios_boot_sector_path = build_bios_boot_sector(&out_dir);
23+
println!(
24+
"cargo:rustc-env=BIOS_BOOT_SECTOR_PATH={}",
25+
bios_boot_sector_path.display()
26+
);
27+
let bios_stage_2_path = build_bios_stage_2(&out_dir);
28+
println!(
29+
"cargo:rustc-env=BIOS_STAGE_2_PATH={}",
30+
bios_stage_2_path.display()
31+
);
3232

33-
let bios_stage_3_path = build_bios_stage_3(&out_dir);
34-
println!(
35-
"cargo:rustc-env=BIOS_STAGE_3_PATH={}",
36-
bios_stage_3_path.display()
37-
);
33+
let bios_stage_3_path = build_bios_stage_3(&out_dir);
34+
println!(
35+
"cargo:rustc-env=BIOS_STAGE_3_PATH={}",
36+
bios_stage_3_path.display()
37+
);
3838

39-
let bios_stage_4_path = build_bios_stage_4(&out_dir);
40-
println!(
41-
"cargo:rustc-env=BIOS_STAGE_4_PATH={}",
42-
bios_stage_4_path.display()
43-
);
44-
}
39+
let bios_stage_4_path = build_bios_stage_4(&out_dir);
40+
println!(
41+
"cargo:rustc-env=BIOS_STAGE_4_PATH={}",
42+
bios_stage_4_path.display()
43+
);
4544
}
4645

4746
#[cfg(not(docsrs_dummy_build))]
48-
#[cfg(feature = "uefi")]
4947
fn build_uefi_bootloader(out_dir: &Path) -> PathBuf {
5048
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());
5149
let mut cmd = Command::new(cargo);
@@ -55,7 +53,7 @@ fn build_uefi_bootloader(out_dir: &Path) -> PathBuf {
5553
cmd.arg("--path").arg("uefi");
5654
println!("cargo:rerun-if-changed=uefi");
5755
} else {
58-
cmd.arg("--version").arg(BOOTLOADER_VERSION);
56+
cmd.arg("--version").arg(BOOTLOADER_X86_64_UEFI_VERSION);
5957
}
6058
cmd.arg("--locked");
6159
cmd.arg("--target").arg("x86_64-unknown-uefi");
@@ -80,7 +78,6 @@ fn build_uefi_bootloader(out_dir: &Path) -> PathBuf {
8078
}
8179

8280
#[cfg(not(docsrs_dummy_build))]
83-
#[cfg(feature = "bios")]
8481
fn build_bios_boot_sector(out_dir: &Path) -> PathBuf {
8582
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());
8683
let mut cmd = Command::new(cargo);
@@ -93,7 +90,8 @@ fn build_bios_boot_sector(out_dir: &Path) -> PathBuf {
9390
cmd.arg("--path").arg(&local_path);
9491
println!("cargo:rerun-if-changed={}", local_path.display());
9592
} else {
96-
cmd.arg("--version").arg(BOOTLOADER_VERSION);
93+
cmd.arg("--version")
94+
.arg(BOOTLOADER_X86_64_BIOS_BOOT_SECTOR_VERSION);
9795
}
9896
cmd.arg("--locked");
9997
cmd.arg("--target").arg("i386-code16-boot-sector.json");
@@ -123,7 +121,6 @@ fn build_bios_boot_sector(out_dir: &Path) -> PathBuf {
123121
}
124122

125123
#[cfg(not(docsrs_dummy_build))]
126-
#[cfg(feature = "bios")]
127124
fn build_bios_stage_2(out_dir: &Path) -> PathBuf {
128125
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());
129126
let mut cmd = Command::new(cargo);
@@ -136,7 +133,8 @@ fn build_bios_stage_2(out_dir: &Path) -> PathBuf {
136133
cmd.arg("--path").arg(&local_path);
137134
println!("cargo:rerun-if-changed={}", local_path.display());
138135
} else {
139-
cmd.arg("--version").arg(BOOTLOADER_VERSION);
136+
cmd.arg("--version")
137+
.arg(BOOTLOADER_X86_64_BIOS_STAGE_2_VERSION);
140138
}
141139
cmd.arg("--locked");
142140
cmd.arg("--target").arg("i386-code16-stage-2.json");
@@ -164,7 +162,6 @@ fn build_bios_stage_2(out_dir: &Path) -> PathBuf {
164162
}
165163

166164
#[cfg(not(docsrs_dummy_build))]
167-
#[cfg(feature = "bios")]
168165
fn build_bios_stage_3(out_dir: &Path) -> PathBuf {
169166
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());
170167
let mut cmd = Command::new(cargo);
@@ -177,7 +174,8 @@ fn build_bios_stage_3(out_dir: &Path) -> PathBuf {
177174
cmd.arg("--path").arg(&local_path);
178175
println!("cargo:rerun-if-changed={}", local_path.display());
179176
} else {
180-
cmd.arg("--version").arg(BOOTLOADER_VERSION);
177+
cmd.arg("--version")
178+
.arg(BOOTLOADER_X86_64_BIOS_STAGE_3_VERSION);
181179
}
182180
cmd.arg("--locked");
183181
cmd.arg("--target").arg("i686-stage-3.json");
@@ -205,7 +203,6 @@ fn build_bios_stage_3(out_dir: &Path) -> PathBuf {
205203
}
206204

207205
#[cfg(not(docsrs_dummy_build))]
208-
#[cfg(feature = "bios")]
209206
fn build_bios_stage_4(out_dir: &Path) -> PathBuf {
210207
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".into());
211208
let mut cmd = Command::new(cargo);
@@ -218,7 +215,8 @@ fn build_bios_stage_4(out_dir: &Path) -> PathBuf {
218215
cmd.arg("--path").arg(&local_path);
219216
println!("cargo:rerun-if-changed={}", local_path.display());
220217
} else {
221-
cmd.arg("--version").arg(BOOTLOADER_VERSION);
218+
cmd.arg("--version")
219+
.arg(BOOTLOADER_X86_64_BIOS_STAGE_4_VERSION);
222220
}
223221
cmd.arg("--locked");
224222
cmd.arg("--target").arg("x86_64-stage-4.json");
@@ -246,7 +244,6 @@ fn build_bios_stage_4(out_dir: &Path) -> PathBuf {
246244
convert_elf_to_bin(elf_path)
247245
}
248246

249-
#[cfg(feature = "bios")]
250247
fn convert_elf_to_bin(elf_path: PathBuf) -> PathBuf {
251248
let flat_binary_path = elf_path.with_extension("bin");
252249

src/bios/mod.rs

Lines changed: 0 additions & 67 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)