blob: c50beb733716c0c5b7f8f54f57f590bdc533773b [file] [log] [blame]
bellard08785f42004-01-04 18:12:46 +00001#!/bin/sh
ths1e0e6d82007-03-31 19:10:01 +00002# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
bellard08785f42004-01-04 18:12:46 +00003
4# load the binfmt_misc module
ths1e0e6d82007-03-31 19:10:01 +00005if [ ! -d /proc/sys/fs/binfmt_misc ]; then
6 /sbin/modprobe binfmt_misc
7fi
8if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
9 mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
10fi
bellard08785f42004-01-04 18:12:46 +000011
12# probe cpu type
13cpu=`uname -m`
14case "$cpu" in
Riku Voipio644d6772010-12-01 14:53:10 +020015 i386|i486|i586|i686|i86pc|BePC|x86_64)
bellard08785f42004-01-04 18:12:46 +000016 cpu="i386"
17 ;;
ths1e0e6d82007-03-31 19:10:01 +000018 m68k)
19 cpu="m68k"
20 ;;
21 mips*)
22 cpu="mips"
23 ;;
bellard08785f42004-01-04 18:12:46 +000024 "Power Macintosh"|ppc|ppc64)
25 cpu="ppc"
26 ;;
Riku Voipio644d6772010-12-01 14:53:10 +020027 armv[4-9]*)
bellard08785f42004-01-04 18:12:46 +000028 cpu="arm"
29 ;;
30esac
31
32# register the interpreter for each cpu except for the native one
33if [ $cpu != "i386" ] ; then
bellard909a8762005-12-06 21:43:35 +000034 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
bellard08785f42004-01-04 18:12:46 +000036fi
Richard Hendersonda1f1402009-12-09 15:40:11 -080037if [ $cpu != "alpha" ] ; then
38 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
39fi
bellard08785f42004-01-04 18:12:46 +000040if [ $cpu != "arm" ] ; then
bellard909a8762005-12-06 21:43:35 +000041 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 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
bellard08785f42004-01-04 18:12:46 +000043fi
44if [ $cpu != "sparc" ] ; then
bellard909a8762005-12-06 21:43:35 +000045 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
bellard08785f42004-01-04 18:12:46 +000046fi
47if [ $cpu != "ppc" ] ; then
bellard909a8762005-12-06 21:43:35 +000048 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
49fi
ths1e0e6d82007-03-31 19:10:01 +000050if [ $cpu != "m68k" ] ; then
51 echo 'Please check cpu value and header information for m68k!'
ths540635b2007-09-30 01:58:33 +000052 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
ths1e0e6d82007-03-31 19:10:01 +000053fi
bellard909a8762005-12-06 21:43:35 +000054if [ $cpu != "mips" ] ; then
ths1e0e6d82007-03-31 19:10:01 +000055 # FIXME: We could use the other endianness on a MIPS host.
bellard909a8762005-12-06 21:43:35 +000056 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 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
ths540635b2007-09-30 01:58:33 +000058 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 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 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 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
bellard08785f42004-01-04 18:12:46 +000062fi
Riku Voipio644d6772010-12-01 14:53:10 +020063if [ $cpu != "sh" ] ; then
64 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 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
66fi