Commit 1e0e6d8be9114ac4f1b9abde5a8852949c242eb5

Authored by ths
1 parent 5813427b

Update for binfmt_misc handler, by Stefan Weil.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2560 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 18 additions and 2 deletions
qemu-binfmt-conf.sh
1 1 #!/bin/sh
2   -# enable automatic i386/ARM/SPARC/PPC program execution by the kernel
  2 +# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
3 3  
4 4 # load the binfmt_misc module
5   -/sbin/modprobe binfmt_misc
  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
6 11  
7 12 # probe cpu type
8 13 cpu=`uname -m`
... ... @@ -10,6 +15,12 @@ case "$cpu" in
10 15 i386|i486|i586|i686|i86pc|BePC)
11 16 cpu="i386"
12 17 ;;
  18 + m68k)
  19 + cpu="m68k"
  20 + ;;
  21 + mips*)
  22 + cpu="mips"
  23 + ;;
13 24 "Power Macintosh"|ppc|ppc64)
14 25 cpu="ppc"
15 26 ;;
... ... @@ -33,7 +44,12 @@ fi
33 44 if [ $cpu != "ppc" ] ; then
34 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
35 46 fi
  47 +if [ $cpu != "m68k" ] ; then
  48 + echo 'Please check cpu value and header information for m68k!'
  49 + 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
  50 +fi
36 51 if [ $cpu != "mips" ] ; then
  52 + # FIXME: We could use the other endianness on a MIPS host.
37 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
38 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
39 55 fi
... ...