Commit 15789ee
committed
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>1 parent 3ce7dec commit 15789ee
3 files changed
Lines changed: 117 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
16 | 21 | | |
17 | 22 | | |
18 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
22 | 29 | | |
| |||
48 | 55 | | |
49 | 56 | | |
50 | 57 | | |
51 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
52 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
53 | 71 | | |
54 | 72 | | |
55 | 73 | | |
| |||
97 | 115 | | |
98 | 116 | | |
99 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
100 | 204 | | |
101 | 205 | | |
102 | 206 | | |
| |||
171 | 275 | | |
172 | 276 | | |
173 | 277 | | |
174 | | - | |
| 278 | + | |
175 | 279 | | |
176 | 280 | | |
177 | 281 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
| |||
0 commit comments