1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /root/magellan-cvs/src/virtualbox/vboxsf.sh,v 1.1 2010-08-09 20:31:47 niro Exp $ |
# $Header: /root/magellan-cvs/src/virtualbox/vboxsf.sh,v 1.2 2010-08-22 18:40:26 niro Exp $ |
3 |
# Compiles vboxsf module for given kernel |
# Compiles vboxsf module for given kernel |
4 |
|
|
5 |
die() { echo -e "${COLRED}$@${COLDEFAULT}"; exit 1; } |
die() { echo -e "${COLRED}$@${COLDEFAULT}"; exit 1; } |
76 |
# some sane defaults |
# some sane defaults |
77 |
[[ -z ${KERNEL_VERSION} ]] && KERNEL_VERSION="$(uname -r)" |
[[ -z ${KERNEL_VERSION} ]] && KERNEL_VERSION="$(uname -r)" |
78 |
[[ -z ${KERNEL_SOURCES} ]] && KERNEL_SOURCES="/lib/modules/${KERNEL_VERSION}/source" |
[[ -z ${KERNEL_SOURCES} ]] && KERNEL_SOURCES="/lib/modules/${KERNEL_VERSION}/source" |
79 |
KERNEL_MODULE_DEST="/lib/modules/${KERNEL_VERSION}/video" |
KERNEL_MODULE_DEST="/lib/modules/${KERNEL_VERSION}/misc" |
80 |
KERNEL_MODULE_SUFFIX="$(mod_suffix ${KERNEL_SOURCES})" |
KERNEL_MODULE_SUFFIX="$(mod_suffix ${KERNEL_SOURCES})" |
81 |
|
|
82 |
if [[ -f ${KERNEL_MODULE_DEST}/${KERNEL_MODULE}.${KERNEL_MODULE_SUFFIX} ]] |
if [[ -f ${KERNEL_MODULE_DEST}/${KERNEL_MODULE}.${KERNEL_MODULE_SUFFIX} ]] |
96 |
cd ${SRCDIR} |
cd ${SRCDIR} |
97 |
|
|
98 |
mecho "Compiling ${KERNEL_MODULE}-module for kernel ${KERNEL_VERSION} ..." |
mecho "Compiling ${KERNEL_MODULE}-module for kernel ${KERNEL_VERSION} ..." |
99 |
gcc_major="$(gcc --version | grep gcc | cut -d' ' -f3|cut -d. -f1)" |
make -C ${KERNEL_SOURCES} V=0 M="$(pwd)" modules || die |
|
export _POSIX2_VERSION="199209" |
|
|
[[ $(kernel_major_version ${KERNEL_SOURCES}) = 2.6 ]] && cp 2.6.x/Makefile ${SRCDIR} |
|
|
make -C ${KERNEL_SOURCES} V=0 M="$(pwd)" GCC_VER_MAJ="${gcc_major}" modules || die |
|
100 |
|
|
101 |
mecho "Installing ${KERNEL_MODULE}-module into ${KERNEL_MODULE_DEST} ..." |
mecho "Installing ${KERNEL_MODULE}-module into ${KERNEL_MODULE_DEST} ..." |
102 |
install -d ${KERNEL_MODULE_DEST} || die |
install -d ${KERNEL_MODULE_DEST} || die |
103 |
install -m0644 ${KERNEL_MODULE}.${KERNEL_MODULE_SUFFIX} ${KERNEL_MODULE_DEST} || die |
install -m0644 ${KERNEL_MODULE}.${KERNEL_MODULE_SUFFIX} ${KERNEL_MODULE_DEST} || die |
104 |
|
|
105 |
mecho "Calculating module dependencies ..." |
mecho "Calculating module dependencies ..." |
106 |
depmod -ae ${KERNEL_VERSION} |
depmod -a ${KERNEL_VERSION} |
107 |
|
|
108 |
exit 0 |
exit 0 |