From 473b01ac875e3e18a507a9540a0a3a4795dfbbcd Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Fri, 28 Aug 2026 13:37:44 -0400 Subject: [PATCH 1/2] Fix download caching on CI This addresses a bug that the cache was recording the wrong place, and it also addresses that the GHA cache is write-once. Therefore, you need to come up with new keys any time the files might change. The cache key fallback is really broad to match anything since anything is better than nothing. --- .github/workflows/build-test-toolchain.yml | 18 +++++++++--------- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- .../defconfig | 2 +- template/build.sh.eex | 2 -- 14 files changed, 21 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-test-toolchain.yml b/.github/workflows/build-test-toolchain.yml index 8a7348d..59f2a90 100644 --- a/.github/workflows/build-test-toolchain.yml +++ b/.github/workflows/build-test-toolchain.yml @@ -48,10 +48,10 @@ jobs: uses: actions/cache@v5 with: path: ~/.nerves/dl - key: nerves-dl-${{ inputs.toolchain }}-linux-x86_64 + key: nerves-dl-${{ hashFiles('toolchain_config.exs', 'configs/**/defconfig', 'template/defaults/*_defconfig') }}-${{ inputs.toolchain }} restore-keys: | - nerves-dl-${{ inputs.toolchain }}-linux- - nerves-dl-${{ inputs.toolchain }}- + nerves-dl-${{ hashFiles('toolchain_config.exs', 'configs/**/defconfig', 'template/defaults/*_defconfig') }}- + nerves-dl- - name: Build toolchain run: bash ${{ inputs.toolchain }}/build.sh "$GITHUB_WORKSPACE/o/${{ inputs.toolchain }}" @@ -148,10 +148,10 @@ jobs: uses: actions/cache@v5 with: path: ~/.nerves/dl - key: nerves-dl-${{ inputs.toolchain }}-linux-aarch64 + key: nerves-dl-${{ hashFiles('toolchain_config.exs', 'configs/**/defconfig', 'template/defaults/*_defconfig') }}-${{ inputs.toolchain }} restore-keys: | - nerves-dl-${{ inputs.toolchain }}-linux- - nerves-dl-${{ inputs.toolchain }}- + nerves-dl-${{ hashFiles('toolchain_config.exs', 'configs/**/defconfig', 'template/defaults/*_defconfig') }}- + nerves-dl- - name: Build toolchain run: bash ${{ inputs.toolchain }}/build.sh "$GITHUB_WORKSPACE/o/${{ inputs.toolchain }}" @@ -215,10 +215,10 @@ jobs: uses: actions/cache@v5 with: path: ~/.nerves/dl - key: nerves-dl-${{ inputs.toolchain }}-darwin-aarch64 + key: nerves-dl-${{ hashFiles('toolchain_config.exs', 'configs/**/defconfig', 'template/defaults/*_defconfig') }}-${{ inputs.toolchain }} restore-keys: | - nerves-dl-${{ inputs.toolchain }}-darwin- - nerves-dl-${{ inputs.toolchain }}- + nerves-dl-${{ hashFiles('toolchain_config.exs', 'configs/**/defconfig', 'template/defaults/*_defconfig') }}- + nerves-dl- - name: Build toolchain run: bash ${{ inputs.toolchain }}/build.sh "$GITHUB_WORKSPACE/o/${{ inputs.toolchain }}" diff --git a/configs/nerves_toolchain_aarch64_nerves_linux_gnu/defconfig b/configs/nerves_toolchain_aarch64_nerves_linux_gnu/defconfig index 1d7a067..c45b9d2 100644 --- a/configs/nerves_toolchain_aarch64_nerves_linux_gnu/defconfig +++ b/configs/nerves_toolchain_aarch64_nerves_linux_gnu/defconfig @@ -1,4 +1,4 @@ -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_ARM=y CT_ARCH_64=y CT_KERNEL_LINUX=y diff --git a/configs/nerves_toolchain_aarch64_nerves_linux_musl/defconfig b/configs/nerves_toolchain_aarch64_nerves_linux_musl/defconfig index e6ec165..09605dd 100644 --- a/configs/nerves_toolchain_aarch64_nerves_linux_musl/defconfig +++ b/configs/nerves_toolchain_aarch64_nerves_linux_musl/defconfig @@ -1,5 +1,5 @@ CT_EXPERIMENTAL=y -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_ARM=y CT_ARCH_64=y CT_KERNEL_LINUX=y diff --git a/configs/nerves_toolchain_armv5_nerves_linux_musleabi/defconfig b/configs/nerves_toolchain_armv5_nerves_linux_musleabi/defconfig index c73df6a..a09b74d 100644 --- a/configs/nerves_toolchain_armv5_nerves_linux_musleabi/defconfig +++ b/configs/nerves_toolchain_armv5_nerves_linux_musleabi/defconfig @@ -1,5 +1,5 @@ CT_EXPERIMENTAL=y -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_ARM=y CT_ARCH_TUNE="arm926ej-s" CT_ARCH_SUFFIX="v5" diff --git a/configs/nerves_toolchain_armv6_nerves_linux_gnueabihf/defconfig b/configs/nerves_toolchain_armv6_nerves_linux_gnueabihf/defconfig index 6ef0ce5..723f589 100644 --- a/configs/nerves_toolchain_armv6_nerves_linux_gnueabihf/defconfig +++ b/configs/nerves_toolchain_armv6_nerves_linux_gnueabihf/defconfig @@ -1,5 +1,5 @@ CT_EXPERIMENTAL=y -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_ARM=y CT_ARCH_CPU="arm1176jzf-s" CT_ARCH_SUFFIX="v6" diff --git a/configs/nerves_toolchain_armv7_nerves_linux_gnueabihf/defconfig b/configs/nerves_toolchain_armv7_nerves_linux_gnueabihf/defconfig index 11d174b..c46e9c7 100644 --- a/configs/nerves_toolchain_armv7_nerves_linux_gnueabihf/defconfig +++ b/configs/nerves_toolchain_armv7_nerves_linux_gnueabihf/defconfig @@ -1,4 +1,4 @@ -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_ARM=y CT_ARCH_CPU="generic-armv7-a" CT_ARCH_SUFFIX="v7" diff --git a/configs/nerves_toolchain_armv7_nerves_linux_musleabihf/defconfig b/configs/nerves_toolchain_armv7_nerves_linux_musleabihf/defconfig index 067810e..97dddd0 100644 --- a/configs/nerves_toolchain_armv7_nerves_linux_musleabihf/defconfig +++ b/configs/nerves_toolchain_armv7_nerves_linux_musleabihf/defconfig @@ -1,5 +1,5 @@ CT_EXPERIMENTAL=y -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_ARM=y CT_ARCH_CPU="generic-armv7-a" CT_ARCH_SUFFIX="v7" diff --git a/configs/nerves_toolchain_i586_nerves_linux_gnu/defconfig b/configs/nerves_toolchain_i586_nerves_linux_gnu/defconfig index 0e2f78f..86cadb9 100644 --- a/configs/nerves_toolchain_i586_nerves_linux_gnu/defconfig +++ b/configs/nerves_toolchain_i586_nerves_linux_gnu/defconfig @@ -1,4 +1,4 @@ -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_X86=y CT_ARCH_ARCH="i586" CT_KERNEL_LINUX=y diff --git a/configs/nerves_toolchain_mipsel_nerves_linux_musl/defconfig b/configs/nerves_toolchain_mipsel_nerves_linux_musl/defconfig index cb17128..83d5367 100644 --- a/configs/nerves_toolchain_mipsel_nerves_linux_musl/defconfig +++ b/configs/nerves_toolchain_mipsel_nerves_linux_musl/defconfig @@ -1,5 +1,5 @@ CT_EXPERIMENTAL=y -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_MIPS=y CT_ARCH_LE=y CT_ARCH_ARCH="24kec" diff --git a/configs/nerves_toolchain_riscv64_nerves_linux_gnu/defconfig b/configs/nerves_toolchain_riscv64_nerves_linux_gnu/defconfig index 93fa855..e9e6daf 100644 --- a/configs/nerves_toolchain_riscv64_nerves_linux_gnu/defconfig +++ b/configs/nerves_toolchain_riscv64_nerves_linux_gnu/defconfig @@ -1,5 +1,5 @@ CT_EXPERIMENTAL=y -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_RISCV=y CT_MULTILIB=y CT_ARCH_USE_MMU=y diff --git a/configs/nerves_toolchain_riscv64_nerves_linux_musl/defconfig b/configs/nerves_toolchain_riscv64_nerves_linux_musl/defconfig index 177af78..208a342 100644 --- a/configs/nerves_toolchain_riscv64_nerves_linux_musl/defconfig +++ b/configs/nerves_toolchain_riscv64_nerves_linux_musl/defconfig @@ -1,5 +1,5 @@ CT_EXPERIMENTAL=y -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_RISCV=y CT_ARCH_USE_MMU=y CT_ARCH_64=y diff --git a/configs/nerves_toolchain_x86_64_nerves_linux_gnu/defconfig b/configs/nerves_toolchain_x86_64_nerves_linux_gnu/defconfig index bbc6fb8..79573f7 100644 --- a/configs/nerves_toolchain_x86_64_nerves_linux_gnu/defconfig +++ b/configs/nerves_toolchain_x86_64_nerves_linux_gnu/defconfig @@ -1,4 +1,4 @@ -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_X86=y CT_ARCH_64=y CT_KERNEL_LINUX=y diff --git a/configs/nerves_toolchain_x86_64_nerves_linux_musl/defconfig b/configs/nerves_toolchain_x86_64_nerves_linux_musl/defconfig index 40cb315..ed851dd 100644 --- a/configs/nerves_toolchain_x86_64_nerves_linux_musl/defconfig +++ b/configs/nerves_toolchain_x86_64_nerves_linux_musl/defconfig @@ -1,5 +1,5 @@ CT_EXPERIMENTAL=y -CT_LOCAL_TARBALLS_DIR="${CT_TOP_DIR}/../dl" +CT_LOCAL_TARBALLS_DIR="${HOME}/.nerves/dl" CT_ARCH_X86=y CT_ARCH_64=y CT_KERNEL_LINUX=y diff --git a/template/build.sh.eex b/template/build.sh.eex index 6128922..fe25fdf 100644 --- a/template/build.sh.eex +++ b/template/build.sh.eex @@ -233,7 +233,6 @@ build_gcc() { # Build and install ct-ng to the work directory cd "$WORK_DIR" - ln -sf "$DL_DIR" dl rm -fr crosstool-ng crosstool-ng-* CTNG_TAR_XZ=crosstool-ng-$CTNG_TAG.tar.xz @@ -317,7 +316,6 @@ build_gcc() -e 's/^.*\(CT_LOG_DEBUG\).*$/# \1 is not set/' \ -e 's/^.*\(CT_LOG_LEVEL_MAX\).*$/\1="EXTRA"/' \ -e 's/^.*\(CT_LOG_PROGRESS_BAR\).*$/# \1 is not set/' \ - -e 's/^.*\(CT_LOCAL_TARBALLS_DIR\).*$/\1="${HOME}\/src"/' \ -e 's/^.*\(CT_SAVE_TARBALLS\).*$/\1=y/' \ "$WORK_DIR/build/.config" fi From a8c8d9d2a9d9b585376798c117db4e2fe042b887 Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Fri, 28 Aug 2026 15:12:33 -0400 Subject: [PATCH 2/2] Normalize macOS ARM arch to arm for compatibility --- template/build.sh.eex | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/template/build.sh.eex b/template/build.sh.eex index fe25fdf..e5e267f 100644 --- a/template/build.sh.eex +++ b/template/build.sh.eex @@ -46,6 +46,11 @@ if [[ -z $HOST_OS ]]; then HOST_OS=$BUILD_OS fi +ARTIFACT_HOST_ARCH=$HOST_ARCH +if [[ $HOST_OS = "darwin" && ( $HOST_ARCH = "arm64" || $HOST_ARCH = "aarch64" ) ]]; then + ARTIFACT_HOST_ARCH="arm" +fi + if [[ ! -e $BASE_CONFIG ]]; then echo "Can't find $BASE_CONFIG. Check that it exists." echo @@ -99,7 +104,7 @@ fi PACKAGE_CHECKSUM=$(elixir "$CHECKSUM_SCRIPT" "$MIX_FILE") TOOLCHAIN_NAME=$(basename "$CTNG_CONFIG_DIR") -ARTIFACT_BASENAME="$TOOLCHAIN_NAME-${HOST_OS}_${HOST_ARCH}-$NERVES_TOOLCHAIN_VERSION-$PACKAGE_CHECKSUM.tar.xz" +ARTIFACT_BASENAME="$TOOLCHAIN_NAME-${HOST_OS}_${ARTIFACT_HOST_ARCH}-$NERVES_TOOLCHAIN_VERSION-$PACKAGE_CHECKSUM.tar.xz" ARTIFACT_PATH="$OUTPUT_DIR/$ARTIFACT_BASENAME" echo "Using HOST_ARCH: $HOST_ARCH"