Skip to content

Commit ffdd85e

Browse files
committed
Fix i386 again, but correctly
I moved too fast and forgot to re-test amd64, which was ironically broken by my i386 fix, so now we do the full "distro arch to 'busybox arch'" conversion for the set of arches we support (which isn't *that* big).
1 parent 0900032 commit ffdd85e

File tree

7 files changed

+70
-21
lines changed

7 files changed

+70
-21
lines changed

Dockerfile-builder.template

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ RUN set -eux; \
1515
tzdata \
1616
# busybox's tar ironically does not maintain mtime of directories correctly (which we need for SOURCE_DATE_EPOCH / reproducibility)
1717
tar \
18-
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
19-
dpkg-dev dpkg \
2018
;
2119
{{ ) else ( -}}
2220
FROM debian:bookworm-slim
@@ -30,8 +28,6 @@ RUN set -eux; \
3028
gnupg \
3129
make \
3230
patch \
33-
# we use dpkg-architecture to pass a sane (userspace) "ARCH" to busybox's Makefile (see below)
34-
dpkg-dev \
3531
; \
3632
rm -rf /var/lib/apt/lists/*
3733
{{ ) end -}}
@@ -350,7 +346,20 @@ RUN set -eux; \
350346
export CROSS_COMPILE="$CROSS_COMPILE-"; \
351347
{{ ) else ( -}}
352348
# we need to override SUBARCH explicitly (via ARCH) to avoid "uname -m" which gives the wrong answer for builds like i386 on an amd64 machine because kernel architecture != userspace architecture
353-
ARCH="$(dpkg-architecture --query DEB_HOST_ARCH_CPU)"; \
349+
# see https://git.busybox.net/busybox/tree/arch?h=1_37_stable#n145 for the only important values this *has* to match (everything else is best-effort, and needs to match the munging in https://git.busybox.net/busybox/tree/Makefile?h=1_37_stable#n185)
350+
distroArch="$({{ if env.variant == "musl" then "apk --print-arch" else "dpkg --print-architecture" end }})"; \
351+
case "$distroArch" in \
352+
amd64 | x86_64) ARCH='x86_64' ;; \
353+
arm64 | aarch64) ARCH='aarch64' ;; \
354+
armhf | armel | armv*) ARCH='arm' ;; \
355+
i386 | x86) ARCH='i386' ;; \
356+
mips*) ARCH='mips' ;; \
357+
ppc*) ARCH='powerpc' ;; \
358+
riscv64) ARCH='riscv64' ;; \
359+
s390x) ARCH='s390' ;; \
360+
*) echo >&2 "error: unknown architecture: '$distroArch'"; exit 1 ;; \
361+
esac; \
362+
[ -n "$ARCH" ]; \
354363
export ARCH; \
355364
{{ ) end -}}
356365
make -j "$nproc" busybox; \

latest-1/glibc/Dockerfile.builder

Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

latest-1/musl/Dockerfile.builder

Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

latest-1/uclibc/Dockerfile.builder

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

latest/glibc/Dockerfile.builder

Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

latest/musl/Dockerfile.builder

Lines changed: 14 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

latest/uclibc/Dockerfile.builder

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)