Magellan Linux

Diff of /trunk/virtualbox/virtualbox-config.sh

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

revision 1671 by niro, Mon Jul 4 16:53:05 2011 UTC revision 1672 by niro, Sat Mar 3 02:48:55 2012 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $Header: /root/magellan-cvs/src/virtualbox/virtualbox-config.sh,v 1.13 2010-06-09 22:29:52 niro Exp $  # $Id$
3  # Configures virtualbox for Magellan-Linux  # Configures virtualbox for Magellan-Linux
4    
5  LIBDIR=/usr/lib  # get INSTALL_DIR location
6  INSTDIR=${LIBDIR}/virtualbox  source /etc/vbox/vbox.cfg
7  VBOXVERSION="$(< ${INSTDIR}/version)"  
8    VBOXVERSION="$(< ${INSTALL_DIR}/version)"
9  VBOXMODEXT=ko  VBOXMODEXT=ko
10  VBOXMODULE=vboxdrv  VBOXMODULE=vboxdrv
11  VBOXNETMODULE=vboxnetflt  VBOXNETMODULE=vboxnetflt
12  VBOXNETADPMODULE=vboxnetadp  VBOXNETADPMODULE=vboxnetadp
13    VBOXPCIMODULE=vboxpci
14    KERNELMODULES="${VBOXMODULE} ${VBOXNETMODULE} ${VBOXNETADPMODULE} ${VBOXPCIMODULE}"
15    
16  COLRED="\033[1;6m\033[31m"  COLRED="\033[1;6m\033[31m"
17  COLGREEN="\033[1;6m\033[32m"  COLGREEN="\033[1;6m\033[32m"
# Line 43  done Line 46  done
46    
47  mecho "Running $(basename $0) for kernelversion ${KERNEL_VERSION} ..."  mecho "Running $(basename $0) for kernelversion ${KERNEL_VERSION} ..."
48    
49  # check module version an recompile if it doesen't fit else break here  # check module version and recompile if it doesen't fit else break here
50  compile="no"  compile="yes"
51  for module in ${VBOXMODULE} ${VBOXNETMODULE} ${VBOXNETADPMODULE}  for module in ${KERNELMODULES}
52  do  do
53   myver=$(modinfo -k ${KERNEL_VERSION} -F version ${module} | sed "s:\(.*\)_.*:\1:")   if [[ -f /lib/modules/${KERNEL_VERSION}/misc/${module}.${VBOXMODEXT} ]]
  if [[ ${VBOXVERSION} != ${myver} ]]  
54   then   then
55   compile="yes"   myver=$(modinfo -k ${KERNEL_VERSION} -F version ${module} | sed "s:\(.*\)_.*:\1:")
56   fi   if [[ ${VBOXVERSION} = ${myver} ]]
57     then
58     compile="no"
59     fi
60  done  done
61    
62  for module in ${VBOXNETADPMODULE} ${VBOXNETMODULE} ${VBOXMODULE}  for module in ${KERNELMODULES}
63  do  do
64   if [[ -f /lib/modules/${KERNEL_VERSION}/misc/${module}.${VBOXMODEXT} ]]   if [[ -f /lib/modules/${KERNEL_VERSION}/misc/${module}.${VBOXMODEXT} ]]
65   then   then
# Line 74  then Line 79  then
79   die "No kernel sources for kernel ${KERNEL_VERSION} found! Aborting."   die "No kernel sources for kernel ${KERNEL_VERSION} found! Aborting."
80   fi   fi
81    
82   for module in ${VBOXMODULE} ${VBOXNETMODULE} ${VBOXNETADPMODULE}   for module in ${KERNELMODULES}
83   do   do
84   if [[ -f /lib/modules/${KERNEL_VERSION}/misc/${module}.${VBOXMODEXT} ]]   if [[ -f /lib/modules/${KERNEL_VERSION}/misc/${module}.${VBOXMODEXT} ]]
85   then   then
# Line 83  then Line 88  then
88   fi   fi
89   done   done
90    
91   for module in ${VBOXMODULE} ${VBOXNETMODULE} ${VBOXNETADPMODULE}   # compile the modules
92     pushd ${INSTALL_DIR}/src
93     for module in ${KERNELMODULES}
94   do   do
95   # compile the module   make -C ${module} KBUILD_VERBOSE=1 clean || die "mod-compile ${module}"
  cd ${INSTDIR}/src/${module}  
   
  make -C ${KERNEL_SOURCES} SUBDIRS=$(pwd) SRCROOT=$(pwd) clean || die "mod-compile ${module}"  
96    
97   # need some symver from vboxmodule (must be run after clean!)   # need some symver from vboxmodule (must be run after clean!)
98   if [[ ${module} = ${VBOXNETMODULE} ]] || [[ ${module} = ${VBOXNETADPMODULE} ]]   if [[ ${module} = ${VBOXNETMODULE} ]] ||
99     [[ ${module} = ${VBOXNETADPMODULE} ]] ||
100     [[ ${module} = ${VBOXPCIMODULE} ]]
101   then   then
102   [[ -f ../${VBOXMODULE}/Module.symvers ]] && cp ../${VBOXMODULE}/Module.symvers .   [[ -f ${VBOXMODULE}/Module.symvers ]] && cp ${VBOXMODULE}/Module.symvers ${module}
103   fi   fi
104    
105   make -C ${KERNEL_SOURCES} SUBDIRS=$(pwd) SRCROOT=$(pwd) modules || die "mod-compile ${module}"   make -C ${module} KBUILD_VERBOSE=1 || die "mod-compile ${module}"
106    
107   # install the modules   # install the modules
108   install -d /lib/modules/${KERNEL_VERSION}/misc   install -d /lib/modules/${KERNEL_VERSION}/misc
109   install -m0644 ${module}.${VBOXMODEXT} /lib/modules/${KERNEL_VERSION}/misc || die "mod-install ${module}"   install -m0644 ${module}/${module}.${VBOXMODEXT} /lib/modules/${KERNEL_VERSION}/misc || die "mod-install ${module}"
110    
111     # clean up
112     make -C ${module} KBUILD_VERBOSE=1 clean || die "mod-compile ${module}"
113   done   done
114     popd
115    
116   # calc module dependencies   # calc module dependencies
117   mecho "Calculating module dependencies ..."   mecho "Calculating module dependencies ..."
# Line 111  then Line 121  then
121   if [[ -x $(which udevadm) ]]   if [[ -x $(which udevadm) ]]
122   then   then
123   mecho "Reloading udev configuration ..."   mecho "Reloading udev configuration ..."
124   $(which udevadm) control --reload-rules   udevadm control --reload-rules
125   fi   fi
126  fi  fi
127    
128  # load the module  # load the module
129  if [[ x$(uname -r) = x${KERNEL_VERSION} ]]  if [[ x$(uname -r) = x${KERNEL_VERSION} ]]
130  then  then
131   for module in ${VBOXMODULE} ${VBOXNETMODULE} ${VBOXNETADPMODULE}   for module in ${KERNELMODULES}
132   do   do
133   mecho "Loading kernel-module ${module} ..."   mecho "Loading kernel-module ${module} ..."
134   modprobe ${module}   modprobe ${module}

Legend:
Removed from v.1671  
changed lines
  Added in v.1672