Skip to content

Commit

Permalink
Make standalone kernel actually standalone (#58)
Browse files Browse the repository at this point in the history
* Work-in-progress for no_std core

* Use no-std version of wasmi

* More work

* Rustfmt

* Install rust-src

* More work

* It's compiling!

* Make it work

* Rustfmt

* Remove fmod and fmodf

* Remove these weird libc symbols

* Don't build the standalone kernel for Linux

* Use a different cache for the standalone kernel

* Rename job

* Restore fmt::Display implementations

* Fix inconsistency in wasmi

* Add Cargo.lock

* Tweak main.rs

* Use compiler_builtins and libm

* Add ISO build

* Pass -y to apt-get install

* Tweak ISO thing

* More ISO thing tweaks

* Hack around rand

* Some tweaks to main.rs

* Try make it boot properly

* Use lld for linking

* Prettier link script

* Tweak boot.S

* Rename target to multiboot2

* More tweaks

* Pass multiboot header to kernel

* Rename link script

* Correct target feature flags

* Activate MMX/SSE/SSE2

* Rustfmt

* More work

* Change allocator

* Rustfmt

* Revert "Bump parity-scale-codec from 1.0.6 to 1.1.0 (#69)"

This reverts commit ebe51e9.

* Revert "Bump async-std from 1.0.0 to 1.1.0 (#67)"

This reverts commit 86fa6c0.

* Remove dependency on rand

* Remove compiler_builtins

* Fix grub.cfg

* Install lld

* Revert "Remove compiler_builtins"

This reverts commit f980d44.

* Some code clean up

* More work
  • Loading branch information
tomaka committed Nov 27, 2019
1 parent ebe51e9 commit 944f88f
Show file tree
Hide file tree
Showing 43 changed files with 776 additions and 224 deletions.
65 changes: 52 additions & 13 deletions .github/workflows/ci.yml
Expand Up @@ -82,25 +82,27 @@ jobs:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- name: Build
run: cargo build --locked --verbose
run: cargo build --workspace --exclude nametbd-standalone-kernel --locked --verbose
- name: Run tests
run: cargo test --locked --verbose
run: cargo test --workspace --exclude nametbd-standalone-kernel --locked --verbose

build-unikernel:
name: Build stand-alone kernel
build-standalone:
name: Build standalone kernel
needs: build-modules
runs-on: ubuntu-latest
container:
image: rwthos/hermitcore-rs
env:
RUSTFLAGS: "-L/usr/lib/x86_64-linux-gnu/ -Clink-args=-lm"
image: rust
steps:
- uses: actions/checkout@v1
- name: Download WASM modules
uses: actions/download-artifact@v1
with:
name: wasm-modules
path: modules/target/wasm32-wasi/release
- name: Install lld
run: |
apt-get update
apt-get install -y lld
- name: Cache cargo registry
uses: actions/cache@v1
with:
Expand All @@ -115,16 +117,53 @@ jobs:
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- name: Build core
run: cargo build --locked --package nametbd-core --target x86_64-unknown-hermit
- name: Build kernel
run: cargo build --locked --package nametbd-standalone-kernel --target x86_64-unknown-hermit
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}-standalone
- name: Install nightly Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Install rust-src
run: rustup component add rust-src
- name: Build core for no_std platform
run: RUST_TARGET_PATH=`pwd` cargo +nightly build -Z build-std=core,alloc --target x86_64-multiboot2 --package nametbd-core --release
- name: Build kernel for no_std platform
run: RUST_TARGET_PATH=`pwd` cargo +nightly build -Z build-std=core,alloc --target x86_64-multiboot2 --package nametbd-standalone-kernel --release
- name: Upload generated kernel
uses: actions/upload-artifact@master
with:
name: kernel
path: target/x86_64-unknown-hermit/debug/nametbd-standalone-kernel
path: target/x86_64-multiboot2/release/nametbd-standalone-kernel

build-iso:
name: Build bootable x86 ISO
needs: build-standalone
runs-on: ubuntu-latest
container:
image: ubuntu:xenial
steps:
- uses: actions/checkout@v1
- name: Download kernel
uses: actions/download-artifact@v1
with:
name: kernel
path: .
- name: Install required packages
run: |
apt-get update
apt-get install -y libisoburn1 xorriso grub-pc-bin
- name: Prepare file structure
run: |
mkdir -p iso/boot/grub
cp .github/workflows/grub.cfg iso/boot/grub
mv nametbd-standalone-kernel iso/boot/kernel
- name: Build ISO
run: grub-mkrescue -o nametbd.iso iso
- name: Upload generated kernel
uses: actions/upload-artifact@master
with:
name: iso
path: nametbd.iso

fmt:
name: Rustfmt
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/grub.cfg
@@ -0,0 +1,6 @@
set timeout=5
set default=0

menuentry "nametbd" {
multiboot2 /boot/kernel
}

0 comments on commit 944f88f

Please sign in to comment.