Skip to main content
Topic: How enable aarch64 binary support [SOLVED] (Read 917 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How enable aarch64 binary support [SOLVED]

https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/binfmt-misc.rst
According to the doc to enable something you use:
Code: [Select]
#enable support for packed DOS applications (pre-configured dosemu hdimages):
echo ':DEXE:M::\x0eDEX::/usr/bin/dosexec:' > register

I have installed qemu-system-aarch64, qemu-user-static, qemu-user-static-binfmt.

Code: [Select]
cat /proc/sys/fs/binfmt_misc/status 
enabled
ls /proc/sys/fs/binfmt_misc/
register  status

I'd like to chroot to aarch64 systems, that's why I am doing this (from x86_64).

Re: How enable aarch64 binary support

Reply #1
There is some binfmt file provided by one of qemu packages, you can cat it in the same way
ARMtix

Re: How enable aarch64 binary support

Reply #2
I listed the files installed, I think that it is this:
Code: [Select]
cat /usr/lib/binfmt.d/qemu-aarch64-static.conf
: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:/usr/bin/qemu-aarch64-static:FP
Or maybe be-static?
Code: [Select]
qemu-user-static-binfmt /usr/lib/binfmt.d/qemu-aarch64-static.conf
qemu-user-static-binfmt /usr/lib/binfmt.d/qemu-aarch64_be-static.conf


I used this:
Code: [Select]
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:/usr/bin/qemu-aarch64-static:' > /proc/sys/fs/binfmt_misc/register 
Is it correct?

I cannot cat the register:
Code: [Select]
cat /proc/sys/fs/binfmt_misc/register 
cat: /proc/sys/fs/binfmt_misc/register: Invalid argument
Is that normal?


Re: How enable aarch64 binary support

Reply #4
It worked I have the qemu-aarch64 file there and I can chroot.

Now I have all of them:
Code: [Select]
ls /proc/sys/fs/binfmt_misc
qemu-aarch64       qemu-mips       qemu-riscv64
qemu-aarch64_be    qemu-mips64     qemu-s390x
qemu-alpha         qemu-mips64el   qemu-sh4
qemu-arm           qemu-mipsel     qemu-sh4eb
qemu-armeb         qemu-mipsn32    qemu-sparc
qemu-hexagon       qemu-mipsn32el  qemu-sparc32plus
qemu-hppa          qemu-or1k       qemu-sparc64
qemu-loongarch64   qemu-ppc        qemu-xtensa
qemu-m68k          qemu-ppc64      qemu-xtensaeb
qemu-microblaze    qemu-ppc64le    register
qemu-microblazeel  qemu-riscv32    status
Not sure what triggered that.

Edit:
The binfmt service, from dinit-rc, should do that automatically.
So you can just restart that.

Instead of powering off the device I hibernated so it wasn't restarted.