17 lines
347 B
Bash
17 lines
347 B
Bash
if [ $(uname -m) != "riscv64" ]; then
|
|
function compile_and_run() {
|
|
riscv64-linux-gnu-gcc-12 -static $1.s -o $1.elf
|
|
qemu-riscv64 $1.elf
|
|
}
|
|
else
|
|
function compile_and_run() {
|
|
gcc $1.s -o $1.elf
|
|
./$1.elf
|
|
}
|
|
fi
|
|
|
|
gcc boot.c -o boot.elf &&
|
|
./boot.elf < $1 > $1.s &&
|
|
compile_and_run $1
|
|
echo $?
|
|
rm $1.s $1.s.elf boot.elf 2> /dev/null |