From 07d8a22a537c9525a2f0ac4aef9a8153ae110a27 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 15:37:09 +0200 Subject: [PATCH 01/12] Use `-Zbuildstd` instead of cargo-xbuild --- .cargo/config | 2 ++ Cargo.lock | 12 ++++++++++-- Cargo.toml | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.cargo/config b/.cargo/config index 7f2ad55d5..8e9ab91df 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,3 +1,5 @@ +unstable.build-std = ["core", "compiler_builtins"] + [build] target = "x86_64-blog_os.json" diff --git a/Cargo.lock b/Cargo.lock index e98c764b2..bc5bece6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9,6 +9,14 @@ dependencies = [ [[package]] name = "bootloader" -version = "0.9.3" +version = "0.9.5" +source = "git+https://github.com/rust-osdev/bootloader.git?branch=Zbuild-std#874fe6ec5a0043b515ef74591b925bb527fb3c9a" +dependencies = [ + "rlibc", +] + +[[package]] +name = "rlibc" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44ac0bdf4930c3c4d7f0d04eb6f15d7dcb9d5972b1ff9cd2bee0128112260fc7" +checksum = "fc874b127765f014d792f16763a81245ab80500e2ad921ed4ee9e82481ee08fe" diff --git a/Cargo.toml b/Cargo.toml index 28f343b0f..f437d305f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,4 +5,4 @@ authors = ["Philipp Oppermann "] edition = "2018" [dependencies] -bootloader = "0.9.3" +bootloader = { git = "https://github.com/rust-osdev/bootloader.git", branch = "Zbuild-std" } From 16ffe80fd5744a8a9ab2c4a7ff8ad981787b3b97 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 15:39:07 +0200 Subject: [PATCH 02/12] Add dependency on rlibc --- Cargo.lock | 1 + Cargo.toml | 1 + src/main.rs | 2 ++ 3 files changed, 4 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index bc5bece6a..4c431e50a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5,6 +5,7 @@ name = "blog_os" version = "0.1.0" dependencies = [ "bootloader", + "rlibc", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f437d305f..202a050a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,3 +6,4 @@ edition = "2018" [dependencies] bootloader = { git = "https://github.com/rust-osdev/bootloader.git", branch = "Zbuild-std" } +rlibc = "1.0.0" diff --git a/src/main.rs b/src/main.rs index 0f0eac13a..362559564 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,8 @@ #![no_std] #![no_main] +extern crate rlibc; + use core::panic::PanicInfo; static HELLO: &[u8] = b"Hello World!"; From ffe1b6abd09e1ddfdd4ea4ef3db1273546b3c61a Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 16:20:14 +0200 Subject: [PATCH 03/12] Rewrite CI script with using actions-rs actions This gives use support for github's scoped annotations when there are errors or warnings. --- .github/workflows/build-code.yml | 97 +++++++++++++++++++------------- 1 file changed, 57 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 0877b06c2..04f047708 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -12,9 +12,8 @@ on: pull_request: jobs: - test: - name: "Test" - + check: + name: Check strategy: matrix: platform: [ @@ -22,49 +21,67 @@ jobs: macos-latest, windows-latest ] - runs-on: ${{ matrix.platform }} - timeout-minutes: 15 - steps: - - name: "Checkout Repository" - uses: actions/checkout@v1 - - - name: Install Rustup - run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly - echo ::add-path::$HOME/.cargo/bin - if: runner.os == 'macOS' - - - name: "Print Rust Version" - run: | - rustc -Vv - cargo -Vv - - - 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 bootimage" - run: cargo install bootimage --debug - - - name: "Run cargo xbuild" - run: cargo xbuild - - name: "Create Bootimage" - run: cargo bootimage + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + - uses: actions-rs/cargo@v1 + with: + command: check + test: + name: Test Suite + strategy: + matrix: + platform: [ + ubuntu-latest, + macos-latest, + windows-latest + ] + runs-on: ${{ matrix.platform }} + steps: + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + - name: "Install Rustup Components" + run: rustup component add rust-src llvm-tools-preview + - name: "Install bootimage" + run: cargo install bootimage --debug + - uses: actions/checkout@v2 + - uses: actions-rs/cargo@v1 + with: + command: bootimage check_formatting: - name: "Check Formatting" + name: Rustfmt runs-on: ubuntu-latest - timeout-minutes: 2 steps: - - uses: actions/checkout@v1 - - name: "Use the latest Rust nightly with rustfmt" - uses: actions-rs/toolchain@v1 - with: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal toolchain: nightly + - run: rustup component add rustfmt + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: profile: minimal - components: rustfmt - override: true - - run: cargo fmt -- --check + toolchain: nightly + - run: rustup component add clippy + - uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings From c4672096d4abb83509ed28258cb2b832e858cf39 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 16:31:52 +0200 Subject: [PATCH 04/12] Install rust-src component for cargo check --- .github/workflows/build-code.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 04f047708..4d19b8c1f 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -28,6 +28,8 @@ jobs: with: profile: minimal toolchain: nightly + - name: "Install `rust-src` Rustup Component" + run: rustup component add rust-src - uses: actions-rs/cargo@v1 with: command: check From 9ee42e0f5f639a335be2394bcbfb7694bdad2597 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 16:32:50 +0200 Subject: [PATCH 05/12] Install Zbuild-std branch of bootimage --- .github/workflows/build-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 4d19b8c1f..9ffffdaaf 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -52,7 +52,7 @@ jobs: - name: "Install Rustup Components" run: rustup component add rust-src llvm-tools-preview - name: "Install bootimage" - run: cargo install bootimage --debug + run: cargo install bootimage --debug --git https://github.com/rust-osdev/bootimage.git --branch Zbuild-std - uses: actions/checkout@v2 - uses: actions-rs/cargo@v1 with: From 614e5b0e862f719abe1d4b4f706fd29e0d5b3ac9 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 16:36:19 +0200 Subject: [PATCH 06/12] Install rustup components after checking out the repo so that the components are installed for the nightly toolchain. --- .github/workflows/build-code.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 9ffffdaaf..5dad5ee21 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -49,11 +49,11 @@ jobs: with: profile: minimal toolchain: nightly - - name: "Install Rustup Components" - run: rustup component add rust-src llvm-tools-preview - name: "Install bootimage" run: cargo install bootimage --debug --git https://github.com/rust-osdev/bootimage.git --branch Zbuild-std - uses: actions/checkout@v2 + - name: "Install Rustup Components" + run: rustup component add rust-src llvm-tools-preview - uses: actions-rs/cargo@v1 with: command: bootimage From 263e852dccb99f980d2a2765a8263934c9a67fdc Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 16:43:02 +0200 Subject: [PATCH 07/12] Use functionality of toolchain action for installing rustup components --- .github/workflows/build-code.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 5dad5ee21..2bedf4d06 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -67,7 +67,8 @@ jobs: with: profile: minimal toolchain: nightly - - run: rustup component add rustfmt + components: rustfmt + override: true - uses: actions-rs/cargo@v1 with: command: fmt @@ -82,7 +83,8 @@ jobs: with: profile: minimal toolchain: nightly - - run: rustup component add clippy + components: clippy, rust-src + override: true - uses: actions-rs/cargo@v1 with: command: clippy From da0ee38f09235ae5c909ff535527490c77bbf346 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 17:10:50 +0200 Subject: [PATCH 08/12] Add names for all CI operations --- .github/workflows/build-code.yml | 42 ++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 2bedf4d06..5304b24e3 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -23,14 +23,17 @@ jobs: ] runs-on: ${{ matrix.platform }} steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly - - name: "Install `rust-src` Rustup Component" + - name: Install `rust-src` Rustup Component run: rustup component add rust-src - - uses: actions-rs/cargo@v1 + - name: Run `cargo check` + uses: actions-rs/cargo@v1 with: command: check @@ -45,16 +48,19 @@ jobs: ] runs-on: ${{ matrix.platform }} steps: - - uses: actions-rs/toolchain@v1 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly - - name: "Install bootimage" + - name: Install bootimage run: cargo install bootimage --debug --git https://github.com/rust-osdev/bootimage.git --branch Zbuild-std - - uses: actions/checkout@v2 - - name: "Install Rustup Components" + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install Rustup Components run: rustup component add rust-src llvm-tools-preview - - uses: actions-rs/cargo@v1 + - name: Run `cargo bootimage` + uses: actions-rs/cargo@v1 with: command: bootimage @@ -62,14 +68,17 @@ jobs: name: Rustfmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly components: rustfmt override: true - - uses: actions-rs/cargo@v1 + - name: Run `cargo fmt` + uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check @@ -78,14 +87,17 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - name: Checkout Repository + uses: actions/checkout@v2 + - name: Install Rust Toolchain + uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: nightly components: clippy, rust-src override: true - - uses: actions-rs/cargo@v1 + - name: Run `cargo clippy` + uses: actions-rs/cargo@v1 with: command: clippy args: -- -D warnings From 5ae9f62f4dc3e8c7ddd4198bda1ba7fd4c18321c Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Thu, 16 Jul 2020 17:15:03 +0200 Subject: [PATCH 09/12] Adjust job names on CI to match existing names --- .github/workflows/build-code.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index 5304b24e3..ca6221e2f 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -38,7 +38,7 @@ jobs: command: check test: - name: Test Suite + name: Test strategy: matrix: platform: [ @@ -65,7 +65,7 @@ jobs: command: bootimage check_formatting: - name: Rustfmt + name: Check Formatting runs-on: ubuntu-latest steps: - name: Checkout Repository From ffaac768765f9c0d4692512e2c9d61d8cd5a8b14 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 17 Jul 2020 10:52:08 +0200 Subject: [PATCH 10/12] Use latest release of bootimage on CI --- .github/workflows/build-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-code.yml b/.github/workflows/build-code.yml index ca6221e2f..3341046c3 100644 --- a/.github/workflows/build-code.yml +++ b/.github/workflows/build-code.yml @@ -54,7 +54,7 @@ jobs: profile: minimal toolchain: nightly - name: Install bootimage - run: cargo install bootimage --debug --git https://github.com/rust-osdev/bootimage.git --branch Zbuild-std + run: cargo install bootimage --debug - name: Checkout Repository uses: actions/checkout@v2 - name: Install Rustup Components From f135aefae8bcbbb501cf0fe9b964f8100301d054 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 17 Jul 2020 10:52:21 +0200 Subject: [PATCH 11/12] Update to bootloader 0.9.8 --- Cargo.lock | 8 +++----- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4c431e50a..142950bf2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,11 +10,9 @@ dependencies = [ [[package]] name = "bootloader" -version = "0.9.5" -source = "git+https://github.com/rust-osdev/bootloader.git?branch=Zbuild-std#874fe6ec5a0043b515ef74591b925bb527fb3c9a" -dependencies = [ - "rlibc", -] +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ad686b9b47363de7d36c05fb6885f17d08d0f2d15b1bc782a101fe3c94a2c7c" [[package]] name = "rlibc" diff --git a/Cargo.toml b/Cargo.toml index 202a050a8..163efcd09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,5 +5,5 @@ authors = ["Philipp Oppermann "] edition = "2018" [dependencies] -bootloader = { git = "https://github.com/rust-osdev/bootloader.git", branch = "Zbuild-std" } +bootloader = "0.9.8" rlibc = "1.0.0" From 44d7654ef6719572dd509bb38c95e281b17bb55c Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Fri, 17 Jul 2020 10:57:04 +0200 Subject: [PATCH 12/12] Add `toml` extension to .cargo/config and use table format for `unstable` --- .cargo/{config => config.toml} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename .cargo/{config => config.toml} (66%) diff --git a/.cargo/config b/.cargo/config.toml similarity index 66% rename from .cargo/config rename to .cargo/config.toml index 8e9ab91df..2f9647c1a 100644 --- a/.cargo/config +++ b/.cargo/config.toml @@ -1,4 +1,5 @@ -unstable.build-std = ["core", "compiler_builtins"] +[unstable] +build-std = ["core", "compiler_builtins"] [build] target = "x86_64-blog_os.json"