2004-01-04 19:12:46 +01:00
|
|
|
#!/bin/sh
|
2007-03-31 21:10:01 +02:00
|
|
|
# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
|
2004-01-04 19:12:46 +01:00
|
|
|
|
|
|
|
# load the binfmt_misc module
|
2007-03-31 21:10:01 +02:00
|
|
|
if [ ! -d /proc/sys/fs/binfmt_misc ]; then
|
|
|
|
/sbin/modprobe binfmt_misc
|
|
|
|
fi
|
|
|
|
if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
|
|
|
|
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
|
|
|
|
fi
|
2004-01-04 19:12:46 +01:00
|
|
|
|
|
|
|
# probe cpu type
|
|
|
|
cpu=`uname -m`
|
|
|
|
case "$cpu" in
|
2010-12-01 13:53:10 +01:00
|
|
|
i386|i486|i586|i686|i86pc|BePC|x86_64)
|
2004-01-04 19:12:46 +01:00
|
|
|
cpu="i386"
|
|
|
|
;;
|
2007-03-31 21:10:01 +02:00
|
|
|
m68k)
|
|
|
|
cpu="m68k"
|
|
|
|
;;
|
|
|
|
mips*)
|
|
|
|
cpu="mips"
|
|
|
|
;;
|
2004-01-04 19:12:46 +01:00
|
|
|
"Power Macintosh"|ppc|ppc64)
|
|
|
|
cpu="ppc"
|
|
|
|
;;
|
2010-12-01 13:53:10 +01:00
|
|
|
armv[4-9]*)
|
2004-01-04 19:12:46 +01:00
|
|
|
cpu="arm"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# register the interpreter for each cpu except for the native one
|
|
|
|
if [ $cpu != "i386" ] ; then
|
2005-12-06 22:43:35 +01:00
|
|
|
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
|
|
|
|
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
|
2004-01-04 19:12:46 +01:00
|
|
|
fi
|
2009-12-10 00:40:11 +01:00
|
|
|
if [ $cpu != "alpha" ] ; then
|
|
|
|
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
|
|
|
|
fi
|
2004-01-04 19:12:46 +01:00
|
|
|
if [ $cpu != "arm" ] ; then
|
2005-12-06 22:43:35 +01:00
|
|
|
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
|
|
|
|
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
|
2004-01-04 19:12:46 +01:00
|
|
|
fi
|
|
|
|
if [ $cpu != "sparc" ] ; then
|
2005-12-06 22:43:35 +01:00
|
|
|
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
|
2004-01-04 19:12:46 +01:00
|
|
|
fi
|
|
|
|
if [ $cpu != "ppc" ] ; then
|
2005-12-06 22:43:35 +01:00
|
|
|
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
|
|
|
|
fi
|
2007-03-31 21:10:01 +02:00
|
|
|
if [ $cpu != "m68k" ] ; then
|
|
|
|
echo 'Please check cpu value and header information for m68k!'
|
2007-09-30 03:58:33 +02:00
|
|
|
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
|
2007-03-31 21:10:01 +02:00
|
|
|
fi
|
2005-12-06 22:43:35 +01:00
|
|
|
if [ $cpu != "mips" ] ; then
|
2007-03-31 21:10:01 +02:00
|
|
|
# FIXME: We could use the other endianness on a MIPS host.
|
2005-12-06 22:43:35 +01:00
|
|
|
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
|
|
|
|
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
|
2007-09-30 03:58:33 +02:00
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
2004-01-04 19:12:46 +01:00
|
|
|
fi
|
2010-12-01 13:53:10 +01:00
|
|
|
if [ $cpu != "sh" ] ; then
|
|
|
|
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
|
|
|
|
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
|
|
|
|
fi
|