riscv back
This commit is contained in:
parent
92f4b4f561
commit
2b9ed2e2a4
4 changed files with 58 additions and 13 deletions
20
boot.sh
20
boot.sh
|
@ -1,10 +1,22 @@
|
|||
if [ $(uname -m) != "riscv64" ]; then
|
||||
function compile_and_run() {
|
||||
riscv64-linux-gnu-gcc-12 -static $1.s -o $1.elf &&
|
||||
qemu-riscv64 $1.elf < ../boot.c > $2.s
|
||||
return $?
|
||||
}
|
||||
else
|
||||
function compile_and_run() {
|
||||
gcc $1.s -o $1.elf &&
|
||||
./$1.elf < ../boot.c > $2.s
|
||||
return $?
|
||||
}
|
||||
fi
|
||||
|
||||
mkdir -p build && cd build &&
|
||||
gcc ../boot.c -o gcc.elf &&
|
||||
./gcc.elf < ../boot.c > boot1.s &&
|
||||
riscv64-linux-gnu-gcc-12 -static boot1.s -o boot1.elf &&
|
||||
qemu-riscv64 boot1.elf < ../boot.c > boot2.s &&
|
||||
riscv64-linux-gnu-gcc-12 -static boot2.s -o boot2.elf &&
|
||||
qemu-riscv64 boot2.elf < ../boot.c > boot3.s
|
||||
compile_and_run boot1 boot2 &&
|
||||
compile_and_run boot2 boot3
|
||||
cmp --silent boot1.s boot2.s && echo "boot1.s == boot2.s" || echo "boot1.s != boot2.s"
|
||||
cmp --silent boot2.s boot3.s && echo "boot2.s == boot3.s" || echo "boot2.s != boot3.s"
|
||||
cmp --silent boot1.s boot3.s && echo "boot1.s == boot3.s" || echo "boot1.s != boot3.s"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue