Skip to content

Commit a5ca4cd

Browse files
committed
Build aarch64 in chroot on ubuntu-24.04-arm
1 parent 868683e commit a5ca4cd

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

.github/workflows/build.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,20 @@ jobs:
7878
path: out/*
7979

8080
build-in-chroot:
81-
runs-on: ubuntu-latest
82-
# if: false
83-
8481
strategy:
8582
fail-fast: false
8683
matrix:
8784
include:
88-
- alpine_arch: x86_64
8985
- alpine_arch: x86
86+
runner: ubuntu-24.04
87+
- alpine_arch: x86_64
88+
runner: ubuntu-24.04
9089
- alpine_arch: armhf
90+
runner: ubuntu-24.04
9191
- alpine_arch: aarch64
92+
runner: ubuntu-24.04-arm
93+
94+
runs-on: ${{ matrix.runner }}
9295

9396
steps:
9497
- name: Checkout
@@ -103,8 +106,10 @@ jobs:
103106
env:
104107
ALPINE_ARCH: ${{ matrix.alpine_arch }}
105108
run: |
106-
sudo apt-get update
107-
sudo apt-get -y install qemu-user-static
109+
if [ "$(uname -m)" != "${{ matrix.alpine_arch }}" ]; then
110+
sudo apt-get update
111+
sudo apt-get -y install qemu-user-static
112+
fi
108113
scripts/chroot/chroot_build.sh
109114
110115
upload:

scripts/chroot/chroot_build.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,14 @@ sudo cp -p /etc/resolv.conf miniroot/etc/
7070
# build.sh combines existing scripts shared by all available build environments
7171
sudo cp -R "$repo_root_dir"/scripts miniroot/scripts
7272

73-
if [ "$ALPINE_ARCH" = "x86" ] || [ "$ALPINE_ARCH" = "x86_64" ]; then
74-
echo "Architecture is x86 or x86_64, hence not using qemu-arm-static"
73+
if [ "$(uname -m)" = "${ALPINE_ARCH}" -o "${ALPINE_ARCH}" = "x86" -a "$(uname -m)" = "x86_64" ]; then
7574
sudo chroot miniroot /bin/sh -ex /scripts/chroot/build.sh
76-
elif [ "$ALPINE_ARCH" = "aarch64" ] ; then
77-
echo "Architecture is aarch64, hence using qemu-aarch64-static"
75+
elif [ "${ALPINE_ARCH}" = "aarch64" ] ; then
7876
sudo cp "$(which qemu-aarch64-static)" miniroot/usr/bin
7977
sudo chroot miniroot qemu-aarch64-static /bin/sh -ex /scripts/chroot/build.sh
80-
elif [ "$ALPINE_ARCH" = "armhf" ] ; then
81-
echo "Architecture is armhf, hence using qemu-arm-static"
78+
elif [ "${ALPINE_ARCH}" = "armhf" ] ; then
8279
sudo cp "$(which qemu-arm-static)" miniroot/usr/bin
83-
sudo cp "$repo_root_dir"/scripts/chroot/build.sh miniroot/build.sh && sudo chroot miniroot qemu-arm-static /bin/sh -ex /scripts/chroot/build.sh
80+
sudo chroot miniroot qemu-arm-static /bin/sh -ex /scripts/chroot/build.sh
8481
else
8582
echo "Edit chroot_build.sh to support this architecture as well, it should be easy"
8683
exit 1

0 commit comments

Comments
 (0)