rust-osdev / rust-osdev/bootloader

Hang during release build with UEFI

Open
#412 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
1.7k
Forks
240
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the hang with cargo b -r -vv using a globally shared target directory, then inspect build_uefi_bootloader and the cargo install bootloader-x86_64-uefi step described in the report. Compare it with an isolated temporary target directory. Done means the release build no longer hangs with the reported configuration, or the limitation is clearly documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.