Skip to content

Commit c355aec

Browse files
committed
Add xtask crate for kernel building
1 parent 21a7ae6 commit c355aec

File tree

14 files changed

+410
-28
lines changed

14 files changed

+410
-28
lines changed

.cargo/config.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
[unstable]
2-
# Keep in sync with CI!
3-
build-std = ["core", "alloc"]
4-
build-std-features = ["compiler-builtins-mem"]
5-
6-
[build]
7-
target = "targets/x86_64-unknown-none-hermitkernel.json"
8-
rustflags = [
9-
"-Zmutable-noalias=no"
10-
]
1+
[alias]
2+
xtask = "run --package xtask --"
113

124
[target.x86_64-unknown-none-hermitkernel]
135
runner = "tests/hermit_test_runner.py"

.github/workflows/aarch64.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ jobs:
2323
matrix:
2424
os: [ubuntu-latest]
2525
steps:
26-
- name: Install cargo-binutils
27-
run: cargo install cargo-binutils
2826
- name: Checkout rusty-hermit
2927
uses: actions/checkout@v3
3028
with:
@@ -41,9 +39,9 @@ jobs:
4139
run: rustup show
4240
- name: Build minimal kernel
4341
working-directory: libhermit-rs
44-
run: cargo build --no-default-features --target targets/aarch64-unknown-none-hermitkernel.json -Z build-std=core,alloc
42+
run: cargo xtask build --arch aarch64 --no-default-features
4543
- name: Build dev profile
46-
run: cargo build --target aarch64-unknown-hermit -p hello_world
44+
run: cargo build -Zbuild-std=core,alloc,std,panic_abort -Zbuild-std-features=compiler-builtins-mem --target aarch64-unknown-hermit --package hello_world
4745
- name: Build loader
4846
run: make arch=aarch64
4947
working-directory: loader

.github/workflows/clippy.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
env:
1212
CARGO_TERM_COLOR: always
13+
RUSTFLAGS: -Dwarnings
1314

1415
jobs:
1516
clippy:
@@ -24,4 +25,4 @@ jobs:
2425
sudo apt-get update
2526
sudo apt-get install nasm
2627
- name: Clippy
27-
run: cargo clippy -- -D warnings
28+
run: cargo xtask clippy

.github/workflows/doc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
env:
2828
RUSTDOCFLAGS: -D warnings
2929
run: |
30-
cargo doc --no-deps --document-private-items --target targets/x86_64-unknown-none-hermitkernel.json
31-
cargo doc --no-deps --document-private-items --target targets/aarch64-unknown-none-hermitkernel.json
30+
cargo doc -Z build-std=core,alloc --package rusty-hermit --no-deps --document-private-items --target targets/x86_64-unknown-none-hermitkernel.json
31+
cargo doc -Z build-std=core,alloc --package rusty-hermit --no-deps --document-private-items --target targets/aarch64-unknown-none-hermitkernel.json

.github/workflows/publish_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
sudo apt-get update
2222
sudo apt-get install nasm
2323
- name: Generate documentation
24-
run: cargo doc
24+
run: cargo doc -Z build-std=core,alloc --package rusty-hermit
2525
- name: Generate index.html
2626
run: |
2727
cat > target/x86_64-unknown-none-hermitkernel/doc/index.html <<EOL

