$ git clone https://gitee.com/mirrors/riscv-gnu-toolchain
进入源码目录:
$ cd riscv-gnu-toolchain
注意上面 clone 的主仓库并不包含子仓库的内容,所以需要继续更新子仓库。注意这里首先排除了 qemu 这个子仓库,一来因为 qemu 完整下载太大;二来 qemu 对 toolchain 的编译本身来说其实并不需要。
$ git rm qemu
$ git submodule update --init --recursive
耐心等待子仓库下载完成。
[root@centos7 riscv_build]# git clone https://gitee.com/mirrors/riscv-gnu-toolchain Cloning into 'riscv-gnu-toolchain'... remote: Enumerating objects: 51, done. remote: Counting objects: 100% (51/51), done. remote: Compressing objects: 100% (51/51), done. remote: Total 8695 (delta 15), reused 0 (delta 0), pack-reused 8644 Receiving objects: 100% (8695/8695), 5.03 MiB | 8.94 MiB/s, done. Resolving deltas: 100% (4719/4719), done. [root@centos7 riscv_build]# cd riscv-gnu-toolchain [root@centos7 riscv-gnu-toolchain]# git rm qemu rm 'qemu' [root@centos7 riscv-gnu-toolchain]# git submodule update --init --recursive Submodule 'riscv-binutils' (https://github.com/riscv-collab/riscv-binutils-gdb.git) registered for path 'riscv-binutils' Submodule 'riscv-dejagnu' (https://github.com/riscv-collab/riscv-dejagnu.git) registered for path 'riscv-dejagnu' Submodule 'riscv-gcc' (https://github.com/riscv-collab/riscv-gcc.git) registered for path 'riscv-gcc' Submodule 'riscv-gdb' (https://github.com/riscv-collab/riscv-binutils-gdb.git) registered for path 'riscv-gdb' Submodule 'riscv-glibc' (git://sourceware.org/git/glibc.git) registered for path 'riscv-glibc' Submodule 'riscv-newlib' (git://sourceware.org/git/newlib-cygwin.git) registered for path 'riscv-newlib' Cloning into 'riscv-binutils'...