rust-osdev / rust-osdev/bootimage

Failing to find bootloader dependency when it's conditionally included

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

Nobody has claimed this yet.

Dominant language
Rust
Stars
906
Forks
70
PR merge metrics
No merged PRs in 30d

Description

I'm writing a kernel that runs on both the Raspberry Pi 3 and x86_64. I'm trying to use bootloader+bootimage exclusively for the x86_64 version, but not any other architecture. As a result, my Cargo.toml looks like this:

[dependencies]
# common, architecture-independent dependencies

[target.'cfg(target_arch = "x86_64")'.dependencies]
bootloader = "^0.9.8"

When I compile this project with cargo bootimage --target targets/x86_64-unknown-none-softfloat.json --release I get this error message:

Error: An error occured while trying to build the bootloader: Could not find required key `packages[name = `bootloader`` in cargo metadata output

However, if I change the bootloader dependency to not be conditional, i.e. if I just put it in the [dependencies] section, the above error goes away and the project boots perfectly.

Is there some extra configuration I need to do to make this work? It would be nice for me to be able to completely exclude the bootloader dependency off of x86.

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 failure using the Cargo.toml target-specific dependency and cargo bootimage --target targets/x86_64-unknown-none-softfloat.json --release. Start by tracing how the bootimage command obtains Cargo metadata and locates the bootloader package. Done means the conditional bootloader dependency is found for x86_64 and the image builds without requiring it for other architectures.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.