519
by bellard
updated so that PPC/ARM/SPARC executables are automatically launched when invoked |
1 |
#!/bin/sh
|
2550
by ths
Update for binfmt_misc handler, by Stefan Weil. |
2 |
# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
|
519
by bellard
updated so that PPC/ARM/SPARC executables are automatically launched when invoked |
3 |
|
4 |
# load the binfmt_misc module
|
|
2550
by ths
Update for binfmt_misc handler, by Stefan Weil. |
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
|
|
519
by bellard
updated so that PPC/ARM/SPARC executables are automatically launched when invoked |
11 |
|
12 |
# probe cpu type
|
|
13 |
cpu=`uname -m` |
|
14 |
case "$cpu" in |
|
15 |
i386|i486|i586|i686|i86pc|BePC) |
|
16 |
cpu="i386" |
|
17 |
;;
|
|
2550
by ths
Update for binfmt_misc handler, by Stefan Weil. |
18 |
m68k)
|
19 |
cpu="m68k" |
|
20 |
;;
|
|
21 |
mips*)
|
|
22 |
cpu="mips" |
|
23 |
;;
|
|
519
by bellard
updated so that PPC/ARM/SPARC executables are automatically launched when invoked |
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 |
|
1693
by bellard
mips and mipsel support - fixed e_type mask |
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 |
|
519
by bellard
updated so that PPC/ARM/SPARC executables are automatically launched when invoked |
36 |
fi
|
37 |
if [ $cpu != "arm" ] ; then |
|
1693
by bellard
mips and mipsel support - fixed e_type mask |
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 |
|
519
by bellard
updated so that PPC/ARM/SPARC executables are automatically launched when invoked |
40 |
fi
|
41 |
if [ $cpu != "sparc" ] ; then |
|
1693
by bellard
mips and mipsel support - fixed e_type mask |
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 |
519
by bellard
updated so that PPC/ARM/SPARC executables are automatically launched when invoked |
43 |
fi
|
44 |
if [ $cpu != "ppc" ] ; then |
|
1693
by bellard
mips and mipsel support - fixed e_type mask |
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
|
|
2550
by ths
Update for binfmt_misc handler, by Stefan Weil. |
47 |
if [ $cpu != "m68k" ] ; then |
48 |
echo 'Please check cpu value and header information for m68k!' |
|
3274
by ths
Code provision for n32/n64 mips userland emulation. Not functional yet. |
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 |
2550
by ths
Update for binfmt_misc handler, by Stefan Weil. |
50 |
fi
|
1693
by bellard
mips and mipsel support - fixed e_type mask |
51 |
if [ $cpu != "mips" ] ; then |
2550
by ths
Update for binfmt_misc handler, by Stefan Weil. |
52 |
# FIXME: We could use the other endianness on a MIPS host.
|
1693
by bellard
mips and mipsel support - fixed e_type mask |
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 |
|
3274
by ths
Code provision for n32/n64 mips userland emulation. Not functional yet. |
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 |
|
519
by bellard
updated so that PPC/ARM/SPARC executables are automatically launched when invoked |
59 |
fi
|