blob: ac6713fbd8ca18ee0429ab0745494a7c449b2d49 (
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
#!/bin/bash
#
# supported:
# nvidia:
# * 10.2 (pkg-installer)
# * 11.0 (zypper rpm packages)
# * 11.1 (zypper rpm packages)
#
# ati:
# * 10.2 (pkg-installer)
# * 11.0 (zypper rpm packages)
# * 11.1 (zypper rpm packages)
#
# not right any more - removed from script
# is there any busybox in this environment
#BUSYBOX="/mnt/opt/openslx//busybox/busybox"
BASE=/opt/openslx/plugin-repo/xserver
DISTRO=$2
cd ${BASE}
if [ -L /boot/vmlinuz ]; then
KSUFFIX=$(ls -l /boot/vmlinuz | grep -P -o -e "-[a-z]*$" )
KVERS=$(ls -l /boot/vmlinuz | awk -F "->" '{print $2}'| grep -P -o "2.6.*")
else
KSUFFIX=$(ls /boot/vmlinuz-* | head -n1 | grep -P -o -e "-[a-z]*$" )
KVERS=$(ls /boot/vmlinuz-* | head -n1 | awk -F "->" '{print $2}' | grep -P -o "2.6.*" )
fi
if [ -z "${KSUFFIX}" ]; then
echo "Could not determine proper local kernel suffix!"
echo "This is needed to install kernel modules for graphics drivers!"
exit 1
fi
buildfglrx() {
# build ATI kernel module
cd ${BASE}/ati/usr/src/kernel-modules/fglrx
rm -rf fglrx.ko >/dev/null 2>&1
make KVER=${1} >/dev/null 2>&1
if [ "$?" -eq "0" ]; then
cp fglrx.ko ../../../../modules
else
echo -e "Kernel module for kernel ${1} could not be built!"
fi
cd - >/dev/null 2>&1
}
##########################################################################
# NVidia section
##########################################################################
if [ "$1" = "nvidia" ]; then
if [ -e nvidia/usr/lib/libGL.so.1 ]; then
exit
fi
if [ ! -d nvidia ]; then
mkdir -p nvidia/{modules,usr,temp}
fi
cd nvidia/temp
case ${DISTRO} in
suse-10.2*)
echo "* Running general NVidia installer (expected in xserver::pkgpath)"
# unpack the nvidia installer; quickhack - expects just one package
echo " * Unpacking installer"
sh ../../packages/NVIDIA-Linux-*.run -a -x >>nvidia-inst.log 2>&1
# prefix and paths should be matched more closely to each distro
# just demo at the moment ... but working at the moment
# without the kernel module
stdprfx=/opt/openslx/plugin-repo/xserver/nvidia
# backing up libglx.so and libGLcore.so
bkpprfx=${stdprfx}/../mesa/lib/xorg/modules/extensions
mkdir -p ${bkpprfx}
if [ -f /usr/lib/xorg/modules/extensions/libglx.so ]; then
cp /usr/lib/xorg/modules/extensions/libGLcore.so ${bkpprfx}
cp /usr/lib/xorg/modules/extensions/libglx.so ${bkpprfx}
elif [ -f /usr/X11R6/lib/xorg/modules/extensions/libglx.so ]; then
cp /usr/X11R6/lib/xorg/modules/extensions/libglx.so ${bkpprfx}
cp /usr/X11R6/lib/xorg/modules/extensions/libGLcore.so ${bkpprfx}
touch ${bkpprfx}/../../../../X11R6
fi
if [ -f /usr/lib/libGL.so.1.2 ]; then
cp /usr/lib/libGL.so.1.2 ${bkpprfx}/../../..
elif [ -f /usr/X11R6/lib/libGL.so.1.2 ]; then
cp /usr/X11R6/lib/libGL.so.1.2 ${bkpprfx}/../../..
touch ${bkpprfx}/../../../X11R6
fi
# run the lib installer
echo " * Starting the library installer"
echo "Starting the lib installer" >>nvidia-inst.log
$(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N --no-abi-note \
--x-prefix=${stdprfx}/usr --x-library-path=${stdprfx}/usr/lib \
--x-module-path=${stdprfx}/usr/lib/xorg/modules \
--opengl-prefix=${stdprfx}/usr --utility-prefix=${stdprfx}/usr \
--documentation-prefix=${stdprfx}/usr --no-runlevel-check \
--no-rpms --no-x-check --no-kernel-module \
--log-file-name=nvidia-lib.log >>nvidia-inst.log 2>&1
# how to get an idea of the installed kernel?
# run the kernel module creator (should be done for every kernel!?)
kernel=${KVERS}
echo " * Trying to compile a kernel module for $kernel"
echo "Starting the kernel module installer for $kernel" >>nvidia-inst.log
# we need the .config file in /usr/src/linux or where ever!
# we need scripts/genksyms/genksyms compiled via make scripts in /usr/src/linux
# option available in newer nvidia packages
cd /usr/src/linux-${kernel%-*}
# in suse we have the config file lying there
cp /boot/config-${kernel} .config
ARCH=$(cat .config| grep -o CONFIG_M.86=y |tail -n1|grep -o "[0-9]86")
SUFFIX=${kernel##*-}
cp -r /usr/src/linux-${kernel%-*}-obj/i${ARCH}/${SUFFIX}/ \
/usr/src/linux-${kernel%-*}
make scripts >/dev/null 2>&1
make prepare >/dev/null 2>&1
cd - >/dev/null 2>&1
#/usr/src/linux-${kernel%-*}
addopts="--no-cc-version-check"
$(ls -d NVIDIA-Linux-*)/nvidia-installer -s -q -N -K --no-abi-note \
--kernel-source-path=/usr/src/linux-${kernel%-*} \
-k ${kernel} \
--kernel-install-path=/opt/openslx/plugin-repo/xserver/nvidia/modules \
--no-runlevel-check --no-abi-note --no-rpms ${addopts} \
--log-file-name=nvidia-kernel.log >>nvidia-inst.log 2>&1
if [ $? -gt 0 ];then
echo "* kernel module built failed!"
echo "* Have a look into the several log files in "
echo " stage1/${DISTRO}/plugin-repo/xserver"
fi
# redo some unwanted changes of nvidia-installer
if [ -f ${bkpprfx}/libglx.so ]; then
cp ${bkpprfx}/libGLcore.so /usr/lib/xorg/modules/extensions
cp ${bkpprfx}/libglx.so /usr/lib/xorg/modules/extensions
if [ -f ${bkpprfx}/X11R6 ]; then
cp ${bkpprfx}/libGLcore.so /usr/X11R6/lib/xorg/modules/extensions
cp ${bkpprfx}/libglx.so /usr/X11R6/lib/xorg/modules/extensions
fi
fi
if [ -f ${bkpprfx}/../../../libGL.so.1.2 ]; then
cp ${bkpprfx}/../../../libGL.so.1.2 /usr/lib
ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so.1
ln -sf /usr/lib/libGL.so.1.2 /usr/lib/libGL.so
fi
;;
suse-11.*)
echo "* Downloading nvidia rpm packages... this could take some time..."
# add repository for nvidia drivers
case ${DISTRO} in
suse-11.0*)
REPO=http://download.nvidia.com/opensuse/11.0/
;;
suse-11.1*)
REPO=http://download.nvidia.com/opensuse/11.1/
;;
esac
zypper --no-gpg-checks addrepo ${REPO} NVIDIA > /dev/null 2>&1
# get URLs by virtually installing nvidia-OpenGL driver
zypper --no-gpg-checks -n -vv install -D \
nvidia-gfxG01-kmp${KSUFFIX} > logfile 2>&1
# zypper refresh is requested if something is not found
if [ "1" -le "$(cat logfile | grep -o "zypper refresh"| wc -l)" ]; then
zypper --no-gpg-checks refresh >/dev/null 2>&1
fi
# take unique urls from logfile
URLS=$(cat logfile | grep -P -o "http://.*?rpm " | sort -u | xargs)
for RPM in $URLS; do
RNAME=$(echo ${RPM} | sed -e 's,^.*/\(.*\)$,\1,g')
if [ ! -e ${RNAME} ]; then
wget ${RPM} > /dev/null 2>&1
fi
# We use rpm2cpio from suse to extract
if [ -f ${RNAME} ]; then
rpm2cpio ${RNAME} | cpio -id > /dev/null 2>&1
fi
done
if [ -d ./usr/X11R6/lib ]; then
mv ./usr/X11R6/lib/* ./usr/lib/
fi
if [ $(find ./usr/ -name *.so* 2>/dev/null | wc -l ) -eq 0 ]; then
echo " NVIDIA files failed to install via zypper!!"
exit
fi
rm -rf ../usr
if [ -d ./usr ]; then
mv ./usr ..
fi
find lib/ -name "*.ko" -exec mv '{}' ../modules \; > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo " Could not find kernel module nvidia.ko!";
fi
cd ..
;;
esac
rm -rf temp/
cd ..
fi
############################################################################
# ATI section
############################################################################
if [ "$1" = "ati" ]; then
if [ -e ati/usr/lib/libGL.so.1.2 ]; then
exit
fi
mkdir -p ati/modules ati/temp
case ${DISTRO} in
suse-10.2*)
### SUSE 10.2 section ###
echo "* Extracting ATI package (expected in xserver::pkgpath) ... this could take some time..."
PKG=`find packages/ -name ati-driver*\.run | tail -n1`
PKG_VERSION=`head ${PKG} | grep -P -o "[0-9]\.[0-9]{3}"`
chmod +x ${PKG}
${PKG} --extract ati/temp >/dev/null 2>&1
cd ati/temp/
RPM=`./ati-installer.sh ${PKG_VERSION} --buildpkg SuSE/SUSE102-IA32 2>&1 | grep Package | awk '{print $2}' | tail -n1`
cd ..
rpm2cpio ${RPM} 2>/dev/null | cpio -id >/dev/null 2>&1
if [ -d ./usr/X11R6/lib ]; then
mv ./usr/X11R6/lib/* ./usr/lib/
fi
if [ -d etc ]; then
cp -r etc/* /etc/
fi
# cleanup
rm -rf ${RPM}
cd ..
rm -rf ${PKG}
buildfglrx ${KVERS}
;;
suse-11.*)
### SUSE 11.0 Section ###
echo "* Downloading ati rpm packages... this could take some time..."
cd ati/temp
# add repository for ATI drivers
case ${DISTRO} in
suse-11.0*)
zypper --no-gpg-checks addrepo http://www2.ati.com/suse/11.0/ ATI > /dev/null 2>&1
;;
suse-11.1*)
zypper --no-gpg-checks addrepo http://www2.ati.com/suse/11.1/ ATI > /dev/null 2>&1
;;
esac
# get URLs by virtually installing fglrx-OpenGL driver
zypper --no-gpg-checks -n -vv install -D ati-fglrxG01-kmp${KSUFFIX} \
x11-video-fglrxG01 > logfile 2>&1
# zypper refresh is requested if something is not found
if [ "1" -le "$(cat logfile | grep -o "zypper refresh" | wc -l)" ]; then
zypper --no-gpg-check refresh >/dev/null 2>&1
fi
# take unique urls from logfile
URLS=$(cat logfile | grep -P -o "http://.*?rpm " | grep fglrx | sort -u | xargs)
for RPM in $URLS; do
RNAME=$(echo ${RPM} | sed -e 's,^.*/\(.*\)$,\1,g')
if [ ! -e ${RNAME} ]; then
wget ${RPM} > /dev/null 2>&1
fi
# We use rpm2cpio from suse to extract -> propably new rpm version
if [ -f ${RNAME} ]; then
rpm2cpio ${RNAME} | cpio -id > /dev/null 2>&1
fi
done
if [ -d ./usr/X11R6/lib ]; then
mv ./usr/X11R6/lib/* ./usr/lib/ > /dev/null 2>&1
fi
if [ $(find ./usr/ -name *.so* 2>/dev/null | wc -l ) -eq 0 ]; then
echo " ATI files failed to install via zypper!!"
exit
fi
mv ./usr ..
mv ./etc ..
find lib/ -name "*.ko" -exec mv {} ../modules \; >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo " Could not find kernel module fglrx.ko!";
fi
;;
esac
cd ..
# OpenGl implementation (libGL?) expect fglrx_dri.so in /usr/X11R6/lib/dri/
if [ ! -f /usr/X11R6/lib/modules/dri/fglrx_dri.so -a \
! -f usr/X11R6/lib/modules/dri/fglrx_dri.so ]; then
if [ ! -d /usr/X11R6/lib/modules/dri ]; then
mkdir -p /usr/X11R6/lib/modules/dri
fi
if [ -f usr/lib/dri/fglrx_dri.so ]; then
ln -s ${BASE}/ati/usr/lib/dri/fglrx_dri.so \
/usr/X11R6/lib/modules/dri/fglrx_dri.so
fi
fi
rm -rf temp/
fi
|