构建 RISC-V GNU 工具链——推荐的 Vagrant 配置?

Building the RISC-V GNU toolchain - recommended Vagrant configuration?

我尝试过几次将 riscv-gnu-toolchain 安装到虚拟机中,但都失败了。有没有人有建议的 Linux / 虚拟机配置(最好是 Vagrantfile)?如果我找不到,我会自己制作一个并在这里分享。起始 OS 版本、内存和硬盘驱动器容量 - 最好是非 GUI,并且尽可能少。

此外,由于构建如此庞大,人们是否对并行构建的多 CPU 设置和 make -j6(或您的核心数)感到幸运?

这个 Vagrantfile 做到了。它是从多个来源收集而来的(none 其中有正确信息的摘要)。

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"
  # needs vagrant plugin install vagrant-disksize:
  config.disksize.size = '40GB'
  config.vm.provider "virtualbox" do |v|
    v.linked_clone = true
    v.cpus = 12
    v.memory = 8192
    v.name = "RISC-V Toolchain (Ubuntu 16)"
  end
  config.vm.provision "shell", inline: <<-SHELL
    echo "updating apt"
    apt-get update
    echo "installing dependencies"
    apt-get install -y 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
    mkdir /opt/riscv
    chown vagrant:vagrant /opt/riscv
    cd /home/vagrant
    echo "checking out toolchain"
    export HOME=/home/vagrant
    sudo -u vagrant git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
    cd riscv-gnu-toolchain
    echo "configuring toolchain"
    sudo -u vagrant ./configure --prefix=/opt/riscv --enable-multilib
    echo "building toolchain"
    sudo -u vagrant make -j 12 linux
    echo "vagrant provisioner - running tests"
    apt-get install -y expect libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev python
    sudo -u vagrant ./configure --prefix=/opt/riscv
    sudo -u vagrant make report-linux
  SHELL
end