Sure, this was originally shared with me by @tamjan (
original post) but I've found there's no need for manually setting up the binfmt rules like in his original script.
Have these packages installed:
- arch-install-scripts (for arch-chroot)
- qemu-user-static (for qemu-aarch64-static)
- qemu-user-static-binfmt (bin format rules)
Then mount your card's root and boot like normal, e.g.
$this->bbcode_second_pass_code('', 'mount /dev/xxx2 /mnt/pi4root
mount /dev/xxx1 /mnt/pi4root/boot
')
Use arch-chroot and install whatever you need (if you're using a new image you'll have to init the pacman keyring as in the install steps etc):
$this->bbcode_second_pass_code('', 'arch-chroot /mnt/pi4root')
I usually run sync after I've logged out of the chroot.
Edit: Removed the part where the static qemu binary is copied into the root of the pi, it's not needed.