From 318b60e9bd86659a833f185f5de328c0ddde09ad Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Tue, 30 Apr 2024 13:52:20 +0200 Subject: [PATCH] Replace `cargo xbuild` calls with `cargo build -Zbuild-std=core` --- .github/workflows/build.yml | 11 ++++------- README.md | 10 +++++----- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 847e27d8..b5ef0f5b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,17 +36,16 @@ jobs: - name: "Install Rustup Components" run: rustup component add rust-src llvm-tools-preview - - name: "Install cargo-xbuild" - run: cargo install cargo-xbuild --debug + - name: "Install cargo-binutils" run: cargo install cargo-binutils --version 0.1.7 --debug - - run: cargo xbuild + - run: cargo build -Zbuild-std=core working-directory: test-kernel name: 'Build Test Kernel' - name: 'Build Bootloader' - run: cargo xbuild --bin bootloader --features binary --release + run: cargo build -Zbuild-std=core --bin bootloader --features binary --release env: KERNEL: "test-kernel/target/x86_64-test-kernel/debug/test-kernel" KERNEL_MANIFEST: "test-kernel/Cargo.toml" @@ -96,10 +95,8 @@ jobs: - uses: actions/checkout@v1 - name: "Install Rustup Components" run: rustup component add rust-src llvm-tools-preview - - name: "Install cargo-xbuild" - run: cargo install cargo-xbuild --debug - name: 'Build Example Kernel' - run: cargo xbuild + run: cargo build -Zbuild-std=core working-directory: example-kernel diff --git a/README.md b/README.md index 5a5db560..945efcc3 100644 --- a/README.md +++ b/README.md @@ -108,28 +108,28 @@ Note that the addresses **must** be given as strings (in either hex or decimal f ## Requirements -You need a nightly [Rust](https://www.rust-lang.org) compiler and [cargo xbuild](https://github.com/rust-osdev/cargo-xbuild). You also need the `llvm-tools-preview` component, which can be installed through `rustup component add llvm-tools-preview`. +You need a nightly [Rust](https://www.rust-lang.org) compiler. You also need the `llvm-tools-preview` component, which can be installed through `rustup component add llvm-tools-preview`. ## Build The simplest way to use the bootloader is in combination with the [bootimage](https://github.com/rust-osdev/bootimage) tool. This crate **requires at least bootimage 0.7.7**. With the tool installed, you can add a normal cargo dependency on the `bootloader` crate to your kernel and then run `bootimage build` to create a bootable disk image. You can also execute `bootimage run` to run your kernel in [QEMU](https://www.qemu.org/) (needs to be installed). -To compile the bootloader manually, you need to invoke `cargo xbuild` with two environment variables: +To compile the bootloader manually, you need to invoke `cargo build -Zbuild-std=core` with two environment variables: * `KERNEL`: points to your kernel executable (in the ELF format) * `KERNEL_MANIFEST`: points to the `Cargo.toml` describing your kernel For example: ``` -KERNEL=/path/to/your/kernel/target/debug/your_kernel KERNEL_MANIFEST=/path/to/your/kernel/Cargo.toml cargo xbuild +KERNEL=/path/to/your/kernel/target/debug/your_kernel KERNEL_MANIFEST=/path/to/your/kernel/Cargo.toml cargo build -Zbuild-std=core ``` As an example, you can build the bootloader with example kernel from the `example-kernel` directory with the following commands: ``` cd example-kernel -cargo xbuild +cargo build -Zbuild-std=core cd .. -KERNEL=example-kernel/target/x86_64-example-kernel/debug/example-kernel KERNEL_MANIFEST=example-kernel/Cargo.toml cargo xbuild --release --features binary +KERNEL=example-kernel/target/x86_64-example-kernel/debug/example-kernel KERNEL_MANIFEST=example-kernel/Cargo.toml cargo build -Zbuild-std=core --release --features binary ``` The `binary` feature is required to enable the dependencies required for compiling the bootloader executable. The command results in a bootloader executable at `target/x86_64-bootloader.json/release/bootloader`. This executable is still an ELF file, which can't be run directly.