bellard | 08785f4 | 2004-01-04 18:12:46 +0000 | [diff] [blame] | 1 | #!/bin/sh |
ths | 1e0e6d8 | 2007-03-31 19:10:01 +0000 | [diff] [blame] | 2 | # enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel |
bellard | 08785f4 | 2004-01-04 18:12:46 +0000 | [diff] [blame] | 3 | |
| 4 | # load the binfmt_misc module |
ths | 1e0e6d8 | 2007-03-31 19:10:01 +0000 | [diff] [blame] | 5 | if [ ! -d /proc/sys/fs/binfmt_misc ]; then |
| 6 | /sbin/modprobe binfmt_misc |
| 7 | fi |
| 8 | if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then |
| 9 | mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc |
| 10 | fi |
bellard | 08785f4 | 2004-01-04 18:12:46 +0000 | [diff] [blame] | 11 | |
| 12 | # probe cpu type |
| 13 | cpu=`uname -m` |
| 14 | case "$cpu" in |
| 15 | i386|i486|i586|i686|i86pc|BePC) |
| 16 | cpu="i386" |
| 17 | ;; |
ths | 1e0e6d8 | 2007-03-31 19:10:01 +0000 | [diff] [blame] | 18 | m68k) |
| 19 | cpu="m68k" |
| 20 | ;; |
| 21 | mips*) |
| 22 | cpu="mips" |
| 23 | ;; |
bellard | 08785f4 | 2004-01-04 18:12:46 +0000 | [diff] [blame] | 24 | "Power Macintosh"|ppc|ppc64) |
| 25 | cpu="ppc" |
| 26 | ;; |
| 27 | armv4l) |
| 28 | cpu="arm" |
| 29 | ;; |
| 30 | esac |
| 31 | |
| 32 | # register the interpreter for each cpu except for the native one |
| 33 | if [ $cpu != "i386" ] ; then |
bellard | 909a876 | 2005-12-06 21:43:35 +0000 | [diff] [blame] | 34 | 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 | 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 |
bellard | 08785f4 | 2004-01-04 18:12:46 +0000 | [diff] [blame] | 36 | fi |
| 37 | if [ $cpu != "arm" ] ; then |
bellard | 909a876 | 2005-12-06 21:43:35 +0000 | [diff] [blame] | 38 | 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 | 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 |
bellard | 08785f4 | 2004-01-04 18:12:46 +0000 | [diff] [blame] | 40 | fi |
| 41 | if [ $cpu != "sparc" ] ; then |
bellard | 909a876 | 2005-12-06 21:43:35 +0000 | [diff] [blame] | 42 | 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 |
bellard | 08785f4 | 2004-01-04 18:12:46 +0000 | [diff] [blame] | 43 | fi |
| 44 | if [ $cpu != "ppc" ] ; then |
bellard | 909a876 | 2005-12-06 21:43:35 +0000 | [diff] [blame] | 45 | 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 | fi |
ths | 1e0e6d8 | 2007-03-31 19:10:01 +0000 | [diff] [blame] | 47 | if [ $cpu != "m68k" ] ; then |
| 48 | echo 'Please check cpu value and header information for m68k!' |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 49 | 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 |
ths | 1e0e6d8 | 2007-03-31 19:10:01 +0000 | [diff] [blame] | 50 | fi |
bellard | 909a876 | 2005-12-06 21:43:35 +0000 | [diff] [blame] | 51 | if [ $cpu != "mips" ] ; then |
ths | 1e0e6d8 | 2007-03-31 19:10:01 +0000 | [diff] [blame] | 52 | # FIXME: We could use the other endianness on a MIPS host. |
bellard | 909a876 | 2005-12-06 21:43:35 +0000 | [diff] [blame] | 53 | 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 | 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 |
ths | 540635b | 2007-09-30 01:58:33 +0000 | [diff] [blame] | 55 | 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 |
| 56 | 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 |
| 57 | 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 |
| 58 | 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 |
bellard | 08785f4 | 2004-01-04 18:12:46 +0000 | [diff] [blame] | 59 | fi |