Magellan Linux

Diff of /trunk/installer-simple/functions/hwdetection.sh

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

revision 2489 by niro, Wed Jan 8 12:13:30 2014 UTC revision 2490 by niro, Wed Jan 8 12:16:22 2014 UTC
# Line 215  get_uuid() Line 215  get_uuid()
215   get_blkid_information ${partition} UUID   get_blkid_information ${partition} UUID
216  }  }
217    
 # create_initrd {/path/to/initrd kernelversion </path/to/config>}  
 # when nothing given then /boot/initrd-$(uname -r).img $(uname -r) will be used  
 # default config path is /etc/conf.d/mkinitrd  
 create_initrd()  
 {  
  local initrd  
  local kernel  
  local config  
  local chroot  
  #local root  
  local modules  
  # enabled framebuffer modules as default  
  local framebuffer=1  
  local uvesafb_config="/etc/modprobe.d/uvesafb.conf"  
   
  # very basic getops  
  for i in $*  
  do  
  case $1 in  
  --initrd|-i) shift; initrd="$1" ;;  
  --config|-c) shift; config="$1" ;;  
  --kernelversion|-v) shift; kernel="$1" ;;  
  --nofb) shift; framebuffer=0  
  esac  
  shift  
  done  
   
  [[ -z ${initrd} ]] && initrd="/boot/initrd-$(uname -r).img"  
  [[ -z ${kernel} ]] && kernel="$(uname -r)"  
  [[ -z ${config} ]] && config="/etc/conf.d/mkinitrd"  
   
  if [[ ! -z ${INSTALL_ROOT} ]]  
  then  
  config="${INSTALL_ROOT}/${config}"  
  uvesafb_config="${INSTALL_ROOT}/${uvesafb_config}"  
  chroot="chrooted"  
  fi  
   
  # get various modules needed to boot  
  modules="$(get_driver_modules disk)"  
  modules+=" $(get_driver_modules scsi)"  
  modules+=" $(get_driver_modules cdrom)"  
   
  # check for special ide_disk drivers (ata support)  
  if [[ ! -z $(echo ${modules} | grep ide_disk) ]]  
  then  
  modules+=" $(grep ide_disk /proc/modules | cut -d' ' -f4 | sed '/-/d;s:,:\ :g')"  
  fi  
   
  # check for usb-storage and add usb host drivers  
  if [[ ! -z $(echo ${modules} | grep usb[_-]storage) ]]  
  then  
  # add usb1, usb1.1, usb2 and ubs3 hosts  
  modules+=" uhci-hcd ohci-hcd ehci-hcd xhci-hcd"  
  fi  
   
  # add some generic modules  
  modules+=" sg_mod sg loop sr_mod sd_mod ide-cd ide-cd_mod ide-disk"  
   
  # add generic framebuffer modules  
  if [[ ${framebuffer} = 1 ]]  
  then  
  modules+=" uvesafb"  
   
  # setup modprobe conf too  
  [[ ! -d $(dirname ${uvesafb_config}) ]] && install -d $(dirname ${uvesafb_config})  
  cat > ${uvesafb_config} << EOF  
 # This file sets the parameters for uvesafb module.  
 # The following format should be used:  
 # options uvesafb mode_option=<xres>x<yres>[-<bpp>][@<refresh>] scroll=<ywrap|ypan|redraw> ...  
 #  
 # For more details see:  
 # http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/fb/uvesafb.txt  
 #  
 EOF  
  # fix a issues with virtualbox and 'ywrap'  
  if [[ ! -z $(hwinfo --bios | grep -i virtualbox) ]]  
  then  
  # use redraw on virtualbox  
  echo "options uvesafb mode_option=1024x768-32@60 scroll=redraw" >> ${uvesafb_config}  
  else  
  # default config 1024x768 and 60 HZ  
  echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" >> ${uvesafb_config}  
  fi  
  fi  
   
  # remove all duplicate modules  
  modules="$(remove_duplicates ${modules})"  
   
  # hotfix for usb-storage  
  modules="${modules/usb_storage/usb-storage}"  
   
  # create the config and an initrd  
  echo "# autogenerated config file" > ${config}  
  echo "MODULES=\"${modules}\"" >> ${config}  
  echo "IMAGE_TYPE=\"initramfs\"" >> ${config}  
   
  ${chroot} mkinitrd -f ${initrd} ${kernel}  
 }  
   
218  is_mounted()  is_mounted()
219  {  {
220   local item   local item

Legend:
Removed from v.2489  
changed lines
  Added in v.2490