Closed jschwe closed 4 years ago
The bootloader
dependency needs to be in the Cargo.toml of the executable, so for example in demo/Cargo.toml
if you want to build the rusty_demo
executable.
The problem you are seeing occurs because cargo build
builds all binaries in the project by default. In this situation, bootimage
tries to also create bootable disk images for all built binaries, but some of the binaries have no bootimage
dependency. (In the error message you posted, you see that bootimage
successfully created the bootable disk image for the rusty_demo
binary but failed afterwards when it tried to created the bootable disk image for the next binary. We should definitely improve the error message to make this more clear.)
To fix this problem, either add a bootimage
dependency to all your binaries in the workspace if you want to build them all with bootimage
. Alternatively, try building from the subdirectory of an executable or specifying a single executable to build by passing e.g. --bin rusty_demo
.
Thanks a lot, that was very helpful!
I'm currently trying to build rusty-hermit with bootimage in order to use your bootloader and custom test framework. However I can't seem to figure out where to place the dependency for bootloader. In rusty-hermit the library containing the kernel libhermit-rs is built via a build script, since the application and the kernel are built with different targets. The library is then linked with the application.
Where exactly does bootimage expect the bootloader dependency? The Top level Cargo.toml is just a workspace, which also leads to
WARNING: There is no root package to read the cargo-xbuild config from.
Also do I need to modify the build script to use cargo-xbuild ? I'm not sure if I'm doing something wrong in that regard but it doesn't seem to make a difference whether I use xbuild or build in the build script for the kernel. In both cases I have to pass "-Z build-std=core,alloc"I tried:
bootloader = "0.9.2"
in every singleCargo.toml
file (except for the workspace one). For the 2015 edition crates I also addedextern crate bootloader;
to the lib.rs file. I rancargo bootimage --target x86_64-unknown-hermit -Z build-std=std,core,alloc,panic_abort
Error
~/Dev/rusty-hermit$ KERNEL=target/x86_64-unknown-hermit/debug/rusty_demo KERNEL_MANIFEST=libhermit-rs/Cargo.toml cargo xbuild --release --features binary --target x86_64-unknown-hermit-kernel
. Here rusty_demo is the Kernel linked together with a demo application. The error iserror: --features is not allowed in the root of a virtual workspace
.error: Package `rusty_demo v0.1.0 (/home/xxx/Dev/rusty-hermit/demo)` does not have these features: `binary`
.Do you have any ideas / hints on what I could do or look at to get this running?