rust-osdev / bootloader

An experimental pure-Rust x86 bootloader
Apache License 2.0
1.39k stars 212 forks source link

Hang during release build with UEFI #412

Open fmckeogh opened 9 months ago

fmckeogh commented 9 months ago

Running cargo b -r -vv produces the following output where it hangs (seemingly indefinitely) at zero CPU usage:

[bootloader 0.11.5] warning: `bootloader-x86_64-bios-stage-2` (bin "bootloader-x86_64-bios-stage-2") generated 2 warnings
[bootloader 0.11.5]     Finished stage-2 [optimized] target(s) in 1.51s
[bootloader 0.11.5]    Replacing /home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin/bootloader-x86_64-bios-stage-2
[bootloader 0.11.5]     Replaced package `bootloader-x86_64-bios-stage-2 v0.11.5 (/tmp/bootloader/bios/stage-2)` with `bootloader-x86_64-bios-stage-2 v0.11.5 (/tmp/bootloader/bios/stage-2)` (executable `bootloader-x86_64-bios-stage-2`)
[bootloader 0.11.5] warning: be sure to add `/home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin` to your PATH to be able to run the installed binaries
[bootloader 0.11.5]     Finished stage-3 [optimized + debuginfo] target(s) in 1.52s
[bootloader 0.11.5]    Replacing /home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin/bootloader-x86_64-bios-stage-3
[bootloader 0.11.5]     Replaced package `bootloader-x86_64-bios-stage-3 v0.11.5 (/tmp/bootloader/bios/stage-3)` with `bootloader-x86_64-bios-stage-3 v0.11.5 (/tmp/bootloader/bios/stage-3)` (executable `bootloader-x86_64-bios-stage-3`)
[bootloader 0.11.5] warning: be sure to add `/home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin` to your PATH to be able to run the installed binaries
[bootloader 0.11.5]     Finished stage-4 [optimized + debuginfo] target(s) in 1.52s
[bootloader 0.11.5]    Replacing /home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin/bootloader-x86_64-bios-stage-4
[bootloader 0.11.5]     Replaced package `bootloader-x86_64-bios-stage-4 v0.11.5 (/tmp/bootloader/bios/stage-4)` with `bootloader-x86_64-bios-stage-4 v0.11.5 (/tmp/bootloader/bios/stage-4)` (executable `bootloader-x86_64-bios-stage-4`)
[bootloader 0.11.5] warning: be sure to add `/home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin` to your PATH to be able to run the installed binaries
[bootloader 0.11.5] cargo:rustc-env=BIOS_BOOT_SECTOR_PATH=/home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin/bootloader-x86_64-bios-boot-sector.bin
[bootloader 0.11.5] cargo:rustc-env=BIOS_STAGE_2_PATH=/home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin/bootloader-x86_64-bios-stage-2.bin
[bootloader 0.11.5] cargo:rustc-env=BIOS_STAGE_3_PATH=/home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin/bootloader-x86_64-bios-stage-3.bin
[bootloader 0.11.5] cargo:rustc-env=BIOS_STAGE_4_PATH=/home/fm208/.cargo/target/release/build/bootloader-ad4dca68f01168c6/out/bin/bootloader-x86_64-bios-stage-4.bin
    Building [=======================> ] 133/135: bootloader(build)    

I believe this is cargo install boot loader-x86_64-uefi hanging in build_uefi_bootloader due to my usage of a globally shared target-dir set in ~/.cargo/config.toml.

I can fix this by creating a temporary directory and overriding the target directory to use that, or override the target directory to create one in the root of the bootloader directory, or some other place. Also happy to close this as a WONTFIX, but I know quite a few people use a global directory to avoid large build directories cluttering their drive in different locations.