hypriot / qemu-register

Docker Image to register Qemu interpreters for ARMHF/AARCH64/PPC64LE/Risc-V in Docker Host w/ Linux Kernel 4.8+
MIT License
61 stars 17 forks source link

register x86_64-linux-user #11

Open yahavb opened 1 year ago

yahavb commented 1 year ago

I am trying to emulate x86_64 compiled code to run on aarch64 so I try to register the new x86_64-linux-user interpreter.

I added x86_64-linux-user to the TARGET_ARCH and

COPY --from=qemu /usr/local/bin/qemu-x86_64 /qemu-x86_64

Build works well I can't figure out the hex sequence needed to /proc/sys/fs/binfmt_misc/register in register.sh

e.g. for aarch64 it is

echo ':qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/qemu-aarch64:CF' > /proc/sys/fs/binfmt_misc/register

Any hint into how to get that sequence?

yahavb commented 1 year ago

I see other examples for registering binary format handlers like in https://docs.kernel.org/admin-guide/binfmt-misc.html but I can't figure out the offset:magic:mask values for x86