Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/daemon/include/hwdetection.global.class

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1306 by niro, Fri Feb 4 20:13:51 2011 UTC revision 1307 by niro, Sun Feb 6 23:47:09 2011 UTC
# Line 1  Line 1 
1    #!/bin/bash
2  # $Id$  # $Id$
3    
4  provide hwdetection  provide hwdetection
# Line 76  get_driver_modules() Line 77  get_driver_modules()
77  {  {
78   local item="$1"   local item="$1"
79   local modules   local modules
   
  # being little tricky here :)  
  # does following:  
  # grep:  
  # -> 'Driver Modules: "via82cxxx", "ide_cd"'  
  # cut:  
  # -> ' "via82cxxx", "ide_cd"'  
  # sed1:  
  # -> ' modules="via82cxxx", "ide_cd"'  
  # sed2:  
  # -> ' modules="via82cxxx ide_cd"'  
  # then evaluate -> eval modules="via82cxxx ide_cd"  
  # and we get a variable $modules with all mods  
  #eval $(hwinfo --"${item}" | grep "Driver Modules:" | cut -d: -f2 | sed -e "s:\":modules=\":" -e "s:\",\ \":\ :")  
   
80   local i   local i
81    
82   for i in $(hwinfo --"${item}" | grep "Driver Modules:" | cut -d: -f2 )   for i in $(hwinfo --"${item}" | grep "Driver Modules:" | cut -d: -f2 )
83   do   do
84   eval $(echo "${i}" | sed -e "s:\":modules=\"\${modules}\ :" -e "s:,:\ :")   eval $(echo "${i}" | sed -e "s:\":modules=\"\${modules}\ :" -e "s:,:\ :")
# Line 143  get_x11_driver_modules() Line 130  get_x11_driver_modules()
130   remove_duplicates "${modules}"   remove_duplicates "${modules}"
131  }  }
132    
133    get_evdev_device_path()
134    {
135     local device="$1"
136     local path
137    
138     case ${device} in
139     mouse|keyboard) true;;
140     *) die "unkown device";;
141     esac
142    
143     path="$(hwinfo --${device} | grep 'Device Files:' | sed 's:.*\(/dev/input/event[0-5]\).*:\1:')"
144     echo "${path}"
145    }
146    
147  # get_netcard_driver_modules device  # get_netcard_driver_modules device
148  # e.g. get_netcard_driver_modules eth0  # e.g. get_netcard_driver_modules eth0
149  get_netcard_driver_modules()  get_netcard_driver_modules()
# Line 229  create_initrd() Line 230  create_initrd()
230   local modules   local modules
231   # enabled framebuffer modules as default   # enabled framebuffer modules as default
232   local framebuffer=1   local framebuffer=1
233     local uvesafb_config="/etc/modprobe.d/uvesafb.conf"
234    
235   # very basic getops   # very basic getops
236   for i in $*   for i in $*
237   do   do
238   case $1 in   case $1 in
  #--root|-r) shift; root="$1" ;;  
239   --initrd|-i) shift; initrd="$1" ;;   --initrd|-i) shift; initrd="$1" ;;
240   --config|-c) shift; config="$1" ;;   --config|-c) shift; config="$1" ;;
241   --kernelversion|-v) shift; kernel="$1" ;;   --kernelversion|-v) shift; kernel="$1" ;;
# Line 250  create_initrd() Line 251  create_initrd()
251   if [[ ! -z ${INSTALL_ROOT} ]]   if [[ ! -z ${INSTALL_ROOT} ]]
252   then   then
253   config="${INSTALL_ROOT}/${config}"   config="${INSTALL_ROOT}/${config}"
254     uvesafb_config="${INSTALL_ROOT}/${uvesafb_config}"
255   chroot="chrooted"   chroot="chrooted"
256   fi   fi
257    
# Line 268  create_initrd() Line 270  create_initrd()
270   modules+=" sg_mod sg loop sr_mod sd_mod ide-cd ide-cd_mod ide-disk"   modules+=" sg_mod sg loop sr_mod sd_mod ide-cd ide-cd_mod ide-disk"
271    
272   # add generic framebuffer modules   # add generic framebuffer modules
273   [[ ${framebuffer} = 1 ]] && modules+=" uvesafb"   if [[ ${framebuffer} = 1 ]]
274     then
275     modules+=" uvesafb"
276    
277     # setup modprobe conf too
278     [[ ! -d $(dirname ${uvesafb_config}) ]] && install -d $(dirname ${uvesafb_config})
279     cat > ${uvesafb_config} << EOF
280    # This file sets the parameters for uvesafb module.
281    # The following format should be used:
282    # options uvesafb mode_option=<xres>x<yres>[-<bpp>][@<refresh>] scroll=<ywrap|ypan|redraw> ...
283    #
284    # For more details see:
285    # http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/fb/uvesafb.txt
286    #
287    EOF
288     # fix a issues with virtualbox and 'ywrap'
289     if [[ ! -z $(hwinfo --bios | grep -i virtualbox) ]]
290     then
291     # use redraw on virtualbox
292     echo "options uvesafb mode_option=1024x768-32@60 scroll=redraw" >> ${uvesafb_config}
293     else
294     # default config 1024x768 and 60 HZ
295     echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" >> ${uvesafb_config}
296     fi
297     fi
298    
299   # remove all duplicate modules   # remove all duplicate modules
300   modules="$(remove_duplicates ${modules})"   modules="$(remove_duplicates ${modules})"

Legend:
Removed from v.1306  
changed lines
  Added in v.1307