git clone https://github.com/riscv/riscv-gnu-toolchain
cd riscv-gnu-toolchain && ./configure --prefix=/opt/riscv --with-arch=rv64gc --with-abi=lp64d
make -j$(nproc)
Assembly step
riscv64-unknown-elf-as boot.S -o boot.o
Linking step
riscv64-unknown-elf-ld -T kernel.lds boot.o -o kernel.elf
Run with QEMU No Graphics Card
qemu-system-riscv64 -machine virt -cpu rv64 -smp 4 -m 128M -nographic -serial mon:stdio -bios none -kernel kernel.elf
VGA Graphics Card
qemu-system-riscv64 -machine virt -cpu rv64 -smp 4 -m 8192M -serial mon:stdio -device VGA -nographic -bios none -kernel kernel.elf`