Skip to content

Commit fa1b40f

Browse files
troibejwnrt
authored andcommitted
Build toolchains for aarch64
The opentitan project uses the prebuilt toolchain on X86 to reduce build time. With the changes to the `toolchain_build.yml` workflow we also build the artifacts for aarch64.
1 parent 5660015 commit fa1b40f

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

.github/workflows/toolchain_build.yml

+16-6
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ jobs:
1717
build:
1818
strategy:
1919
matrix:
20+
name: [rv32imcb, rv64imac]
21+
os: [ubuntu-latest, ubuntu-24.04-arm]
2022
include:
23+
- os: ubuntu-latest
24+
host_arch: x86_64
25+
- os: ubuntu-24.04-arm
26+
host_arch: aarch64
2127
- name: rv32imcb
2228
display_name: Toolchains targeting Ibex with bit-manipulation extensions
2329
target: riscv32-unknown-elf
@@ -41,10 +47,10 @@ jobs:
4147
# target: riscv64-unknown-linux-gnu
4248
# output_dir: /opt/riscv-linux-toolchain
4349

44-
name: ${{ matrix.display_name }}
45-
runs-on: ubuntu-latest
50+
name: ${{ matrix.host_arch }} build of ${{ matrix.display_name }}
51+
runs-on: ${{ matrix.os }}
4652
# This is an AlmaLinux 8 based image
47-
container: quay.io/pypa/manylinux_2_28_x86_64
53+
container: quay.io/pypa/manylinux_2_28_${{ matrix.host_arch }}
4854
timeout-minutes: 360
4955

5056
steps:
@@ -64,6 +70,10 @@ jobs:
6470
sudo mkdir -p /tools/riscv
6571
sudo chmod 0777 /tools/riscv
6672
73+
echo ::group::Set the host architecture env var
74+
echo "HOST_ARCH=${{ matrix.host_arch }}" >> "$GITHUB_ENV"
75+
echo ::endgroup::
76+
6777
echo ::group::Set the release tag env var
6878
echo "RELEASE_TAG=$(./release_tag.sh)" >> "$GITHUB_ENV"
6979
echo ::endgroup::
@@ -95,7 +105,7 @@ jobs:
95105
96106
- uses: actions/upload-artifact@v4
97107
with:
98-
name: ${{ matrix.name }}-toolchains
108+
name: ${{ matrix.name }}-${{ matrix.host_arch }}-toolchains
99109
path: ${{ env.ARTIFACT_STAGING_DIR }}
100110

101111
- name: Check tarballs
@@ -117,5 +127,5 @@ jobs:
117127
gh release create "$RELEASE_TAG" --prerelease || echo "release exists"
118128
# Upload this job's artifacts.
119129
gh release upload "$RELEASE_TAG" --clobber \
120-
"${ARTIFACT_STAGING_DIR}/lowrisc-toolchain-${{ matrix.name }}-${RELEASE_TAG}.tar.xz" \
121-
"${ARTIFACT_STAGING_DIR}/lowrisc-toolchain-gcc-${{ matrix.name }}-${RELEASE_TAG}.tar.xz"
130+
"${ARTIFACT_STAGING_DIR}/lowrisc-toolchain-${{ matrix.name }}-${HOST_ARCH}-${RELEASE_TAG}.tar.xz" \
131+
"${ARTIFACT_STAGING_DIR}/lowrisc-toolchain-gcc-${{ matrix.name }}-${HOST_ARCH}-${RELEASE_TAG}.tar.xz"

build-clang-with-args.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ build_top_dir="${PWD}"
4949
source "${build_top_dir}/sw-versions.sh"
5050

5151
tag_name="${RELEASE_TAG:-HEAD}"
52-
toolchain_full_name="${toolchain_name}-${tag_name}"
52+
host_arch="${HOST_ARCH:-x86_64}"
53+
toolchain_full_name="${toolchain_name}-${host_arch}-${tag_name}"
5354

5455
mkdir -p "${build_top_dir}/build"
5556
cd "${build_top_dir}/build"

build-gcc-with-args.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ build_top_dir="${PWD}"
4545
source "${build_top_dir}/sw-versions.sh"
4646

4747
tag_name="${RELEASE_TAG:-HEAD}"
48-
toolchain_full_name="${toolchain_name}-${tag_name}"
48+
host_arch="${HOST_ARCH:-x86_64}"
49+
toolchain_full_name="${toolchain_name}-${host_arch}-${tag_name}"
4950

5051
# crosstools-NG needs the ability to create and chmod the
5152
# $toolchain_dest directory.

0 commit comments

Comments
 (0)