commit 6e54ea1b899b34b4cf1fa2f9450df65590bab35a parent fd63e7a924b32bb577fab84710188a4995b3bf3d Author: Andreas Gruhler <agruhl@gmx.ch> Date: Tue, 9 Aug 2022 23:40:28 +0200 doc: binfmt_misc and static binaries Diffstat:
M | README.md | | | 27 | +++++++++++++++++++++++---- |
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md @@ -85,11 +85,30 @@ Install the statically linked qemu (emulator) binary. On Debian/Ubuntu: sudo apt-get install qemu-user-static ``` -For other distributions, a [recent `qemu-arm-static` binary can be downloaded](https://github.com/multiarch/qemu-user-static/releases/download/v7.0.0-7/qemu-arm-static) and moved to the proper location for [`binfmt_misc`](https://en.wikipedia.org/wiki/Binfmt_misc) to pick it up: +For other distributions, a [recent `qemu-aarch64-static` binary can be downloaded](https://github.com/multiarch/qemu-user-static/releases) and moved to the proper location for [`binfmt_misc`](https://en.wikipedia.org/wiki/Binfmt_misc) to pick it up: ```bash -curl -LO https://github.com/multiarch/qemu-user-static/releases/download/v7.0.0-7/qemu-arm-static -chmod +x qemu-arm-static -sudo mv qemu-arm-static /usr/bin/qemu-arm-static +curl -LO https://github.com/multiarch/qemu-user-static/releases/download/v7.0.0-7/qemu-aarch64-static +chmod +x qemu-aarch64-static +sudo mv qemu-arm-static /usr/bin/qemu-aarch64-static +``` + +Also, make sure to choose the correct "static" binary for the OS architecture in [`hashi-pi.json`](./hashi-pi.json): +```bash + "qemu_binary_source_path": "/usr/bin/qemu-aarch64-static", + "qemu_binary_destination_path": "/usr/bin/qemu-aarch64-static" +``` + +Configure `binfmt_misc` to use the static binaries: +```bash +# Example from: +# https://github.com/multiarch/qemu-user-static/blob/master/containers/latest/register.sh +sudo qemu-binfmt-conf.sh --qemu-suffix "-static" --qemu-path /usr/bin + +# Check +cat /proc/sys/fs/binfmt_misc/qemu-aarch64 +enabled +interpreter /usr/bin/qemu-aarch64-static +... ``` Run packer with a value file to build an image for one host: