2004-01-04 21:12:46 +03:00
|
|
|
#!/bin/sh
|
2007-03-31 23:10:01 +04:00
|
|
|
# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
|
2004-01-04 21:12:46 +03:00
|
|
|
|
|
|
|
# load the binfmt_misc module
|
2007-03-31 23:10:01 +04: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 21:12:46 +03:00
|
|
|
|
|
|
|
# probe cpu type
|
|
|
|
cpu=`uname -m`
|
|
|
|
case "$cpu" in
|
|
|
|
i386|i486|i586|i686|i86pc|BePC)
|
|
|
|
cpu="i386"
|
|
|
|
;;
|
2007-03-31 23:10:01 +04:00
|
|
|
m68k)
|
|
|
|
cpu="m68k"
|
|
|
|
;;
|
|
|
|
mips*)
|
|
|
|
cpu="mips"
|
|
|
|
;;
|
2004-01-04 21:12:46 +03:00
|
|
|
"Power Macintosh"|ppc|ppc64)
|
|
|
|
cpu="ppc"
|
|
|
|
;;
|
|
|
|
armv4l)
|
|
|
|
cpu="arm"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# register the interpreter for each cpu except for the native one
|
|
|
|
if [ $cpu != "i386" ] ; then
|
2005-12-07 00:43:35 +03: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 21:12:46 +03:00
|
|
|
fi
|
|
|
|
if [ $cpu != "arm" ] ; then
|
2005-12-07 00:43:35 +03: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 21:12:46 +03:00
|
|
|
fi
|
|
|
|
if [ $cpu != "sparc" ] ; then
|
2005-12-07 00:43:35 +03: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 21:12:46 +03:00
|
|
|
fi
|
|
|
|
if [ $cpu != "ppc" ] ; then
|
2005-12-07 00:43:35 +03: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 23:10:01 +04:00
|
|
|
if [ $cpu != "m68k" ] ; then
|
|
|
|
echo 'Please check cpu value and header information for m68k!'
|
|
|
|
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
|
|
|
|
fi
|
2005-12-07 00:43:35 +03:00
|
|
|
if [ $cpu != "mips" ] ; then
|
2007-03-31 23:10:01 +04:00
|
|
|
# FIXME: We could use the other endianness on a MIPS host.
|
2005-12-07 00:43:35 +03: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
|
2004-01-04 21:12:46 +03:00
|
|
|
fi
|