Repository navigation
Update README.md #34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build RISC-V GNU Toolchain | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| jobs: | |
| build-riscv-toolchain: | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 180 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y autoconf automake autotools-dev curl python3 python3-pip \ | |
| libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf \ | |
| libtool patchutils bc zlib1g-dev libexpat-dev ninja-build git cmake libglib2.0-dev libslirp-dev | |
| - name: Clone riscv-gnu-toolchain | |
| run: | | |
| git clone https://github.com/riscv/riscv-gnu-toolchain | |
| cd riscv-gnu-toolchain | |
| - name: Configure and build | |
| run: | | |
| cd riscv-gnu-toolchain | |
| ./configure --prefix=/opt/riscv/gcc15 --with-arch=rv32imac_zicsr_zifencei_zba_zbb_zbkb_zbs --with-abi=ilp32 | |
| make -j$(nproc) | |
| sudo mkdir -p /opt/riscv/gcc15 | |
| sudo chown $(whoami) /opt/riscv/gcc15 | |
| - name: Package toolchain | |
| run: | | |
| cd /opt/riscv | |
| tar -czvf riscv-gnu-toolchain.tar.gz gcc15 | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: riscv-toolchain | |
| path: /opt/riscv/riscv-gnu-toolchain.tar.gz | |
| retention-days: 7 # 制品保留天数 |