2 .\" Copyright (c) 2013 Stacey D. Son
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" Support for miscellaneous binary image activators
35 .Nd manage binary image activators
47 .Op Fl -offset Ar offset
67 is the management utility for configuring miscellaneous binaries image
68 activators in the kernel.
69 It allows adding, deleting, disabling,
70 enabling, and looking up interpreters.
71 Also, all the interpreters can
74 The first argument on the command line indicates the operation to be
76 Operation must be one of the following:
77 .Bl -tag -width indent
88 .Op Fl -offset Ar offset
91 Add a new activator entry in the kernel.
100 bytes that uniquely identify a suitable binary for the activator,
107 Optionally, you may specify a
109 to do a bitwise AND with the header bytes.
110 This effectively allows you to ignore fields in the binary header that
111 do not uniquely indentify the binary file's type.
115 may be specified for the magic bytes using the
122 To enable the activator entry the
125 The activator default state is disabled.
129 may also contain arguments for the interpreter including
131 which gets replaced by the old
133 value in the interpreter string.
134 .It Cm disable Ar name
135 Disable the activator entry identified with
137 .It Cm enable Ar name
138 Enable the activator entry identified with
141 Take a snapshot and print all the activator entries currently configured.
142 .It Cm lookup Ar name
143 Look up and print out the activator entry identified with
145 .It Cm remove Ar name
146 Remove the activator entry identified with
150 Add an image activator to run the LLVM interpreter
155 compiled files and set its state to enabled.
158 is replaced with the old
164 .Bd -literal -offset indent
165 # binmiscctl add llvmbc --interpreter ''/usr/bin/lli \e
166 --fake-argv0=#a'' --magic ''BC\\xc0\\xde'' --size 4 \e
172 image activator to disabled:
173 .Bd -literal -offset indent
174 # binmiscctl disable llvmbc
179 image activator to enabled:
180 .Bd -literal -offset indent
181 # binmiscctl enable llvmbc
187 .Bd -literal -offset indent
188 # binmiscctl remove llvmbc
191 Look up and list the record for the
194 .Bd -literal -offset indent
195 # binmiscctl lookup llvmbc
198 Add QEMU bsd-user program as an image activator for ARM AARCH64 binaries:
199 .Bd -literal -offset indent
200 # binmiscctl add arm64 \e
201 --interpreter "/usr/local/bin/qemu-aarch64-static" \e
202 --magic "\ex7f\ex45\ex4c\ex46\ex02\ex01\ex01\ex00\ex00\ex00\e
203 \ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\exb7\ex00" \e
204 --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
205 \exff\exff\exff\exff\exff\exff\exfe\exff\exff\exff" \e
206 --size 20 --set-enabled
209 Add QEMU bsd-user program as an image activator for ARM little-endian binaries:
210 .Bd -literal -offset indent
211 # binmiscctl add armelf \e
212 --interpreter "/usr/local/bin/qemu-arm-static" \e
213 --magic "\ex7f\ex45\ex4c\ex46\ex01\ex01\ex01\ex00\ex00\ex00\e
214 \ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex28\ex00" \e
215 --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
216 \exff\exff\exff\exff\exff\exff\exfe\exff\exff\exff" \e
217 --size 20 --set-enabled
220 Add QEMU bsd-user program as an image activator for ARM big-endian binaries:
221 .Bd -literal -offset indent
222 # binmiscctl add armebelf \e
223 --interpreter "/usr/local/bin/qemu-arm-static" \e
224 --magic "\ex7f\ex45\ex4c\ex46\ex01\ex02\ex01\ex00\ex00\ex00\e
225 \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex28" \e
226 --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
227 \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
228 --size 20 --set-enabled
231 Add QEMU bsd-user program as an image activator for MIPS32 binaries:
232 .Bd -literal -offset indent
233 # binmiscctl add mips32 \e
234 --interpreter "/usr/local/bin/qemu-mips-static" \e
235 --magic "\ex7f\ex45\ex4c\ex46\ex01\ex02\ex01\ex00\ex00\ex00\e
236 \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex08" \e
237 --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
238 \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
239 --size 20 --set-enabled
242 Add QEMU bsd-user program as an image activator for MIPS64 binaries:
243 .Bd -literal -offset indent
244 # binmiscctl add mips64 \e
245 --interpreter "/usr/local/bin/qemu-mips64-static" \e
246 --magic "\ex7f\ex45\ex4c\ex46\ex02\ex02\ex01\ex00\ex00\ex00\e
247 \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex08" \e
248 --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
249 \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
250 --size 20 --set-enabled
253 Add QEMU bsd-user program as an image activator for PowerPC binaries:
254 .Bd -literal -offset indent
255 # binmiscctl add powerpc \e
256 --interpreter "/usr/local/bin/qemu-ppc-static" \e
257 --magic "\ex7f\ex45\ex4c\ex46\ex01\ex02\ex01\ex00\ex00\ex00\e
258 \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex14" \e
259 --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
260 \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
261 --size 20 --set-enabled
264 Add QEMU bsd-user program as an image activator for PowerPC64 binaries:
265 .Bd -literal -offset indent
266 # binmiscctl add powerpc64 \e
267 --interpreter "/usr/local/bin/qemu-ppc64-static" \e
268 --magic "\ex7f\ex45\ex4c\ex46\ex02\ex02\ex01\ex00\ex00\ex00\e
269 \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex15" \e
270 --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
271 \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
272 --size 20 --set-enabled
275 Add QEMU bsd-user program as an image activator for SPARC64 binaries:
276 .Bd -literal -offset indent
277 # binmiscctl add sparc64 \e
278 --interpreter "/usr/local/bin/qemu-sparc64-static" \e
279 --magic "\ex7f\ex45\ex4c\ex46\ex02\ex02\ex01\ex00\ex00\ex00\e
280 \ex00\ex00\ex00\ex00\ex00\ex00\ex00\ex02\ex00\ex2b" \e
281 --mask "\exff\exff\exff\exff\exff\exff\exff\ex00\exff\exff\e
282 \exff\exff\exff\exff\exff\exff\exff\exfe\exff\exff" \e
283 --size 20 --set-enabled
285 .Ss "Create and use an ARMv6 chroot on an AMD64 host"
286 Use an existing source tree to build a chroot host with architecture
288 .Bd -literal -offset ident
292 make world TARGET=arm TARGET_ARCH=armv6 DESTDIR=$D
293 make distribution TARGET=arm TARGET_ARCH=armv6 DESTDIR=$D
297 .Pa emulators/qemu-user-static
300 Ports Collection, the emulator must be copied into the jail path
304 Using the example above:
305 .Bd -literal -offset -ident
306 mkdir $D/usr/local/bin
307 cp /usr/local/bin/qemu-arm-static $D/usr/local/bin
310 Now the user can chroot into the environment normally, as root:
311 .Bd -literal -offset -ident
323 It was developed to support the imgact_binmisc kernel module.
325 .An Stacey D Son Aq Mt sson@FreeBSD.org