@@ -15,12 +15,14 @@ function execute_chroot_script() {
15
15
16
16
# In docker, these extra commands are required to enable this black-magic
17
17
if [ -f /.dockerenv ] && [ " $( uname -m) " != " armv7l" ] && [ " $( uname -m) " != " aarch64" ] ; then
18
- if [ " $BASE_ARCH " == " armv7l" ]; then
18
+ if [ " $BASE_ARCH " == " armv7l" ] || [ " $BASE_ARCH " == " armhf " ] ; then
19
19
update-binfmts --enable qemu-arm
20
20
elif [ " $BASE_ARCH " == " aarch64" ] || [ " $BASE_ARCH " == " arm64" ]; then
21
21
update-binfmts --enable qemu-aarch64
22
22
fi
23
- mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc || true
23
+ if ! mount | grep -q " /proc/sys/fs/binfmt_misc" ; then
24
+ mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc || true
25
+ fi
24
26
fi
25
27
# move filesystem files
26
28
if [ -d " $1 /filesystem" ]; then
@@ -30,7 +32,7 @@ function execute_chroot_script() {
30
32
# black magic of qemu-arm-static
31
33
# cp `which qemu-arm-static` usr/bin
32
34
if [ " $( uname -m) " != " armv7l" ] || [ " $( uname -m) " != " aarch64" ] ; then
33
- if [ " $BASE_ARCH " == " armv7l" ]; then
35
+ if [ " $BASE_ARCH " == " armv7l" ] || [ " $BASE_ARCH " == " armhf " ] ; then
34
36
if (grep -q gentoo /etc/os-release); then
35
37
ROOT=" ` realpath .` " emerge --usepkgonly --oneshot --nodeps qemu
36
38
else
@@ -51,11 +53,14 @@ function execute_chroot_script() {
51
53
chmod 755 common.sh
52
54
53
55
if [ " $( uname -m) " != " armv7l" ] && [ " $( uname -m) " != " aarch64" ] && [ " $( uname -m) " != " arm64" ] ; then
54
- if [ " $BASE_ARCH " == " armv7l" ]; then
56
+ echo " Detected we are on a non-arm device"
57
+ if [ " $BASE_ARCH " == " armv7l" ] || [ " $BASE_ARCH " == " armhf" ]; then
55
58
echo " Building on non-ARM device a armv7l system, using qemu-arm-static"
56
59
if (grep -q gentoo /etc/os-release); then
60
+ echo " Building on gentoo non-ARM device a aarch64/arm64 system, using qemu-aarch64-static"
57
61
chroot . usr/bin/qemu-arm /bin/bash /chroot_script
58
62
else
63
+ echo " Using normal non-arm qemu for armv7l"
59
64
chroot . usr/bin/qemu-arm-static /bin/bash /chroot_script
60
65
fi
61
66
elif [ " $BASE_ARCH " == " aarch64" ] || [ " $BASE_ARCH " == " arm64" ]; then
@@ -65,8 +70,11 @@ function execute_chroot_script() {
65
70
else
66
71
chroot . usr/bin/qemu-aarch64-static /bin/bash /chroot_script
67
72
fi
73
+ else
74
+ echo " Unknown arch, building on: $( uname -m) image: $BASE_ARCH "
75
+ exit 1
68
76
fi
69
- elif [ " $BASE_ARCH " == " armv7l" ] && [ " $( uname -m) " != " armv7l" ]; then
77
+ elif { [ " $BASE_ARCH " == " armv7l" ] || [ " $BASE_ARCH " == " armhf " ] ; } && [ " $( uname -m) " != " armv7l" ]; then
70
78
echo " Building on aarch64/arm64 device a armv7l system, using qemu-arm-static"
71
79
chroot . usr/bin/qemu-arm-static /bin/bash /chroot_script
72
80
else
0 commit comments