Main index | Section 8 | Options |
The first argument on the command line indicates the operation to be performed. Operation must be one of the following:
add
name
Optionally, you may specify a mask to do a bitwise AND with the header bytes. This effectively allows you to ignore fields in the binary header that do not uniquely indentify the binary file's type.
An
offset
may be specified for the magic bytes using the
To enable the activator entry the
The interpreter path may also contain arguments for the interpreter including #a which gets replaced by the old argv0 value in the interpreter string. | |
disable name | |
Disable the activator entry identified with name. | |
enable name | |
Enable the activator entry identified with name. | |
list | Take a snapshot and print all the activator entries currently configured. |
lookup name | |
Look up and print out the activator entry identified with name. | |
remove name | |
Remove the activator entry identified with name. | |
# binmiscctl add llvmbc --interpreter ''/usr/bin/lli \ --fake-argv0=#a'' --magic ''BC\xc0\xde'' --size 4 \ --set-enabled
Set the state of the llvmbc image activator to disabled:
# binmiscctl disable llvmbc
Set the state of the llvmbc image activator to enabled:
# binmiscctl enable llvmbc
Delete the llvmbc image activator:
# binmiscctl remove llvmbc
Look up and list the record for the llvmbc image activator:
# binmiscctl lookup llvmbc
Add QEMU bsd-user program as an image activator for ARM AARCH64 binaries:
# binmiscctl add arm64 \ --interpreter "/usr/local/bin/qemu-aarch64-static" \ --magic "\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" \ --size 20 --set-enabled
Add QEMU bsd-user program as an image activator for ARM little-endian binaries:
# binmiscctl add armelf \ --interpreter "/usr/local/bin/qemu-arm-static" \ --magic "\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x02\x00\x28\x00" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" \ --size 20 --set-enabled
Add QEMU bsd-user program as an image activator for ARM big-endian binaries:
# binmiscctl add armebelf \ --interpreter "/usr/local/bin/qemu-arm-static" \ --magic "\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x02\x00\x28" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" \ --size 20 --set-enabled
Add QEMU bsd-user program as an image activator for MIPS32 binaries:
# binmiscctl add mips32 \ --interpreter "/usr/local/bin/qemu-mips-static" \ --magic "\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x02\x00\x08" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" \ --size 20 --set-enabled
Add QEMU bsd-user program as an image activator for MIPS64 binaries:
# binmiscctl add mips64 \ --interpreter "/usr/local/bin/qemu-mips64-static" \ --magic "\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x02\x00\x08" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" \ --size 20 --set-enabled
Add QEMU bsd-user program as an image activator for PowerPC binaries:
# binmiscctl add powerpc \ --interpreter "/usr/local/bin/qemu-ppc-static" \ --magic "\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x02\x00\x14" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" \ --size 20 --set-enabled
Add QEMU bsd-user program as an image activator for PowerPC64 binaries:
# binmiscctl add powerpc64 \ --interpreter "/usr/local/bin/qemu-ppc64-static" \ --magic "\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x02\x00\x15" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" \ --size 20 --set-enabled
Add QEMU bsd-user program as an image activator for SPARC64 binaries:
# binmiscctl add sparc64 \ --interpreter "/usr/local/bin/qemu-sparc64-static" \ --magic "\x7f\x45\x4c\x46\x02\x02\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff" \ --size 20 --set-enabled
Add QEMU bsd-user program as an image activator for 64-bit RISC-V binaries:
# binmiscctl add riscv64 \ --interpreter "/usr/local/bin/qemu-riscv64-static" \ --magic "\x7f\x45\x4c\x46\x02\x01\x01\x00\x00\x00\ \x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00" \ --mask "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\ \xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" \ --size 20 --set-enabled
D=/path/to/chroot cd /usr/src mkdir -p $D make world TARGET=arm TARGET_ARCH=armv6 DESTDIR=$D make distribution TARGET=arm TARGET_ARCH=armv6 DESTDIR=$D
With emulators/qemu-user-static from the FreeBSD Ports Collection, the emulator must be copied into the jail path specified in the binmiscctl command. Using the example above:
mkdir $D/usr/local/bin cp /usr/local/bin/qemu-arm-static $D/usr/local/bin
Now the user can chroot into the environment normally, as root:
chroot $D
BINMISCCTL (8) | April 30, 2020 |
Main index | Section 8 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
“ | "I liken starting one's computing career with Unix, say as an undergraduate, to being born in East Africa. It is intolerably hot, your body is covered with lice and flies, you are malnourished and you suffer from numerous curable diseases. But, as far as young East Africans can tell, this is simply the natural condition and they live within it. By the time they find out differently, it is too late. They already think that the writing of shell scripts is a natural act." | ” |
— Ken Pier, Xerox PARC |