Document not found (404)
+This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 000000000..35049cbcb --- /dev/null +++ b/.cargo/config @@ -0,0 +1,2 @@ +[alias] +xtask = "run --package xtask --" diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..ea56350fe --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf + +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{rs,py}] +indent_style = space +indent_size = 4 + +[*.{md,json}] +indent_style = space +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..6313b56c5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..f68fd3e79 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +*Descriptive summary of your bugfix, feature, or refactoring.* + +## Checklist +- [ ] Sensible git history (for example, squash "typo" or "fix" commits): See the + [Rewriting History](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History) guide for + help. +- [ ] Update the changelog (if necessary) diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..5cde1657c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: cargo + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml new file mode 100644 index 000000000..988569003 --- /dev/null +++ b/.github/workflows/book.yml @@ -0,0 +1,43 @@ +name: Book + +on: + push: + branches: [ main ] + +# Adapted from: +# https://github.com/rust-lang/mdBook/wiki/Automated-Deployment%3A-GitHub-Actions#github-pages-deploy +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install mdbook + run: | + mkdir mdbook + curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.21/mdbook-v0.4.21-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo `pwd`/mdbook >> $GITHUB_PATH + - name: Deploy GitHub Pages + run: | + cd book + mdbook build + git worktree add gh-pages gh-pages + git config user.name "Deploy from CI" + git config user.email "" + cd gh-pages + # Delete the ref to avoid keeping history. + git update-ref -d refs/heads/gh-pages + # Place the book under a "HEAD" directory so that we can later + # add other versions (e.g. "stable" or "v0.17") without breaking + # URLs. + rm -rf HEAD + mv ../book HEAD + git add HEAD + # Add an index in the root to redirect to HEAD. If we eventually + # serve multiple versions, this can be changed to a real index. + cp ../head_redirect.html index.html + git add index.html + # Commit and push. + git commit -m "Deploy $GITHUB_SHA to gh-pages" + git push --force diff --git a/.github/workflows/msrv_toolchain.toml b/.github/workflows/msrv_toolchain.toml new file mode 100644 index 000000000..640fc4616 --- /dev/null +++ b/.github/workflows/msrv_toolchain.toml @@ -0,0 +1,4 @@ +[toolchain] +# Oldest nightly that currently works with `cargo xtask build`. +channel = "nightly-2022-04-18" +components = ["rust-src"] diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 000000000..253e34377 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,177 @@ +name: Rust + +on: + push: + branches: + - main + - version-* + pull_request: + branches: + - main + - version-* + schedule: + - cron: '0 0 * * 0-6' + +jobs: + test_aarch64: + name: Build and run tests on AArch64 + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install qemu and OVMF + run: | + # Ubuntu 20.04 provides qemu 4.2, which crashes on exit in this + # test. Add a PPA to provide a more recent version of qemu. + sudo add-apt-repository ppa:canonical-server/server-backports + sudo apt-get update + sudo apt-get install qemu-system-arm qemu-efi-aarch64 -y + + - name: Build + run: cargo xtask build --target aarch64 + + - name: Run VM tests + run: cargo xtask run --target aarch64 --headless --ci + timeout-minutes: 2 + + test_x86_64: + name: Build and run tests on x86_64 + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install qemu and OVMF + run: | + sudo apt-get update + sudo apt-get install qemu-system-x86 ovmf -y + + - name: Build + run: cargo xtask build --target x86_64 + + - name: Run VM tests + run: cargo xtask run --target x86_64 --headless --ci + timeout-minutes: 2 + + test_ia32: + name: Build and run tests on IA32 + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Install qemu + run: | + # Ubuntu 20.04 provides qemu 4.2, which crashes on exit in this + # test. Add a PPA to provide a more recent version of qemu. + sudo add-apt-repository ppa:canonical-server/server-backports + sudo apt-get update + sudo apt-get install qemu-system-x86 -y + + # Starting in ubuntu 21.04 there's an `ovmf-ia32` package, but the + # github runners are on ubuntu 20.04. For now, install the OVMF + # files from a repo that provides unofficial nightly builds: + # https://github.com/retrage/edk2-nightly + - name: Install OVMF + env: + # Pin to a specific commit in the retrage/edk2-nightly repo to + # guard against external changes breaking the CI. + EDK2_NIGHTLY_COMMIT: 'ebb83e5475d49418afc32857f66111949928bcdc' + run: | + curl -o OVMF32_CODE.fd https://raw.githubusercontent.com/retrage/edk2-nightly/${EDK2_NIGHTLY_COMMIT}/bin/RELEASEIa32_OVMF_CODE.fd + curl -o OVMF32_VARS.fd https://raw.githubusercontent.com/retrage/edk2-nightly/${EDK2_NIGHTLY_COMMIT}/bin/RELEASEIa32_OVMF_VARS.fd + + - name: Build + run: cargo xtask build --target ia32 + + - name: Run VM tests + run: cargo xtask run --target ia32 --headless --ci --ovmf-code OVMF32_CODE.fd --ovmf-vars OVMF32_VARS.fd + timeout-minutes: 2 + + test: + name: Run tests and documentation tests + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Run cargo test + run: cargo xtask test + + lints: + name: Lints + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Run cargo fmt + run: | + rustup component add rustfmt + cargo fmt --all -- --check + + - name: Run clippy + run: | + rustup component add clippy + cargo xtask clippy --warnings-as-errors + + - name: Run cargo doc + run: cargo xtask doc --warnings-as-errors + + miri: + name: Run unit tests and doctests under Miri + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Run miri + run: | + rustup component add miri + cargo xtask miri + + # This job tests that the template app builds successfully with the + # released versions of the libraries on crates.io. + # + # Since a nightly toolchain is currently required to build uefi-rs, + # the released versions can suddenly stop building when a new nightly + # compiler with a breaking change is released. This job provides an + # alert when this situation occurs. + test_latest_release: + name: Build the template against the released version of uefi-rs + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Build + run: cargo xtask test-latest-release + + windows: + name: Check that the build works on a Windows target + runs-on: windows-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Build + run: cargo xtask build + + # Run the build with our current nightly MSRV (specified in + # ./msrv_toolchain.toml). This serves to check that we don't + # accidentally start relying on a new feature without intending + # to. Having a test for this makes it easier for us to be intentional + # about making changes that require a newer version. + build_msrv: + name: Check that the build works on our nightly MSRV + runs-on: ubuntu-latest + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Set toolchain + run: cp .github/workflows/msrv_toolchain.toml rust-toolchain.toml + + - name: Build + run: cargo xtask build diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..26cfda81e --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +# Cargo places all built files here. +/target/ + +# Libraries should not commit their .lock files. +Cargo.lock + +# Files generated by mdBook. +/book/book/ diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 000000000..f17311098 --- /dev/null +++ b/.nojekyll @@ -0,0 +1 @@ +This file makes sure that Github Pages doesn't process mdBook's output. diff --git a/404.html b/404.html new file mode 100644 index 000000000..582ca42ae --- /dev/null +++ b/404.html @@ -0,0 +1,167 @@ + + +
+ + +This URL is invalid, sorry. Please use the navigation bar or search to continue.
+ +A UEFI system goes through several distinct phases during the boot process.
+uefi
crate. It is described by the UEFI Platform
+Initialization Specification, which is separate from the main UEFI
+Specification.boot
module and runtime
module can be used.
+This stage typically culminates in running a bootloader that loads an
+operating system. The stage ends when boot::exit_boot_services
is called,
+putting the system in Runtime mode.boot
module can no longer be used, but
+functions in the runtime
module are still available. Once the system is
+in Runtime mode, it cannot return to the Boot Services stage until after a
+system reset.