-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_rust.sh
executable file
·33 lines (26 loc) · 962 Bytes
/
build_rust.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
# rustup must be installed
command -v rustup > /dev/null || { echo "ERROR: rustup not installed; install from https://www.rust-lang.org/tools/install"; exit 1; }
command -v qemu-system-x86_64 > /dev/null || { echo "ERROR: please install qemu-system"; exit 1; }
CWD=$(pwd)
DEFAULT_PIPE="io_pipe"
# If the rust-kernel directory does not yet exist, clone it, and set up the Rust compiler
if [ ! -d rust-kernel ]; then
git clone https://github.com/olivercalder/rust-kernel
rustup toolchain install nightly
cargo install bootimage
cd rust-kernel/test_os
rustup component add rust-src
rustup component add llvm-tools-preview
cd ../..
fi
send_image () {
echo > "$DEFAULT_PIPE.in"
cat "$1" > "${DEFAULT_PIPE}.in"
}
cd rust-kernel/test_os
mkfifo ${DEFAULT_PIPE}.in ${DEFAULT_PIPE}.out
cargo clean
send_image img.png &
cargo run --release # compile the rust kernel using cargo run in order to build bootimage
cd "$CWD"