Skip to content

Commit 0f7f783

Browse files
authored
Merge pull request #130 from rust-osdev/uefi
Rewrite for UEFI support
2 parents 7fac0b9 + d741a8e commit 0f7f783

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+4562
-2233
lines changed

Diff for: .cargo/config

-2
This file was deleted.

Diff for: .cargo/config.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[target.x86_64-unknown-uefi]
2+
runner = "cargo run -p runner"
3+
4+
[alias]
5+
builder = "run --bin builder --features builder --quiet --"

Diff for: .github/workflows/build.yml

+80-102
Original file line numberDiff line numberDiff line change
@@ -2,122 +2,100 @@ name: Build
22

33
on:
44
push:
5-
branches:
6-
- '*'
7-
- '!staging.tmp'
8-
tags:
9-
- '*'
105
pull_request:
116

127
jobs:
13-
test:
14-
name: "Test"
8+
check:
9+
name: Check
1510

16-
strategy:
17-
fail-fast: false
18-
matrix:
19-
platform: [
20-
ubuntu-latest,
21-
macos-latest,
22-
windows-latest
23-
]
24-
25-
runs-on: ${{ matrix.platform }}
26-
timeout-minutes: 15
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 10
2713

2814
steps:
29-
- name: "Checkout Repository"
30-
uses: actions/checkout@v1
31-
32-
- name: "Print Rust Version"
33-
run: |
34-
rustc -Vv
35-
cargo -Vv
36-
37-
- name: "Install Rustup Components"
38-
run: rustup component add rust-src llvm-tools-preview
39-
- name: "Install cargo-xbuild"
40-
run: cargo install cargo-xbuild --debug
41-
- name: "Install cargo-binutils"
42-
run: cargo install cargo-binutils --version 0.1.7 --debug
43-
44-
- run: cargo xbuild
45-
working-directory: test-kernel
46-
name: 'Build Test Kernel'
47-
48-
- name: 'Build Bootloader'
49-
run: cargo xbuild --bin bootloader --features binary --release
50-
env:
51-
KERNEL: "test-kernel/target/x86_64-test-kernel/debug/test-kernel"
52-
KERNEL_MANIFEST: "test-kernel/Cargo.toml"
53-
54-
- name: 'Convert Bootloader ELF to Binary'
55-
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
56-
57-
# install QEMU
58-
- name: Install QEMU (Linux)
59-
run: sudo apt update && sudo apt install qemu-system-x86
60-
if: runner.os == 'Linux'
61-
- name: Install QEMU (macOS)
62-
run: brew install qemu
63-
if: runner.os == 'macOS'
64-
env:
65-
HOMEBREW_NO_AUTO_UPDATE: 1
66-
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
67-
HOMEBREW_NO_INSTALL_CLEANUP: 1
68-
- name: Install Scoop (Windows)
69-
run: |
70-
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
71-
echo "$HOME\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
72-
if: runner.os == 'Windows'
73-
shell: pwsh
74-
- name: Install QEMU (Windows)
75-
run: scoop install qemu
76-
if: runner.os == 'Windows'
77-
shell: pwsh
78-
- name: "Print QEMU Version"
79-
run: qemu-system-x86_64 --version
15+
- uses: actions/checkout@v2
16+
- uses: actions-rs/toolchain@v1
17+
with:
18+
profile: minimal
19+
override: true
20+
- name: "Run `cargo check`"
21+
uses: actions-rs/cargo@v1
22+
with:
23+
command: check
8024

81-
- name: 'Run Test Kernel with Bootloader'
82-
run: |
83-
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
84-
if [ $? -eq 123 ]; then (exit 0); else (exit 1); fi
85-
shell: 'bash {0}'
25+
test:
26+
name: Test
8627

87-
build_example_kernel:
88-
name: "Build Example Kernel"
8928
strategy:
29+
fail-fast: false
9030
matrix:
91-
platform: [
92-
ubuntu-latest,
93-
macos-latest,
94-
windows-latest
95-
]
96-
runs-on: ${{ matrix.platform }}
97-
timeout-minutes: 10
31+
os: [ubuntu-latest, macos-latest, windows-latest]
32+
runs-on: ${{ matrix.os }}
33+
timeout-minutes: 30
9834

9935
steps:
100-
- uses: actions/checkout@v1
101-
- name: "Install Rustup Components"
102-
run: rustup component add rust-src llvm-tools-preview
103-
- name: "Install cargo-xbuild"
104-
run: cargo install cargo-xbuild --debug
105-
- name: 'Build Example Kernel'
106-
run: cargo xbuild
107-
working-directory: example-kernel
108-
109-
110-
check_formatting:
111-
name: "Check Formatting"
36+
- uses: actions/checkout@v2
37+
- uses: actions-rs/toolchain@v1
38+
with:
39+
profile: minimal
40+
override: true
41+
components: rust-src, llvm-tools-preview
42+
43+
# install QEMU
44+
- name: Install QEMU (Linux)
45+
run: sudo apt update && sudo apt install qemu-system-x86
46+
if: runner.os == 'Linux'
47+
- name: Install QEMU (macOS)
48+
run: brew install qemu
49+
if: runner.os == 'macOS'
50+
env:
51+
HOMEBREW_NO_AUTO_UPDATE: 1
52+
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1
53+
HOMEBREW_NO_INSTALL_CLEANUP: 1
54+
- name: Install Scoop (Windows)
55+
run: |
56+
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
57+
echo "$HOME\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
58+
if: runner.os == 'Windows'
59+
shell: pwsh
60+
- name: Install QEMU (Windows)
61+
run: scoop install qemu
62+
if: runner.os == 'Windows'
63+
shell: pwsh
64+
- name: "Print QEMU Version"
65+
run: qemu-system-x86_64 --version
66+
67+
- name: Run `cargo test`
68+
uses: actions-rs/cargo@v1
69+
with:
70+
command: test
71+
72+
fmt:
73+
name: Check Formatting
11274
runs-on: ubuntu-latest
113-
timeout-minutes: 2
11475
steps:
115-
- uses: actions/checkout@v1
116-
- name: "Use the latest Rust nightly with rustfmt"
117-
uses: actions-rs/toolchain@v1
118-
with:
119-
toolchain: nightly
76+
- uses: actions/checkout@v2
77+
- uses: actions-rs/toolchain@v1
78+
with:
12079
profile: minimal
80+
override: true
12181
components: rustfmt
82+
- name: Run `cargo fmt --all -- --check`
83+
uses: actions-rs/cargo@v1
84+
with:
85+
command: fmt
86+
args: --all -- --check
87+
88+
clippy:
89+
name: Clippy
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v2
93+
- uses: actions-rs/toolchain@v1
94+
with:
95+
profile: minimal
12296
override: true
123-
- run: cargo fmt -- --check
97+
components: clippy
98+
- name: Run `cargo clippy`
99+
uses: actions-rs/cargo@v1
100+
with:
101+
command: clippy

Diff for: .vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"rust-analyzer.checkOnSave.allTargets": false,
3+
"rust-analyzer.checkOnSave.extraArgs": [
4+
"-Zbuild-std=core,alloc"
5+
]
6+
}

0 commit comments

Comments
 (0)