User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
developers:env_prepare [2018/10/24 20:15]
developers:env_prepare [2019/04/10 20:28]
mick [riscv-gnu-toolchain how to]
Line 108: Line 108:
 </​code>​ </​code>​
-==== Use the toolchain ====+<WRAP Tip> 
 +You may build a multi-lib toolchain (that can create both 32bit and 64bit binaries) by using the ''​--enable-multilib''​ argument on the configure command above. 
 +<WRAP Info> 
 +Similar to the GNU-based toolchain, you may build a newlib-based toolchain by just typing ''​make''​ instead of ''​make linux''​ above. Make sure you use a different prefix path. 
 +=== musl-based toolchain ​=== 
 +It is possible to build a toolchain based on musl libc, to do this clone https://​​riscv/​riscv-musl.git on the risc-gnu-toolchain top directory and use musl32 and musl64 targets. Note that musl doesn'​t support multi-lib. 
 +$ cd riscv-gnu-toolchain 
 +$ git clone --recursive https://​​riscv/​riscv-musl.git 
 +$ ./configure --prefix=<​install directory>​ 
 +$ make musl<​xlen>​ 
 +==== Using the toolchain ====
 Now that you are done, you should add <install directory>/​bin to your PATH Now that you are done, you should add <install directory>/​bin to your PATH
Line 125: Line 143:
 riscv64-unknown-linux-gnu-cpp ​       riscv64-unknown-linux-gnu-gcc-nm ​    ​riscv64-unknown-linux-gnu-gfortran ​   riscv64-unknown-linux-gnu-objdump ​ riscv64-unknown-linux-gnu-strip riscv64-unknown-linux-gnu-cpp ​       riscv64-unknown-linux-gnu-gcc-nm ​    ​riscv64-unknown-linux-gnu-gfortran ​   riscv64-unknown-linux-gnu-objdump ​ riscv64-unknown-linux-gnu-strip
 </​code>​ </​code>​
-===== Prepare QEMU ===== 
-For testing your kernel builds it's much easier to use QEMU than normal hardware, especially if you are working on arch-specific code. QEMU has upstream support for RISC-V since version 2.12 so you may use the upstream binaries from your distribution or build your own either from the [[https://​​qemu/​qemu | official qemu repo]] or from the [[https://​​riscv/​riscv-qemu | riscv-qemu repo]]. 
-==== Build QEMU from riscv-qemu ==== 
-The process is the same no matter where you got your QEMU sources from, it's pretty standard... 
-git clone --depth=1 https://​​riscv/​riscv-qemu.git 
-cd riscv-qemu 
-./configure --target-list=riscv64-softmmu,​riscv32-softmmu --prefix=<​install dir> 
developers/env_prepare.txt · Last modified: 2019/04/10 20:30 by mick