如何构建RISC-V的交叉编译工具链?

  1. 创建risc-v目录
    $ mkdir risc-v
    $ cd risc-v
  2. 获取源码
    $ git clone --recursive https://github.com/riscv/riscv-gnu-toolchain.git
  3. 安装依赖包
    $ 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 (on ubuntu 18.04)
  4. 编译并安装
    $ cd riscv-gnu-toolchain
    $ ./configure --prefix=/opt/riscv
    $ make (newlib cross-compiler, a generic ELF toolchain, select generic ELF toolchain)
    $ sudo make install
  5. 配置环境变量
    $ export RISCV=/opt/riscv
    $ export PATH=/opt/riscv/bin:$PATH

猜你喜欢

转载自www.cnblogs.com/dakewei/p/12157381.html