blob: 2e4b673e15883e028afec523af70d421c9679ed7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
#!/bin/sh
# gets needed packages for ubuntu nvidia/ati drivers
# $1 = nvidia | ati
PLUGIN_FOLDER="/opt/openslx/plugin-repo/xserver"
TMP_FOLDER="/tmp/slx-plugin/xserver"
TARGET="$1"
if [ ! -d "${PLUGIN_FOLDER}" ]; then
mkdir -p "${PLUGIN_FOLDER}/modules"
fi
# change into temp
cd ${TMP_FOLDER} > /dev/null
if [ -e "/boot/vmlinuz" ]; then
KVER=$(ls -ahl '/boot/vmlinuz' | sed -e 's,^.*vmlinuz-,,g')
else
KVER=$(find /lib/modules/2.6* -maxdepth 0|sed 's,/lib/modules/,,g'|sort|tail -n1)
fi
echo " * downloading restricted modules... this may take a while"
# TODO: remove commented out "> /dev/null ..." later... multiple times
# in this script! check all comments!
aptitude download linux-restricted-modules-${KVER} #> /dev/null 2&>1
if [ $? -eq 1 ]; then
echo " * Didn't get restricted modules. Exit now!"
#TODO: remove sh when development is finished
sh
exit
fi
MODULE_DEB=$(ls linux-restricted-modules-*.deb | tail -n1)
dpkg-deb -x ${MODULE_DEB} ${TMP_FOLDER}/modules
case ${TARGET} in
ati)
mkdir -p ${PLUGIN_FOLDER}/ati
mkdir -p ${PLUGIN_FOLDER}/ati/modules
echo " * downloading fglrx xorg package... this may take a while"
aptitude download xorg-driver-fglrx #> /dev/null 2&>1
if [ $? -eq 1 ]; then
echo " * Didn't get package xorg-driver-fglrx! Exit now!"
#TODO: remove sh when development is finished
sh
exit
fi
FGLRX_DEB=$(ls xorg-driver-fglrx_*.deb | tail -n1)
# extract $DEB
dpkg-deb -x ${FGLRX_DEB} ${PLUGIN_FOLDER}/ati
# assemble module
cd modules/lib/linux-restricted-modules/${KVER}/
bash
ld_static -d -r -o ${PLUGIN_FOLDER}/ati/modules/fglrx.ko fglrx/*
if [ -f /usr/lib/dri/fglrx_dri.so ]; then
mv /usr/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so.slx
else
# remove link
rm -rf /usr/lib/dri/fglrx_dri.so
fi
ln -s ${PLUGIN_FOLDER}/ati/usr/lib/dri/fglrx_dri.so \
/usr/lib/dri/fglrx_dri.so
# cleanup
cd ${PLUGIN_FOLDER}/ati
;;
nvidia)
mkdir -p ${PLUGIN_FOLDER}/nvidia
NVIDIA_DRIVER_VERSION=180
echo " * downloading nvidia xorg package... this may take a while"
aptitude download nvidia-glx-${NVIDIA_DRIVER_VERSION} > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo " * Didn't get package nvidia-glx-${NVIDIA_DRIVER_VERSION}!"
exit
fi
echo " * downloading nvidia kernel package... this may take a while"
aptitude download nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source > /dev/null 2>&1
if [ $? -eq 1 ]; then
echo " * Didn't get package nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source!"
exit
fi
NVIDIA_DEB=$(ls -1 nvidia-glx*.deb | tail -n1)
NVIDIA_KERNEL_DEB=$(ls -1 nvidia-${NVIDIA_DRIVER_VERSION}-kernel-source*.deb | tail -n1)
# extract $DEB
dpkg-deb -x ${NVIDIA_DEB} ${PLUGIN_FOLDER}/nvidia
# extract the sources deb to root
dpkg-deb -x ${NVIDIA_KERNEL_DEB} /
NVIDIA_DKMS_DIR=$(find /var/lib/dkms/nvidia/${NVIDIA_DRIVER_VERSION}* -maxdepth 0 -type d)
NVIDIA_SOURCE_DIR=$(find /usr/src/nvidia-${NVIDIA_DRIVER_VERSION}* -maxdepth 0 -type d)
ln -sf ${NVIDIA_SOURCE_DIR} ${NVIDIA_DKMS_DIR}/source
#build kernel module
dkms -m nvidia -v 180.11 \
-k ${KVER} \
--kernelsourcedir /usr/src/linux-headers-${KVER}/ \
--no-prepare-kernel \
build
bash
#module is now under /var/lib/dkms/nvidia/${NVIDIA_DRIVER_VERSION}.<subversion>/${KVER}/iX86/module/nvidia.ko
# TODO: rest & cleanup :)
# assemble module - we just need the new one here
# TODO: modules for older graphics hardware can be found here
#cd modules/lib/linux-restricted-modules/${KVER}/
#ld_static -d -r -o ${PLUGIN_FOLDER}/nvidia/modules/nvidia.ko nvidia_new/*
#TODO: if we use this part, we need to copy the check from ati, too!
#if [ -f /usr/lib/dri/fglrx_dri.so ]; then
# mv /usr/lib/dri/fglrx_dri.so /usr/lib/dri/fglrx_dri.so.slx
#else
# # remove link
# rm -rf /usr/lib/dri/fglrx_dri.so
#fi
#ln -s ${PLUGIN_FOLDER}/nvidia/nvroot/usr/lib/dri/nvidia_dri.so \
# /usr/lib/dri/fglrx_dri.so
# cleanup
cd ${PLUGIN_FOLDER}/nvidia
rm -rf ./etc
#TODO: check for more cleanups when the main part works!
;;
esac
|