#!/bin/sh set -xue # QEMU file path QEMU=qemu-system-riscv32 # Path to clang and compiler flags CC=../riscv32-ilp32d--glibc/bin/riscv32-linux-gcc CFLAGS="-O2 -g3 -Wall -march=rv32imzicsr -mabi=ilp32 -fno-stack-protector -ffreestanding -nostdlib -static" # Build the kernel $CC $CFLAGS -T kernel.ld -Wl,-Map=kernel.map -o kernel.elf kernel.s common.s # Start QEMU $QEMU -machine virt -bios default -nographic -serial mon:stdio --no-reboot -kernel kernel.elf