linuxgccqemuriscvgnu-toolchain

RISC-V Linux running on Qemu


I am trying to run RISC-V linux on Qemu, following the instruction: Running 64- and 32-bit RISC-V Linux on QEMU
I have downloaded and installed the RISC-V GNU compiller Toolchain

./configure --prefix=/opt/riscv
make linux

and when I execute the command:

make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- defconfig

I got the following error:

:~/Documents/riscv64-linux/linux$ make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- defconfig
*** Default configuration is based on 'defconfig'
scripts/Kconfig.include:39: compiler 'riscv64-unknown-linux-gnu-gcc' not found
make[1]: *** [scripts/kconfig/Makefile:73: defconfig] Error 1
make: *** [Makefile:602: defconfig] Error 2

Kindly, advice how can I fix this problem.


Solution

  • This is standart problem, try to type whereis riscv64-unknown-linux-gnu-gcc if it get nothing, try to type riscv64- and press tab, you should see necessary prefix you need paste after CROSS_COMPILE=. Also maybe you also need add PATH variable with path to riscv-toolchain's bin in ~/.bashrc or/and in ~/.profile.

    Build own linux is a big task, maybe you should learn some manuals about toolchain and building linux.

    riscv toolchain link