I updated to the latest Ubuntu Hirsute to see if it would include performance fixes for qemu-user, since I was having trouble with very slow builds. This brought a new problem, which manifests as a fail to copy qemu-binfmt-P to the target raspberry pi image.
The underlying problem is that newer Ubuntu releases started pointing binfmt_misc at a layer of symlinks rather than the qemu binaries themselves. I haven't written a clean solution for this, but as a workaround you can add a readlink to interpreter_path in prepare_rootfs_for_emulation:
# vim: filetype=sh
ARM_BINFMT_DEF=/proc/sys/fs/binfmt_misc/qemu-arm
ERR_CPU_EMULATION="E: Cannot continue because host OS does not provide ARM cpu emulation."
prepare_rootfs_for_emulation()
{
if [ ! -f $ARM_BINFMT_DEF ]
then
echo "$ERR_CPU_EMULATION" >&2
return 1
fi
set -- $(cat $ARM_BINFMT_DEF | grep interpreter)
interpreter_path="$2"
+ interpreter_path=`readlink -f "$interpreter_path"`
if [ ! -f "./$interpreter_path" ]
then
I updated to the latest Ubuntu Hirsute to see if it would include performance fixes for qemu-user, since I was having trouble with very slow builds. This brought a new problem, which manifests as a fail to copy qemu-binfmt-P to the target raspberry pi image.
The underlying problem is that newer Ubuntu releases started pointing binfmt_misc at a layer of symlinks rather than the qemu binaries themselves. I haven't written a clean solution for this, but as a workaround you can add a readlink to interpreter_path in prepare_rootfs_for_emulation: