Skip to content

Commit f5a89b0

Browse files
authored
Merge pull request #63 from rust-osdev/build-with-cargo-build
Make `cargo bootimage` use `cargo build` instead of `cargo xbuild`
2 parents c4c9b93 + b3aaf4f commit f5a89b0

File tree

15 files changed

+108
-75
lines changed

15 files changed

+108
-75
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ jobs:
6262

6363
- name: "Install Rustup Components"
6464
run: rustup component add rust-src llvm-tools-preview
65-
- name: "Install cargo-xbuild"
66-
run: cargo install cargo-xbuild --debug
6765

6866
# install QEMU
6967
- name: Install QEMU (Linux)
@@ -103,20 +101,20 @@ jobs:
103101
shell: bash {0}
104102
working-directory: example-kernels
105103

106-
- name: 'Run `cargo xrun` for "runner" kernel'
104+
- name: 'Run `cargo run` for "runner" kernel'
107105
run: |
108-
cargo xrun
106+
cargo run
109107
if [ $? -eq 109 ]; then (exit 0); else (exit 1); fi
110108
shell: bash {0}
111109
working-directory: example-kernels/runner
112110

113-
- run: cargo xtest
111+
- run: cargo test
114112
working-directory: example-kernels/runner-test
115-
name: 'Run `cargo xtest` for "runner-test" kernel'
113+
name: 'Run `cargo test` for "runner-test" kernel'
116114

117-
- run: cargo xtest -Z doctest-xcompile
115+
- run: cargo test -Z doctest-xcompile
118116
working-directory: example-kernels/runner-doctest
119-
name: 'Run `cargo xtest -Z doctest-xcompile` for "runner-doctest" kernel'
117+
name: 'Run `cargo test -Z doctest-xcompile` for "runner-doctest" kernel'
120118

121119
check_formatting:
122120
name: "Check Formatting"

Readme.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Now you can build the kernel project and create a bootable disk image from it by
3131
cargo bootimage --target your_custom_target.json [other_args]
3232
```
3333

34-
The command will invoke [`cargo xbuild`](https://github.com/rust-osdev/cargo-xbuild), forwarding all passed options. Then it will build the specified bootloader together with the kernel to create a bootable disk image.
34+
The command will invoke `cargo build`, forwarding all passed options. Then it will build the specified bootloader together with the kernel to create a bootable disk image.
3535

3636
### Running
3737

@@ -60,6 +60,10 @@ Configuration is done through a through a `[package.metadata.bootimage]` table i
6060

6161
```toml
6262
[package.metadata.bootimage]
63+
# The cargo subcommand that will be used for building the kernel.
64+
#
65+
# For building using the `cargo-xbuild` crate, set this to `xbuild`.
66+
build-command = ["build"]
6367
# The command invoked with the created bootimage (the "{}" will be replaced
6468
# with the path to the bootable disk image)
6569
# Applies to `bootimage run` and `bootimage runner`

example-kernels/.cargo/config.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[unstable]
2+
build-std = ["core", "compiler_builtins"]

example-kernels/Cargo.lock

Lines changed: 15 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example-kernels/basic/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ authors = ["Philipp Oppermann <dev@phil-opp.com>"]
55
edition = "2018"
66

77
[dependencies]
8-
bootloader = "0.9.3"
8+
bootloader = "0.9.7"
99
x86_64 = "0.11.0"

example-kernels/runner-doctest/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ authors = ["Philipp Oppermann <dev@phil-opp.com>"]
55
edition = "2018"
66

77
[dependencies]
8-
bootloader = "0.9.3"
8+
bootloader = "0.9.7"
99
x86_64 = "0.11.0"
10+
rlibc = "1.0.0"
1011

1112
[package.metadata.bootimage]
1213
test-success-exit-code = 33 # (0x10 << 1) | 1

example-kernels/runner-doctest/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#![test_runner(crate::test_runner)]
55
#![reexport_test_harness_main = "test_main"]
66

7+
extern crate rlibc;
8+
79
/// add two numbers
810
///
911
/// ```

example-kernels/runner-test/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ name = "no-harness"
99
harness = false
1010

1111
[dependencies]
12-
bootloader = "0.9.3"
12+
bootloader = "0.9.7"
1313
x86_64 = "0.11.0"
14+
rlibc = "1.0.0"
1415

1516
[package.metadata.bootimage]
1617
test-success-exit-code = 33 # (0x10 << 1) | 1

example-kernels/runner-test/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#![test_runner(crate::test_runner)]
66
#![reexport_test_harness_main = "test_main"]
77

8+
extern crate rlibc;
9+
810
pub fn test_runner(tests: &[&dyn Fn()]) {
911
for test in tests.iter() {
1012
test();

example-kernels/runner/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Philipp Oppermann <dev@phil-opp.com>"]
55
edition = "2018"
66

77
[dependencies]
8-
bootloader = "0.9.3"
8+
bootloader = "0.9.7"
99
x86_64 = "0.11.0"
1010

1111
[package.metadata.bootimage]

0 commit comments

Comments
 (0)