.github/workflows/x86.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ jobs:
3939
choco install qemu nasm make
4040
echo "C:\Program Files\qemu" >> $GITHUB_PATH
4141
echo "C:\Program Files\NASM" >> $GITHUB_PATH
42-
- name: Install cargo-binutils
43-
run: cargo install cargo-binutils
4442
- name: Checkout rusty-hermit
4543
uses: actions/checkout@v3
4644
with:
@@ -57,9 +55,9 @@ jobs:
5755
run: rustup show
5856
- name: Build minimal kernel
5957
working-directory: libhermit-rs
60-
run: cargo build --no-default-features -Z build-std=core,alloc
58+
run: cargo xtask build --arch x86_64 --no-default-features
6159
- name: Build dev profile
62-
run: cargo build
60+
run: cargo build -Zbuild-std=core,alloc,std,panic_abort -Zbuild-std-features=compiler-builtins-mem --target x86_64-unknown-hermit
6361
- name: Unittests on host (ubuntu)
6462
if: ${{ matrix.os == 'ubuntu-latest' }}
6563
working-directory: libhermit-rs
@@ -81,7 +79,7 @@ jobs:
8179
run: cargo test --tests --no-fail-fast -- --bootloader_path=../loader/target/x86_64-unknown-hermit-loader/release/rusty-loader
8280
continue-on-error: true
8381
- name: Build release profile
84-
run: cargo build --release
82+
run: cargo build -Zbuild-std=core,alloc,std,panic_abort -Zbuild-std-features=compiler-builtins-mem --target x86_64-unknown-hermit --release
8583
- name: Test release profile
8684
run: |
8785
qemu-system-x86_64 -display none -smp 1 -m 128M -serial stdio \
@@ -91,7 +89,7 @@ jobs:
9189
-initrd target/x86_64-unknown-hermit/release/rusty_demo
9290
- name: Build minimal profile
9391
if: ${{ matrix.os == 'ubuntu-latest' }}
94-
run: cargo build --no-default-features --release -p hello_world
92+
run: cargo build -Zbuild-std=core,alloc,std,panic_abort -Zbuild-std-features=compiler-builtins-mem --target x86_64-unknown-hermit --no-default-features --release --package hello_world
9593
- name: Test minimal profile
9694
id: minimal
9795
if: ${{ matrix.os == 'ubuntu-latest' }}

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ build:demo:
4343
- if [ -d "libhermit-rs" ]; then rm -rf libhermit-rs; fi
4444
- mkdir libhermit-rs
4545
- shopt -s dotglob nullglob && mv $HOME/tmp_libhermit-rs/* libhermit-rs/.
46-
- cargo build -p rusty_demo
47-
- cargo build -p rusty_demo --release
46+
- cargo build -Zbuild-std=core,alloc,std,panic_abort -Zbuild-std-features=compiler-builtins-mem --target x86_64-unknown-hermit --package rusty_demo
47+
- cargo build -Zbuild-std=core,alloc,std,panic_abort -Zbuild-std-features=compiler-builtins-mem --target x86_64-unknown-hermit --package rusty_demo --release
4848
artifacts:
4949
paths:
5050
- rusty-hermit/target/x86_64-unknown-hermit/debug/rusty_demo

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,8 @@ x86 = { version = "0.47", default-features = false }
8484
[target.'cfg(target_arch = "aarch64")'.dependencies.aarch64]
8585
version = "0.0.7"
8686
default-features = false
87+
88+
[workspace]
89+
members = [
90+
"xtask",
91+
]

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ RUN set -eux; \
3636
# Build dependencies with stable toolchain channel
3737
FROM rust:bullseye as stable-deps
3838
RUN set -eux; \
39-
cargo install cargo-binutils; \
4039
cargo install cargo-download; \
4140
cargo install --git https://github.com/hermitcore/uhyve.git --locked uhyve;
4241

@@ -62,7 +61,6 @@ RUN set -eux; \
6261
qemu-system-x86 \
6362
; \
6463
rm -rf /var/lib/apt/lists/*;
65-
COPY --from=stable-deps $CARGO_HOME/bin/rust-objcopy $CARGO_HOME/bin/rust-objcopy
6664
COPY --from=stable-deps $CARGO_HOME/bin/cargo-download $CARGO_HOME/bin/cargo-download
6765
COPY --from=stable-deps $CARGO_HOME/bin/uhyve $CARGO_HOME/bin/uhyve
6866
COPY --from=hermit-deps rusty-loader/target/x86_64-unknown-hermit-loader/release/rusty-loader /usr/local/bin/rusty-loader

xtask/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)