riscv-gnu-toolchain icon indicating copy to clipboard operation
riscv-gnu-toolchain copied to clipboard

How to pull docker images used to build nuclei riscv toolchain

Open fanghuaqi opened this issue 5 months ago • 3 comments

How to build

请仔细阅读文档以后,再提问,欢迎指出文档问题

Source code with git repo info can be downloaded from https://drive.weixin.qq.com/s?k=ABcAKgdSAFcJ0kx0kt

[!NOTE]

  1. We dont provide any support for build toolchain, since it is a complicated task which depended on your network and your experience, and we have opensource all the things we used internally to build toolchain including source code and docker images, ci workflow(.gitlab-ci.yml).
  2. Regarding source code of libncrt, we dont open source it, so your own built toolchain wont have libncrt library built in your toolchain, please take care!
  3. If you want to build just directly in Ubuntu 20.04, you can refer to https://github.com/riscv-mcu/riscv-gnu-toolchain/issues/24#issuecomment-3153281932, and if you want to cross build for windows 64, please check https://github.com/riscv-mcu/riscv-gnu-toolchain/issues/24#issuecomment-3154800682

We are using prebuilt docker images to build riscv toolchain, detailed steps please check https://github.com/riscv-mcu/riscv-gnu-toolchain/blob/nuclei/2025.02/scripts/toolchain/README.md

Below are steps for developers who are hard to download required docker images and toolchain source code, please follow the steps below to prepare the source code and docker images, and then use above steps to build toolchain.

Here build_newlib_toolchain_logs.zip is the 2025.02 Nuclei Toolchain for baremetal/RTOS(newlib) internal ci build workflow log which you can take as reference.

JUST internal usage, please search solution in google by yourself

Here are the images we used to build toolchain:

  • Build linux toolchain: https://hub.docker.com/r/nucleisoftware/gnutoolchain-centos6
  • Build windows toolchain: https://hub.docker.com/r/nucleisoftware/gnutoolchain-ubuntu20.04

[!WARNING] But the hub.docker.com maybe not accessible from China, so you can change to use mirror website, see

  • Docker 镜像加速 https://www.runoob.com/docker/docker-mirror-acceleration.html
  • https://github.com/dongyubin/DockerHub and https://www.wangdu.site/course/2109.html
  • 最新国内可用的Docker镜像加速器地址收集汇总: https://www.wxy97.com/archives/b5b225b6-7741-4560-be2f-2e6a4f671d9b

Example command:

# use mirror docker.1ms.run
# if docker.1ms.run is not working for you, please change to other mirrors as decribed above or search by yourself
docker pull docker.1ms.run/nucleisoftware/gnutoolchain-centos6
docker pull docker.1ms.run/nucleisoftware/gnutoolchain-ubuntu20.04

We also provide (maybe out of date) saved docker images

  • gnutoolchain-ubuntu20.04.zip https://drive.weixin.qq.com/s?k=ABcAKgdSAFcN9IWZe4
  • gnutoolchain-centos6.zip https://drive.weixin.qq.com/s?k=ABcAKgdSAFcbC6LxVV
# import downloaded docker image
unzip gnutoolchain-ubuntu20.04.zip
docker load -i gnutoolchain-ubuntu20.04.tar
unzip gnutoolchain-centos6.zip
docker load -i gnutoolchain-centos6.tar
# view the imported image via command 
docker images
docker images | grep gnutoolchain
# And then you can use docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
# to tag the imported images as required one
# example command as below, change it to match your source image name
# see https://www.runoob.com/docker/docker-tag-command.html
docker tag docker.1ms.run/nucleisoftware/gnutoolchain-centos6 docker.io/nucleisoftware/gnutoolchain-centos6

If you are using script here below

https://github.com/riscv-mcu/riscv-gnu-toolchain/blob/3ee9153eefa7883205baba7843b1ee27e9b04bc0/scripts/toolchain/docker.sh#L23

You can change dockerrepo=docker.io/nucleisoftware to dockerrepo=docker.1ms.run/nucleisoftware to use mirror website docker.1ms.run, and then it will pull docker images from docker.1ms.run, and you can try other mirrors if this one is not working.

About docker image save and store, see https://www.runoob.com/docker/docker-save-command.html

FAQs

  1. If you have trouble to download gcc prerequisites, you can download it from here

Download https://drive.weixin.qq.com/s?k=ABcAKgdSAFcIe53ZN0 and unzip it directly in the top directory of gcc like this

riscv-gnu-toolchain/gcc $ ls -l *.tar*
-rw-r--r-- 1 hqfang hqfang 26105696 Jun 17  2023 gettext-0.22.tar.gz
-rw-r--r-- 1 hqfang hqfang  2493916 Nov 15  2020 gmp-6.2.1.tar.bz2
-rw-r--r-- 1 hqfang hqfang  2261594 May  2  2021 isl-0.24.tar.bz2
-rw-r--r-- 1 hqfang hqfang   838731 Oct 23  2020 mpc-1.2.1.tar.gz
-rw-r--r-- 1 hqfang hqfang  1747243 Jul 10  2020 mpfr-4.1.0.tar.bz2

fanghuaqi avatar Jun 10 '25 06:06 fanghuaqi