Skip to content

pmb.parse.arch: use qemu for running armhf on aarch64

Administrator requested to merge craftyguy/armhf-emul-on-aarch64 into master

This works around an issue where some armhf apps are compiled with instructions that are not compatible with aarch64, for example apk uses MCR, and that does not exist on aarch64 causing apk to fail in a chroot with SIGILL. It's impossible to build armhf images on aarch64 hosts. This also fixes a crash when running pmbootstrap zap -a, since pmb zap will init an armhf chroot and blow up with apk generates a SIGILL.

For reference, here's how I arrived at the conclusion that apk (and gdb, and probably others...) are executing invalid instructions on aarch64 when not using binfmt+qemu emulation:

$ uname -m
aarch64

$ file sbin/apk.static
sbin/apk.static: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, BuildID[sha1]=997a8ef97b17cb4951a6220b7807a66fed67bc10, stripped

$ gdb sbin/apk.static
(gdb) r
Starting program: /run/user/10000/foo/sbin/apk.static
Program received signal SIGILL, Illegal instruction.
0x0012843c in ?? ()
(gdb) x /1i $pc
=> 0x12843c:    mcr     15, 0, r0, cr7, cr10, {5}

Merge request reports

Loading