Skip to content

Commit

Permalink
Merge pull request #130 from rust-osdev/uefi
Browse files Browse the repository at this point in the history
Rewrite for UEFI support
  • Loading branch information
phil-opp authored Apr 6, 2021
2 parents 7fac0b9 + d741a8e commit 0f7f783
Show file tree
Hide file tree
Showing 72 changed files with 4,562 additions and 2,233 deletions.
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.x86_64-unknown-uefi]
runner = "cargo run -p runner"

[alias]
builder = "run --bin builder --features builder --quiet --"
182 changes: 80 additions & 102 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,122 +2,100 @@ name: Build

on:
push:
branches:
- '*'
- '!staging.tmp'
tags:
- '*'
pull_request:

jobs:
test:
name: "Test"
check:
name: Check

strategy:
fail-fast: false
matrix:
platform: [
ubuntu-latest,
macos-latest,
windows-latest
]

runs-on: ${{ matrix.platform }}
timeout-minutes: 15
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: "Checkout Repository"
uses: actions/checkout@v1

- 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 cargo-binutils"
run: cargo install cargo-binutils --version 0.1.7 --debug

- run: cargo xbuild
working-directory: test-kernel
name: 'Build Test Kernel'

- name: 'Build Bootloader'
run: cargo xbuild --bin bootloader --features binary --release
env:
KERNEL: "test-kernel/target/x86_64-test-kernel/debug/test-kernel"
KERNEL_MANIFEST: "test-kernel/Cargo.toml"

- name: 'Convert Bootloader ELF to Binary'
run: cargo objcopy -- -I elf64-x86-64 -O binary --binary-architecture=i386:x86-64 target/x86_64-bootloader/release/bootloader target/x86_64-bootloader/release/bootloader.bin

# install QEMU
- name: Install QEMU (Linux)
run: sudo apt update && sudo apt install qemu-system-x86
if: runner.os == 'Linux'
- name: Install QEMU (macOS)
run: brew install qemu
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Install Scoop (Windows)
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
echo "$HOME\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
if: runner.os == 'Windows'
shell: pwsh
- name: Install QEMU (Windows)
run: scoop install qemu
if: runner.os == 'Windows'
shell: pwsh
- name: "Print QEMU Version"
run: qemu-system-x86_64 --version
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
- name: "Run `cargo check`"
uses: actions-rs/cargo@v1
with:
command: check

- name: 'Run Test Kernel with Bootloader'
run: |
qemu-system-x86_64 -drive format=raw,file=target/x86_64-bootloader/release/bootloader.bin -device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none
if [ $? -eq 123 ]; then (exit 0); else (exit 1); fi
shell: 'bash {0}'
test:
name: Test

build_example_kernel:
name: "Build Example Kernel"
strategy:
fail-fast: false
matrix:
platform: [
ubuntu-latest,
macos-latest,
windows-latest
]
runs-on: ${{ matrix.platform }}
timeout-minutes: 10
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 30

steps:
- 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
working-directory: example-kernel


check_formatting:
name: "Check Formatting"
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: rust-src, llvm-tools-preview

# install QEMU
- name: Install QEMU (Linux)
run: sudo apt update && sudo apt install qemu-system-x86
if: runner.os == 'Linux'
- name: Install QEMU (macOS)
run: brew install qemu
if: runner.os == 'macOS'
env:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Install Scoop (Windows)
run: |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
echo "$HOME\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
if: runner.os == 'Windows'
shell: pwsh
- name: Install QEMU (Windows)
run: scoop install qemu
if: runner.os == 'Windows'
shell: pwsh
- name: "Print QEMU Version"
run: qemu-system-x86_64 --version

- name: Run `cargo test`
uses: actions-rs/cargo@v1
with:
command: test

fmt:
name: Check Formatting
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:
toolchain: nightly
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: rustfmt
- name: Run `cargo fmt --all -- --check`
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
override: true
- run: cargo fmt -- --check
components: clippy
- name: Run `cargo clippy`
uses: actions-rs/cargo@v1
with:
command: clippy
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.checkOnSave.extraArgs": [
"-Zbuild-std=core,alloc"
]
}
Loading

0 comments on commit 0f7f783

Please sign in to comment.