@@ -20,6 +20,7 @@ echo "DIST_PATH=$DIST_PATH"
2020
2121source $DIR /config
2222source $DIR /common.sh
23+ source $DIR /chroot.sh
2324
2425IMAGE=$1
2526if [ " $IMAGE " == " " ]; then
@@ -41,32 +42,6 @@ if [ ! -d "$CUSTOMIZE_SCRIPT_PATH" ]; then
4142 exit 1
4243fi
4344
44- function prepare_environment() {
45- # In docker, these extra commands are required to enable this black-magic
46- if [ -f /.dockerenv ] && [ " $( arch) " != " armv7l" ] && [ " $( arch) " != " aarch64" ] ; then
47- if [ " $EDITBASE_ARCH " == " armv7l" ]; then
48- update-binfmts --enable qemu-arm
49- elif [ " $EDITBASE_ARCH " == " aarch64" ] || [ " $EDITBASE_ARCH " == " arm64" ]; then
50- update-binfmts --enable qemu-aarch64
51- fi
52- (mount | grep -q -v " type binfmt_misc" ) || mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
53- fi
54-
55- # black magic of qemu-arm-static
56- if [ " $( arch) " != " armv7l" ] && [ " $( arch) " != " aarch64" ] ; then
57- if [ " $EDITBASE_ARCH " == " armv7l" ]; then
58- cp ` which qemu-arm-static` usr/bin/qemu-arm-static
59- elif [ " $EDITBASE_ARCH " == " aarch64" ] || [ " $EDITBASE_ARCH " == " arm64" ]; then
60- cp ` which qemu-aarch64-static` usr/bin/qemu-aarch64-static
61- fi
62- fi
63-
64- if [ " $EDITBASE_MOUNT_PROC " == " 1" ]; then
65- echo " Mounting /proc of host..."
66- mount -t proc /proc proc/
67- fi
68- }
69-
7045function copy_files() {
7146 # move filesystem files
7247 if [ -d " $1 " ]; then
@@ -84,18 +59,7 @@ function execute_chroot_script() {
8459
8560 echo " ::group::Running $1 in chroot..."
8661
87- if [ " $( arch) " != " armv7l" ] && [ " $( arch) " != " aarch64" ] && [ " $( arch) " != " arm64" ] ; then
88- if [ " $EDITBASE_ARCH " == " armv7l" ]; then
89- echo " Building an armv7l system on a non-ARM host, using qemu-arm-static"
90- chroot . usr/bin/qemu-arm-static /bin/bash /chroot_script
91- elif [ " $EDITBASE_ARCH " == " aarch64" ] || [ " $EDITBASE_ARCH " == " arm64" ]; then
92- echo " Building an aarch64/arm64 system on a non-ARM host, using qemu-aarch64-static"
93- chroot . usr/bin/qemu-aarch64-static /bin/bash /chroot_script
94- fi
95- else
96- echo " Building an armv7l/aarch64/arm64 system on an ARM host, not using qemu"
97- chroot . /bin/bash /chroot_script
98- fi
62+ chroot . $QEMU /bin/bash /chroot_script
9963
10064 echo " ::endgroup::"
10165
@@ -151,7 +115,7 @@ pushd $EDITBASE_WORKSPACE
151115 fixLd
152116 fi
153117
154- prepare_environment
118+ prepare_chroot_environment
155119
156120 # ## Execute chroot scripts ###
157121
0 commit comments