You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(rootfs): native armhf on aarch64 host via runtime-disable of qemu-arm
Continues #9284 (arm64-compat-vdso extension + custom_kernel_make_params hook).
That PR enabled COMPAT_VDSO in arm64 kernels and wired CROSS_COMPILE_COMPAT
through the build; this PR uses the resulting 32-bit-capable kernels to run
32-bit ARM ELF directly instead of through qemu-arm emulation in the
image-build chroot work.
Disable qemu-arm in /proc/sys/fs/binfmt_misc for the duration of the
image-build so 32-bit ARM ELF falls through to kernel binfmt_elf and
runs natively via CONFIG_COMPAT — typically ~12x faster than qemu-arm
emulation on common ARM cores (Cortex-A53/A55/A72/A73/A76). A cleanup
handler re-enables qemu-arm on build exit (success or failure).
Empirical: helios4 BUILD_MINIMAL armhf rootfs cache-miss build on
RK3568 (Cortex-A55) drops from 60:35 to 19:27 — 3.12x speedup; same
build with rootfs cache-hit drops to 6:38 (~5x).
Activation point is delayed to AFTER mmdebstrap (in
create_new_rootfs_cache_via_debootstrap, right past the bash-presence
check) and also at build_rootfs_and_image entry for the rootfs-cache
hit path. Earlier activation breaks mmdebstrap because its cross-arch
machinery requires a working qemu-arm in binfmt_misc and the chroot is
not yet populated for native exec.
Out-of-scope cases (target arch != armhf, host arch != aarch64) return
silently with no log noise. In-scope cases log the capability-check
outcome at info level: native enabled, already-effective no-op, or
32-bit ARM execution unsupported (no COMPAT_VDSO in kernel, Apple
Silicon, ARMv9-only cores) — falling back to qemu-arm-static
emulation. Both docker and native (no-container) builds qualify;
the killswitch is the user-facing opt-out.
Killswitch: NATIVE_ARMHF_ON_ARM64=no disables this path entirely,
before any detection runs — useful on shared build farms or whenever
opting out is desired (synonyms 'never' and 'disabled' are accepted
by the parser).
Sets ARMBIAN_NATIVE_ARMHF_VIA_BINFMT_ELF=yes when active so that
deploy_qemu_binary_to_chroot / undeploy_qemu_binary_from_chroot skip
copying qemu-arm-static into the chroot during image-stage (the kernel
handles the ELF directly).
Caveat: the container shares /proc/sys/fs/binfmt_misc with the host's
init user-ns (Armbian's image-build container has CAP_SYS_ADMIN
regardless of DOCKER_PRIVILEGED), so disabling qemu-arm affects the
host's other concurrent processes for the duration of the build. Same
applies to native (no-container) builds where the host IS the build
host. Acceptable for single-user builders, problematic for shared
build farms where NATIVE_ARMHF_ON_ARM64=no is the right setting.
Assisted-by: Claude:claude-opus-4.7
Signed-off-by: Igor Velkov <325961+iav@users.noreply.github.com>
display_alert "Native armhf via binfmt_elf""could not disable qemu-arm (no CAP_SYS_ADMIN?); falling back to qemu-arm-static emulation""wrn"
185
+
return 1
186
+
fi
187
+
declare -g _native_armhf_disabled_qemu_arm=yes
188
+
189
+
# Authoritative check: re-run arch-test with qemu-arm now disabled. This
190
+
# reflects what the chroot exec will actually face. arch-test passes pre-disable
191
+
# even on hosts without real native AArch32 execution because qemu-arm interprets
192
+
# its stub — typically when the host kernel was built without COMPAT_VDSO
193
+
# (extensions/arm64-compat-vdso, see PR #9284).
194
+
if! arch-test armhf > /dev/null 2>&1;then
195
+
display_alert "Native armhf via binfmt_elf""post-disable verification failed (host kernel lacks COMPAT_VDSO — see extensions/arm64-compat-vdso); restoring qemu-arm and falling back to emulation""wrn"
0 commit comments