root / qemu-binfmt-conf.sh @ a7037b29
History | View | Annotate | Download (3 kB)
1 | 08785f48 | bellard | #!/bin/sh |
---|---|---|---|
2 | 1e0e6d8b | ths | # enable automatic i386/ARM/M68K/MIPS/SPARC/PPC 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 | 08785f48 | bellard | i386|i486|i586|i686|i86pc|BePC) |
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 | 08785f48 | bellard | armv4l) |
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 | 08785f48 | bellard | if [ $cpu != "arm" ] ; then |
38 | 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 |
39 | 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 |
40 | 08785f48 | bellard | fi |
41 | 08785f48 | bellard | if [ $cpu != "sparc" ] ; then |
42 | 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 |
43 | 08785f48 | bellard | fi |
44 | 08785f48 | bellard | if [ $cpu != "ppc" ] ; then |
45 | 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 |
46 | 909a8762 | bellard | fi |
47 | 1e0e6d8b | ths | if [ $cpu != "m68k" ] ; then |
48 | 1e0e6d8b | ths | echo 'Please check cpu value and header information for m68k!' |
49 | 1e0e6d8b | ths | echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\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-m68k:' > /proc/sys/fs/binfmt_misc/register |
50 | 1e0e6d8b | ths | fi |
51 | 909a8762 | bellard | if [ $cpu != "mips" ] ; then |
52 | 1e0e6d8b | ths | # FIXME: We could use the other endianness on a MIPS host. |
53 | 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 |
54 | 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 |
55 | 08785f48 | bellard | fi |