1 |
#!/bin/bash |
#!/bin/bash |
2 |
# $Header: /root/magellan-cvs/src/ati-drivers/ati-module.sh,v 1.1 2008-02-11 10:53:47 niro Exp $ |
# $Header: /root/magellan-cvs/src/ati-drivers/ati-module.sh,v 1.2 2008-02-11 13:14:04 niro Exp $ |
3 |
# Compiles nvidia-drivers for given kernel |
# Compiles nvidia-drivers 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}/source/video" |
KERNEL_MODULE_DEST="/lib/modules/${KERNEL_VERSION}/video" |
80 |
KERNEL_MODULE_SUFFIX="$(mod_suffix ${SRCDIR})" |
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} ]] |
83 |
then |
then |
91 |
cd ${SRCDIR} |
cd ${SRCDIR} |
92 |
|
|
93 |
mecho "Compiling ${KERNEL_MODULE}-module for kernel ${KERNEL_VERSION} ..." |
mecho "Compiling ${KERNEL_MODULE}-module for kernel ${KERNEL_VERSION} ..." |
94 |
local gcc_major="$(gcc --version | grep gcc | cut -d' ' -f3|cut -d. -f1)" |
gcc_major="$(gcc --version | grep gcc | cut -d' ' -f3|cut -d. -f1)" |
95 |
export _POSIX2_VERSION="199209" |
export _POSIX2_VERSION="199209" |
96 |
[[ $(kernel_major_version ${KERNEL_SOURCES}) = 2.6 ]] && cp 2.6.x/Makefile ${SRCDIR} |
[[ $(kernel_major_version ${KERNEL_SOURCES}) = 2.6 ]] && cp 2.6.x/Makefile ${SRCDIR} |
97 |
make -C ${KERNEL_SOURCES} M="$(pwd)" GCC_VER_MAJ="${gcc_major}" modules || die |
make -C ${KERNEL_SOURCES} V=0 M="$(pwd)" GCC_VER_MAJ="${gcc_major}" modules || die |
98 |
|
|
99 |
mecho "Installing ${KERNEL_MODULE}-module into ${KERNEL_MODULE_DEST} ..." |
mecho "Installing ${KERNEL_MODULE}-module into ${KERNEL_MODULE_DEST} ..." |
100 |
install -d ${KERNEL_MODULE_DEST} || die |
install -d ${KERNEL_MODULE_DEST} || die |