[SQ] Replace runscript.sh with ninja file

This commit is contained in:
Berkus Decker 2019-01-17 19:38:05 +02:00
parent b0ed5d0c17
commit e81c6ddf84
6 changed files with 41 additions and 22 deletions

View File

@ -1,2 +1 @@
[target.aarch64-vesper-metta]
runner=".cargo/runscript.sh"

View File

@ -1,6 +0,0 @@
#!/bin/sh
aarch64-unknown-linux-musl-objcopy -O binary $1 $1.bin
# -d in_asm,unimp,int -S
/usr/local/Cellar/qemu/HEAD-3365de01b5-custom/bin/qemu-system-aarch64 -M raspi3 -serial null -serial stdio -kernel $1.bin

View File

@ -40,4 +40,3 @@ memcpy = true
[package.metadata.bootimage]
default-target = "targets/aarch64-vesper-metta.json"
#run-command = ".cargo/runscript.sh"

View File

@ -33,22 +33,17 @@ Vesper has been influenced by the kernels in L4 family, notably seL4. Fawn and N
Use rustc nightly 2018-04-01 or later because of [bugs fixed](https://github.com/rust-lang/rust/issues/48884).
```
cargo xbuild --target=targets/aarch64-vesper-metta.json --release
# Post-command:
sh .cargo/runscript.sh
cp target/aarch64-vesper-metta/release/vesper.bin /Volumes/boot/vesper
# config.txt on RPi3
kernel=vesper
arm_64bit=1
# To run in qemu, `brew install qemu --HEAD --with-libusb` and
### This command is not supported by cargo-xbuild yet: xargo run --target=aarch64-vesper-metta
# Use this instead:
sh .cargo/runscript.sh
ninja qemu
```
Will run `cargo xbuild` to create kernel and run it in qemu emulator.
```
ninja device
```
Will build kernel, and copy it to sdcard at /Volumes/BOOT/
## OSdev help
Based on [Raspi3 tutorials by Andre Richter](https://github.com/rust-embedded/rust-raspi3-tutorial/blob/master/05_uart0/src/uart.rs),

30
build.ninja Normal file
View File

@ -0,0 +1,30 @@
TARGET = aarch64-vesper-metta
FEATURES = --features "noserial"
UTILS_CONTAINER = andrerichter/raspi3-utils
DOCKER_CMD = docker run -it --rm -v ./:/work -w /work
QEMU_CMD = qemu-system-aarch64 -M raspi3 -kernel
# -d in_asm,unimp,int -S
QEMU = /usr/local/Cellar/qemu/HEAD-3365de01b5-custom/bin/qemu-system-aarch64 -M raspi3 -d int -serial null -serial stdio -kernel
rule cargo_build
command = cargo xbuild --target=targets/$TARGET.json --release $FEATURES
rule strip
command = cargo objcopy -- --strip-all -O binary $in $out
rule docker_qemulate
command = $DOCKER_CMD $UTILS_CONTAINER $QEMU_CMD $in
rule qemulate
command = $QEMU $in
build kernel: cargo_build
build kernel8.img: strip target/${TARGET}/release/vesper | kernel
build qemu: qemulate kernel8.img
default kernel8.img

2
hopper.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
hopperv4 -e target/aarch64-vesper-metta/release/vesper.bin -R --base-address 0x80000 --entrypoint 0x80000 --file-offset 0 --aarch64