Statistics
| Branch: | Revision:

root / scripts / qemu-binfmt-conf.sh @ a4c075f1

History | View | Annotate | Download (5 kB)

1 08785f48 bellard
#!/bin/sh
2 a4c075f1 Ulrich Hecht
# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390 program execution by the kernel
3 08785f48 bellard
4 08785f48 bellard
# load the binfmt_misc module
5 1e0e6d8b ths
if [ ! -d /proc/sys/fs/binfmt_misc ]; then
6 1e0e6d8b ths
  /sbin/modprobe binfmt_misc
7 1e0e6d8b ths
fi
8 1e0e6d8b ths
if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
9 1e0e6d8b ths
  mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
10 1e0e6d8b ths
fi
11 08785f48 bellard
12 08785f48 bellard
# probe cpu type
13 08785f48 bellard
cpu=`uname -m`
14 08785f48 bellard
case "$cpu" in
15 644d6777 Riku Voipio
  i386|i486|i586|i686|i86pc|BePC|x86_64)
16 08785f48 bellard
    cpu="i386"
17 08785f48 bellard
  ;;
18 1e0e6d8b ths
  m68k)
19 1e0e6d8b ths
    cpu="m68k"
20 1e0e6d8b ths
  ;;
21 1e0e6d8b ths
  mips*)
22 1e0e6d8b ths
    cpu="mips"
23 1e0e6d8b ths
  ;;
24 08785f48 bellard
  "Power Macintosh"|ppc|ppc64)
25 08785f48 bellard
    cpu="ppc"
26 08785f48 bellard
  ;;
27 644d6777 Riku Voipio
  armv[4-9]*)
28 08785f48 bellard
    cpu="arm"
29 08785f48 bellard
  ;;
30 08785f48 bellard
esac
31 08785f48 bellard
32 08785f48 bellard
# register the interpreter for each cpu except for the native one
33 08785f48 bellard
if [ $cpu != "i386" ] ; then
34 909a8762 bellard
    echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
35 909a8762 bellard
    echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
36 08785f48 bellard
fi
37 da1f1402 Richard Henderson
if [ $cpu != "alpha" ] ; then
38 da1f1402 Richard Henderson
    echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-alpha:' > /proc/sys/fs/binfmt_misc/register
39 da1f1402 Richard Henderson
fi
40 08785f48 bellard
if [ $cpu != "arm" ] ; then
41 909a8762 bellard
    echo   ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
42 909a8762 bellard
    echo   ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
43 08785f48 bellard
fi
44 08785f48 bellard
if [ $cpu != "sparc" ] ; then
45 909a8762 bellard
    echo   ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
46 08785f48 bellard
fi
47 08785f48 bellard
if [ $cpu != "ppc" ] ; then
48 909a8762 bellard
    echo   ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
49 909a8762 bellard
fi
50 1e0e6d8b ths
if [ $cpu != "m68k" ] ; then
51 1e0e6d8b ths
    echo   'Please check cpu value and header information for m68k!'
52 540635ba ths
    echo   ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
53 1e0e6d8b ths
fi
54 909a8762 bellard
if [ $cpu != "mips" ] ; then
55 1e0e6d8b ths
    # FIXME: We could use the other endianness on a MIPS host.
56 909a8762 bellard
    echo   ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips:' > /proc/sys/fs/binfmt_misc/register
57 909a8762 bellard
    echo   ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsel:' > /proc/sys/fs/binfmt_misc/register
58 540635ba ths
    echo   ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mipsn32:' > /proc/sys/fs/binfmt_misc/register
59 540635ba ths
    echo   ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mipsn32el:' > /proc/sys/fs/binfmt_misc/register
60 540635ba ths
    echo   ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-mips64:' > /proc/sys/fs/binfmt_misc/register
61 540635ba ths
    echo   ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-mips64el:' > /proc/sys/fs/binfmt_misc/register
62 08785f48 bellard
fi
63 644d6777 Riku Voipio
if [ $cpu != "sh" ] ; then
64 644d6777 Riku Voipio
    echo    ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-sh4:' > /proc/sys/fs/binfmt_misc/register
65 644d6777 Riku Voipio
    echo    ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
66 a4c075f1 Ulrich Hecht
if [ $cpu != "s390x" ] ; then
67 a4c075f1 Ulrich Hecht
    echo   ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-s390x:' > /proc/sys/fs/binfmt_misc/register
68 644d6777 Riku Voipio
fi