Skip to content

Commit af6efe0

Browse files
bastimeyerTheAssassin
authored andcommitted
Build aarch64 in chroot on ubuntu-24.04-arm
1 parent 4121a90 commit af6efe0

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

.github/workflows/build.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,20 @@ jobs:
7272
path: out/*
7373

7474
build-in-chroot:
75-
runs-on: ubuntu-latest
76-
# if: false
77-
7875
strategy:
7976
fail-fast: false
8077
matrix:
8178
include:
82-
- alpine_arch: x86_64
8379
- alpine_arch: x86
80+
runner: ubuntu-24.04
81+
- alpine_arch: x86_64
82+
runner: ubuntu-24.04
8483
- alpine_arch: armhf
84+
runner: ubuntu-24.04-arm
8585
- alpine_arch: aarch64
86+
runner: ubuntu-24.04-arm
87+
88+
runs-on: ${{ matrix.runner }}
8689

8790
steps:
8891
- name: Checkout
@@ -97,8 +100,6 @@ jobs:
97100
env:
98101
ALPINE_ARCH: ${{ matrix.alpine_arch }}
99102
run: |
100-
sudo apt-get update
101-
sudo apt-get -y install qemu-user-static
102103
scripts/chroot/chroot_build.sh
103104
104105
upload:

scripts/chroot/chroot_build.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,18 @@ 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 [ \
74+
"$(uname -m)" = "${ALPINE_ARCH}" \
75+
-o "${ALPINE_ARCH}" = "x86" -a "$(uname -m)" = "x86_64" \
76+
-o "${ALPINE_ARCH}" = "armhf" -a "$(uname -m)" = "aarch64" \
77+
]; then
7578
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"
79+
elif [ "${ALPINE_ARCH}" = "aarch64" ] ; then
7880
sudo cp "$(which qemu-aarch64-static)" miniroot/usr/bin
7981
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"
82+
elif [ "${ALPINE_ARCH}" = "armhf" ] ; then
8283
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
84+
sudo chroot miniroot qemu-arm-static /bin/sh -ex /scripts/chroot/build.sh
8485
else
8586
echo "Edit chroot_build.sh to support this architecture as well, it should be easy"
8687
exit 1

0 commit comments

Comments
 (0)