Statistics
| Branch: | Revision:

root / qemu-binfmt-conf.sh @ a6f37988

History | View | Annotate | Download (1.9 kB)

1 08785f48 bellard
#!/bin/sh
2 08785f48 bellard
# enable automatic i386/ARM/SPARC/PPC program execution by the kernel
3 08785f48 bellard
4 08785f48 bellard
# load the binfmt_misc module
5 08785f48 bellard
/sbin/modprobe binfmt_misc
6 08785f48 bellard
7 08785f48 bellard
# probe cpu type
8 08785f48 bellard
cpu=`uname -m`
9 08785f48 bellard
case "$cpu" in
10 08785f48 bellard
  i386|i486|i586|i686|i86pc|BePC)
11 08785f48 bellard
    cpu="i386"
12 08785f48 bellard
  ;;
13 08785f48 bellard
  "Power Macintosh"|ppc|ppc64)
14 08785f48 bellard
    cpu="ppc"
15 08785f48 bellard
  ;;
16 08785f48 bellard
  armv4l)
17 08785f48 bellard
    cpu="arm"
18 08785f48 bellard
  ;;
19 08785f48 bellard
esac
20 08785f48 bellard
21 08785f48 bellard
# register the interpreter for each cpu except for the native one
22 08785f48 bellard
if [ $cpu != "i386" ] ; then
23 08785f48 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\xfb\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
24 08785f48 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\xfb\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
25 08785f48 bellard
fi
26 08785f48 bellard
if [ $cpu != "arm" ] ; then
27 08785f48 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\xfb\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
28 808c4954 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\xfb\xff\xff:/usr/local/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
29 08785f48 bellard
fi
30 08785f48 bellard
if [ $cpu != "sparc" ] ; then
31 08785f48 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\xfb\xff\xff\xff:/usr/local/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
32 08785f48 bellard
fi
33 08785f48 bellard
if [ $cpu != "ppc" ] ; then
34 08785f48 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\xfb\xff\xff\xff:/usr/local/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
35 08785f48 bellard
fi