-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
3,539 additions
and
637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Rust | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install tools | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y build-essential make | ||
rustup default nightly | ||
rustup component add rust-src | ||
rustup update | ||
cargo install cargo-xbuild | ||
mkdir bin | ||
- name: Build bootloader | ||
run: | | ||
cd src | ||
make bootloader | ||
mv hypervisor_bootloader/target/aarch64-uefi/release/hypervisor_bootloader ../bin/BOOTAA64.EFI | ||
- name: Build kernel | ||
run: | | ||
cd src | ||
make kernel | ||
mv hypervisor_kernel/target/aarch64-none/release/hypervisor_kernel ../bin/hypervisor_kernel | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Thin Hypervisor | ||
path: bin/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright (c) 2022 RIKEN | ||
# All rights reserved. | ||
# | ||
# This software is released under the MIT License. | ||
# http://opensource.org/licenses/mit-license.php | ||
|
||
FROM rust:latest | ||
|
||
RUN rustup default nightly \ | ||
&& rustup component add rust-src | ||
RUN rustup update | ||
RUN apt-get update && apt-get install -y \ | ||
build-essential make \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN cargo install cargo-xbuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# How to build the hypervisor | ||
|
||
## By Rust toolchain | ||
(TBD) | ||
|
||
|
||
## By docker | ||
### Requirements | ||
- Docker (Tested by `Docker version 20.10.8, build 3967b7d28e`) | ||
- I tested by non-root users (See [this](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user) to run docker command by non-root user) | ||
|
||
### Steps (commands list) | ||
|
||
```bash | ||
cd path/to/repo-root/src | ||
./build_docker_image.sh #Build docker image to build | ||
./build_hypervisor_by_docker.sh #Build the hypervisor by the docker image | ||
``` | ||
More detail, please see the scripts. | ||
|
||
# How to run the hypervisor | ||
## On QEMU | ||
First, please install QEMU that support to emulate `QEMU 2.12 ARM Virtual Machine`, `cortex-a53` CPU. | ||
Then, run the following command to run the built hypervisor. | ||
|
||
```bash | ||
cd path/to/repo-root/src | ||
make QEMU_EFI=/usr/share/qemu-efi/QEMU_EFI.fd run #Please set the path of your QEMU_EFI.fd to QEMU_EFI | ||
``` | ||
|
||
## On a physical machine from an USB memory stick | ||
### Requirement | ||
- Prepare a USB memory which has an EFI (FAT) partition that has `/EFI/BOOT/` directory. Please confirm that there is no important file in the partition. | ||
- Prepare a physical machine that has ARMv8-A or later, and UEFI firmware. | ||
|
||
### Steps | ||
1. Attach your USB memory stick to the development machine which built the hypervisor binary. | ||
2. Identify the EFI partition (in the following description, `/dev/sdX1` is the EFI partition). | ||
3. Run `sudo make DEVICE=/dev/sdX1 write` to copy the binary. | ||
!! Please be carefully not to specifying a wrong partition as `DEVICE` because the script mount/unmount the partition and copy the binary file with root privilege.!! | ||
4. Detach the USB memory from the development machine, and attach it to the physical machine to run the hypervisor. | ||
5. Boot the physical machine with UEFI, and specify `BOOTAA64.EFI` in the EFI partition as the EFI application to boot. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2022 RIKEN | ||
# All rights reserved. | ||
# | ||
# This software is released under the MIT License. | ||
# http://opensource.org/licenses/mit-license.php | ||
|
||
IMG_NAME="rust-build-thin-hypervisor" | ||
timestamp=$(date +%Y%m%d_%H%M%S) | ||
|
||
docker build -f Dockerfile -t "${IMG_NAME}:${timestamp}" . \ | ||
&& docker tag "${IMG_NAME}:${timestamp}" "${IMG_NAME}:latest" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) 2022 RIKEN | ||
# All rights reserved. | ||
# | ||
# This software is released under the MIT License. | ||
# http://opensource.org/licenses/mit-license.php | ||
|
||
cd $(dirname $0) | ||
PWD="$(pwd)" | ||
CONTAINER_NAME="rust-build-thin-hypervisor" | ||
IMG_NAME="rust-build-thin-hypervisor" | ||
|
||
do_clean=false | ||
|
||
while (( $# > 0 )) | ||
do | ||
case $1 in | ||
--clean) | ||
do_clean=true | ||
;; | ||
*) | ||
echo "Unknow argument" | ||
exit 1 | ||
;; | ||
esac | ||
shift 1 | ||
done | ||
|
||
build_cmdline='cd /workspace && make' | ||
if $do_clean; then | ||
build_cmdline="${build_cmdline} clean" | ||
fi | ||
|
||
docker run -it --rm --name ${CONTAINER_NAME} \ | ||
-v ${PWD}:/workspace \ | ||
${IMG_NAME}:latest \ | ||
bash -c "${build_cmdline}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "common" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
edition = "2021" | ||
|
||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.