qemu-binfmt-conf.sh 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. #!/bin/sh
  2. # Enable automatic program execution by the kernel.
  3. qemu_target_list="i386 i486 alpha arm armeb sparc sparc32plus sparc64 \
  4. ppc ppc64 ppc64le m68k mips mipsel mipsn32 mipsn32el mips64 mips64el \
  5. sh4 sh4eb s390x aarch64 aarch64_be hppa riscv32 riscv64 xtensa xtensaeb \
  6. microblaze microblazeel or1k x86_64 hexagon loongarch64"
  7. i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00'
  8. i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  9. i386_family=i386
  10. i486_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00'
  11. i486_mask='\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  12. i486_family=i386
  13. x86_64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x3e\x00'
  14. x86_64_mask='\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  15. x86_64_family=i386
  16. alpha_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90'
  17. alpha_mask='\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  18. alpha_family=alpha
  19. arm_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00'
  20. arm_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  21. arm_family=arm
  22. armeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28'
  23. armeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  24. armeb_family=armeb
  25. sparc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02'
  26. sparc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  27. sparc_family=sparc
  28. sparc32plus_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12'
  29. sparc32plus_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  30. sparc32plus_family=sparc
  31. sparc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b'
  32. sparc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  33. sparc64_family=sparc
  34. ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14'
  35. ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  36. ppc_family=ppc
  37. ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
  38. ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  39. ppc64_family=ppc
  40. ppc64le_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15\x00'
  41. ppc64le_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
  42. ppc64le_family=ppcle
  43. m68k_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04'
  44. m68k_mask='\xff\xff\xff\xff\xff\xff\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  45. m68k_family=m68k
  46. # FIXME: We could use the other endianness on a MIPS host.
  47. mips_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
  48. mips_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20'
  49. mips_family=mips
  50. mipsel_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
  51. mipsel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00'
  52. mipsel_family=mips
  53. mipsn32_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20'
  54. mipsn32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20'
  55. mipsn32_family=mips
  56. mipsn32el_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00'
  57. mipsn32el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00'
  58. mipsn32el_family=mips
  59. mips64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08'
  60. mips64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  61. mips64_family=mips
  62. mips64el_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
  63. mips64el_mask='\xff\xff\xff\xff\xff\xff\xff\x00\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  64. mips64el_family=mips
  65. sh4_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00'
  66. sh4_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  67. sh4_family=sh4
  68. sh4eb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a'
  69. sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  70. sh4eb_family=sh4
  71. s390x_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'
  72. s390x_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  73. s390x_family=s390x
  74. aarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00'
  75. aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  76. aarch64_family=arm
  77. aarch64_be_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
  78. aarch64_be_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  79. aarch64_be_family=armeb
  80. hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f'
  81. hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  82. hppa_family=hppa
  83. riscv32_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00'
  84. riscv32_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  85. riscv32_family=riscv
  86. riscv64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00'
  87. riscv64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  88. riscv64_family=riscv
  89. xtensa_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e\x00'
  90. xtensa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  91. xtensa_family=xtensa
  92. xtensaeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5e'
  93. xtensaeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  94. xtensaeb_family=xtensaeb
  95. microblaze_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xba\xab'
  96. microblaze_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  97. microblaze_family=microblaze
  98. microblazeel_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xab\xba'
  99. microblazeel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  100. microblazeel_family=microblazeel
  101. or1k_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x5c'
  102. or1k_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  103. or1k_family=or1k
  104. hexagon_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xa4\x00'
  105. hexagon_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  106. hexagon_family=hexagon
  107. loongarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01'
  108. loongarch64_mask='\xff\xff\xff\xff\xff\xff\xff\xfc\x00\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  109. loongarch64_family=loongarch
  110. # Converts the name of a host CPU architecture to the corresponding QEMU
  111. # target.
  112. #
  113. # FIXME: This can probably be simplified a lot by dropping most entries.
  114. # Remember that the script is only used on Linux, so we only need to
  115. # handle the strings Linux uses to report the host CPU architecture.
  116. qemu_normalize() {
  117. cpu="$1"
  118. case "$cpu" in
  119. i[3-6]86)
  120. echo "i386"
  121. ;;
  122. amd64)
  123. echo "x86_64"
  124. ;;
  125. powerpc)
  126. echo "ppc"
  127. ;;
  128. ppc64el)
  129. echo "ppc64le"
  130. ;;
  131. armel|armhf|armv[4-9]*l)
  132. echo "arm"
  133. ;;
  134. armv[4-9]*b)
  135. echo "armeb"
  136. ;;
  137. arm64)
  138. echo "aarch64"
  139. ;;
  140. *)
  141. echo "$cpu"
  142. ;;
  143. esac
  144. }
  145. usage() {
  146. cat <<EOF
  147. Usage: qemu-binfmt-conf.sh [--qemu-path PATH][--debian][--systemd CPU]
  148. [--help][--credential yes|no][--exportdir PATH]
  149. [--persistent yes|no][--qemu-suffix SUFFIX]
  150. [--preserve-argv0 yes|no]
  151. Configure binfmt_misc to use qemu interpreter
  152. --help: display this usage
  153. --qemu-path: set path to qemu interpreter ($QEMU_PATH)
  154. --qemu-suffix: add a suffix to the default interpreter name
  155. --debian: don't write into /proc,
  156. instead generate update-binfmts templates
  157. --systemd: don't write into /proc,
  158. instead generate file for systemd-binfmt.service
  159. for the given CPU. If CPU is "ALL", generate a
  160. file for all known cpus
  161. --exportdir: define where to write configuration files
  162. (default: $SYSTEMDDIR or $DEBIANDIR)
  163. --credential: if yes, credential and security tokens are
  164. calculated according to the binary to interpret
  165. --persistent: if yes, the interpreter is loaded when binfmt is
  166. configured and remains in memory. All future uses
  167. are cloned from the open file.
  168. --ignore-family: if yes, it is assumed that the host CPU (e.g. riscv64)
  169. can't natively run programs targeting a CPU that is
  170. part of the same family (e.g. riscv32).
  171. --preserve-argv0 preserve argv[0]
  172. To import templates with update-binfmts, use :
  173. sudo update-binfmts --importdir ${EXPORTDIR:-$DEBIANDIR} --import qemu-CPU
  174. To remove interpreter, use :
  175. sudo update-binfmts --package qemu-CPU --remove qemu-CPU $QEMU_PATH
  176. With systemd, binfmt files are loaded by systemd-binfmt.service
  177. The environment variable HOST_ARCH allows to override 'uname' to generate
  178. configuration files for a different architecture than the current one.
  179. where CPU is one of:
  180. $qemu_target_list
  181. EOF
  182. }
  183. qemu_check_access() {
  184. if [ ! -w "$1" ] ; then
  185. echo "ERROR: cannot write to $1" 1>&2
  186. exit 1
  187. fi
  188. }
  189. qemu_check_bintfmt_misc() {
  190. # load the binfmt_misc module
  191. if [ ! -d /proc/sys/fs/binfmt_misc ]; then
  192. if ! /sbin/modprobe binfmt_misc ; then
  193. exit 1
  194. fi
  195. fi
  196. if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
  197. if ! mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc ; then
  198. exit 1
  199. fi
  200. fi
  201. qemu_check_access /proc/sys/fs/binfmt_misc/register
  202. }
  203. installed_dpkg() {
  204. dpkg --status "$1" > /dev/null 2>&1
  205. }
  206. qemu_check_debian() {
  207. if [ ! -e /etc/debian_version ] ; then
  208. echo "WARNING: your system is not a Debian based distro" 1>&2
  209. elif ! installed_dpkg binfmt-support ; then
  210. echo "WARNING: package binfmt-support is needed" 1>&2
  211. fi
  212. qemu_check_access "$EXPORTDIR"
  213. }
  214. qemu_check_systemd() {
  215. if ! systemctl -q is-enabled systemd-binfmt.service ; then
  216. echo "WARNING: systemd-binfmt.service is missing or disabled" 1>&2
  217. fi
  218. qemu_check_access "$EXPORTDIR"
  219. }
  220. qemu_generate_register() {
  221. flags=""
  222. if [ "$CREDENTIAL" = "yes" ] ; then
  223. flags="OC"
  224. fi
  225. if [ "$PERSISTENT" = "yes" ] ; then
  226. flags="${flags}F"
  227. fi
  228. if [ "$PRESERVE_ARG0" = "yes" ] ; then
  229. flags="${flags}P"
  230. fi
  231. echo ":qemu-$cpu:M::$magic:$mask:$qemu:$flags"
  232. }
  233. qemu_register_interpreter() {
  234. echo "Setting $qemu as binfmt interpreter for $cpu"
  235. qemu_generate_register > /proc/sys/fs/binfmt_misc/register
  236. }
  237. qemu_generate_systemd() {
  238. echo "Setting $qemu as binfmt interpreter for $cpu for systemd-binfmt.service"
  239. qemu_generate_register > "$EXPORTDIR/qemu-$cpu.conf"
  240. }
  241. qemu_generate_debian() {
  242. cat > "$EXPORTDIR/qemu-$cpu" <<EOF
  243. package qemu-$cpu
  244. interpreter $qemu
  245. magic $magic
  246. mask $mask
  247. credentials $CREDENTIAL
  248. preserve $PRESERVE_ARG0
  249. fix_binary $PERSISTENT
  250. EOF
  251. }
  252. qemu_set_binfmts() {
  253. # probe cpu type
  254. host_cpu=$(qemu_normalize ${HOST_ARCH:-$(uname -m)})
  255. host_family=$(eval echo \$${host_cpu}_family)
  256. if [ "$host_family" = "" ] ; then
  257. echo "INTERNAL ERROR: unknown host cpu $host_cpu" 1>&2
  258. exit 1
  259. fi
  260. # register the interpreter for each cpu except for the native one
  261. for cpu in ${qemu_target_list} ; do
  262. magic=$(eval echo \$${cpu}_magic)
  263. mask=$(eval echo \$${cpu}_mask)
  264. family=$(eval echo \$${cpu}_family)
  265. target="$cpu"
  266. if [ "$cpu" = "i486" ] ; then
  267. target="i386"
  268. fi
  269. qemu="$QEMU_PATH/qemu-$target$QEMU_SUFFIX"
  270. if [ "$magic" = "" ] || [ "$mask" = "" ] || [ "$family" = "" ] ; then
  271. echo "INTERNAL ERROR: unknown cpu $cpu" 1>&2
  272. continue
  273. fi
  274. if [ "$host_family" = "$family" ] ; then
  275. # When --ignore-family is used, we have to generate rules even
  276. # for targets that are in the same family as the host CPU. The
  277. # only exception is of course when the CPU types exactly match
  278. if [ "$target" = "$host_cpu" ] || [ "$IGNORE_FAMILY" = "no" ] ; then
  279. continue
  280. fi
  281. fi
  282. $BINFMT_SET
  283. done
  284. }
  285. CHECK=qemu_check_bintfmt_misc
  286. BINFMT_SET=qemu_register_interpreter
  287. SYSTEMDDIR="/etc/binfmt.d"
  288. DEBIANDIR="/usr/share/binfmts"
  289. QEMU_PATH=/usr/local/bin
  290. CREDENTIAL=no
  291. PERSISTENT=no
  292. PRESERVE_ARG0=no
  293. QEMU_SUFFIX=""
  294. IGNORE_FAMILY=no
  295. _longopts="debian,systemd:,qemu-path:,qemu-suffix:,exportdir:,help,credential:,\
  296. persistent:,preserve-argv0:,ignore-family:"
  297. options=$(getopt -o ds:Q:S:e:hc:p:g:F:i: -l ${_longopts} -- "$@")
  298. eval set -- "$options"
  299. while true ; do
  300. case "$1" in
  301. -d|--debian)
  302. CHECK=qemu_check_debian
  303. BINFMT_SET=qemu_generate_debian
  304. EXPORTDIR=${EXPORTDIR:-$DEBIANDIR}
  305. ;;
  306. -s|--systemd)
  307. CHECK=qemu_check_systemd
  308. BINFMT_SET=qemu_generate_systemd
  309. EXPORTDIR=${EXPORTDIR:-$SYSTEMDDIR}
  310. shift
  311. # check given cpu is in the supported CPU list
  312. if [ "$1" != "ALL" ] ; then
  313. for cpu in ${qemu_target_list} ; do
  314. if [ "$cpu" = "$1" ] ; then
  315. break
  316. fi
  317. done
  318. if [ "$cpu" = "$1" ] ; then
  319. qemu_target_list="$1"
  320. else
  321. echo "ERROR: unknown CPU \"$1\"" 1>&2
  322. usage
  323. exit 1
  324. fi
  325. fi
  326. ;;
  327. -Q|--qemu-path)
  328. shift
  329. QEMU_PATH="$1"
  330. ;;
  331. -F|--qemu-suffix)
  332. shift
  333. QEMU_SUFFIX="$1"
  334. ;;
  335. -e|--exportdir)
  336. shift
  337. EXPORTDIR="$1"
  338. ;;
  339. -h|--help)
  340. usage
  341. exit 1
  342. ;;
  343. -c|--credential)
  344. shift
  345. CREDENTIAL="$1"
  346. ;;
  347. -p|--persistent)
  348. shift
  349. PERSISTENT="$1"
  350. ;;
  351. -g|--preserve-argv0)
  352. shift
  353. PRESERVE_ARG0="$1"
  354. ;;
  355. -i|--ignore-family)
  356. shift
  357. IGNORE_FAMILY="$1"
  358. ;;
  359. *)
  360. break
  361. ;;
  362. esac
  363. shift
  364. done
  365. $CHECK
  366. qemu_set_binfmts