RISC_V交叉编译环境(国内镜像 避坑)

RISC_V交叉编译环境

cd $HOME
mkdir riscv
mkdir source-code
cd source-code
git clone https://gitee.com/lizeyujack/riscv-gnu-toolchain.git
cd riscv-gnu-toolchain
rm -rf riscv-*
  • 因为github 克隆之后,还需要更新子模块。所以可以通过镜像网站clone速度快一些。
sudo git clone https://gitee.com/mirrors/riscv-dejagnu.git
sudo git clone -b riscv-gcc-10.2.0 https://gitee.com/mirrors/riscv-gcc.git
sudo git clone -b riscv-glibc-2.29 https://gitee.com/mirrors/riscv-glibc.git
sudo git clone https://gitee.com/mirrors/riscv-newlib.git

sudo git clone -b riscv-binutils-2.35 https://gitee.com/mirrors/riscv-binutils-gdb.git  riscv-binutils
sudo git clone -b fsf-gdb-10.1-with-sim https://gitee.com/mirrors/riscv-binutils-gdb.git riscv-gdb
  • 下载依赖库
sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev
sudo apt-get install libnewlib-dev

下面的NUM_CPU=2可以修改为自己的电脑的CPU数量

INSTALL_PATH='/opt/riscv'
NUM_CPU=2

export PATH=$PATH:$INSTALL_PATH/BIN
./configure --prefix=$INSTALL_PATH
sudo make -j$NUM_CPU

这一步需要好久,1个多小时,请耐心等待

https://zhuanlan.zhihu.com/p/72862396
https://blog.csdn.net/qq_40836704/article/details/120391584

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值