2004-01-04 18:12:46 +00:00
|
|
|
#!/bin/sh
|
2009-07-24 14:57:31 +00:00
|
|
|
# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390 program execution by the kernel
|
2004-01-04 18:12:46 +00:00
|
|
|
|
|
|
|
# load the binfmt_misc module
|
2007-03-31 19:10:01 +00: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 18:12:46 +00:00
|
|
|
|
|
|
|
# probe cpu type
|
|
|
|
cpu=`uname -m`
|
|
|
|
case "$cpu" in
|
2010-12-01 12:53:10 +00:00
|
|
|
i386|i486|i586|i686|i86pc|BePC|x86_64)
|
2004-01-04 18:12:46 +00:00
|
|
|
cpu="i386"
|
|
|
|
;;
|
2007-03-31 19:10:01 +00:00
|
|
|
m68k)
|
|
|
|
cpu="m68k"
|
|
|
|
;;
|
|
|
|
mips*)
|
|
|
|
cpu="mips"
|
|
|
|
;;
|
2004-01-04 18:12:46 +00:00
|
|
|
"Power Macintosh"|ppc|ppc64)
|
|
|
|
cpu="ppc"
|
|
|
|
;;
|
2010-12-01 12:53:10 +00:00
|
|
|
armv[4-9]*)
|
2004-01-04 18:12:46 +00:00
|
|
|
cpu="arm"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# register the interpreter for each cpu except for the native one
|
|
|
|
if [ $cpu != "i386" ] ; then
|
2005-12-06 21:43:35 +00: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 18:12:46 +00:00
|
|
|
fi
|
2009-12-09 23:40:11 +00: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 18:12:46 +00:00
|
|
|
if [ $cpu != "arm" ] ; then
|
2005-12-06 21:43:35 +00: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 18:12:46 +00:00
|
|
|
fi
|
2014-03-17 16:31:53 +00:00
|
|
|
if [ $cpu != "aarch64" ] ; then
|
|
|
|
echo ':aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\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-aarch64:' > /proc/sys/fs/binfmt_misc/register
|
|
|
|
fi
|
2004-01-04 18:12:46 +00:00
|
|
|
if [ $cpu != "sparc" ] ; then
|
2005-12-06 21:43:35 +00: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 18:12:46 +00:00
|
|
|
fi
|
|
|
|
if [ $cpu != "ppc" ] ; then
|
2005-12-06 21:43:35 +00: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 19:10:01 +00:00
|
|
|
if [ $cpu != "m68k" ] ; then
|
|
|
|
echo 'Please check cpu value and header information for m68k!'
|
2007-09-30 01:58:33 +00: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 19:10:01 +00:00
|
|
|
fi
|
2005-12-06 21:43:35 +00:00
|
|
|
if [ $cpu != "mips" ] ; then
|
2007-03-31 19:10:01 +00:00
|
|
|
# FIXME: We could use the other endianness on a MIPS host.
|
2005-12-06 21:43:35 +00: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 01:58:33 +00: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 18:12:46 +00:00
|
|
|
fi
|
2010-12-01 12:53:10 +00: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
|
2012-05-07 17:47:37 +00:00
|
|
|
fi
|
2009-07-24 14:57:31 +00:00
|
|
|
if [ $cpu != "s390x" ] ; then
|
|
|
|
echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-s390x:' > /proc/sys/fs/binfmt_misc/register
|
2010-12-01 12:53:10 +00:00
|
|
|
fi
|