-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·437 lines (350 loc) · 10.7 KB
/
install.sh
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
#!/bin/sh
# PowerVR SGX DDK for Embedded Linux - installation script
#
# Copyright Imagination Technologies Limited.
# All rights reserved. No part of this software, either
# material or conceptual may be copied or distributed,
# transmitted, transcribed, stored in a retrieval system
# or translated into any human or computer language in any
# form by any means, electronic, mechanical, manual or
# other-wise, or disclosed to third parties without the
# express written permission of Imagination Technologies
# Limited, Unit 8, HomePark Industrial Estate,
# e eKing's Langley, Hertfordshire, WD4 8LZ, U.K.
# Auto-generated for omap4430_android from build: sgxddk_1.8@789263
#
# PVR Consumer services version number
#
PVRVERSION="sgxddk_1.8@789263"
chown()
{
`which chown` -f $*
}
cp()
{
`which cp` -af $*
}
# Where we record what we did so we can undo it.
#
DDK_INSTALL_LOG=/powervr_ddk_install.log
# basic installation function
# $1=blurb
#
bail()
{
echo "$1" >&2
echo "" >&2
echo "Installation failed" >&2
exit 1
}
# basic installation function
# $1=fromfile, $2=destfilename, $3=blurb, $4=chmod-flags, $5=chown-flags
#
install_file()
{
DESTFILE=${DISCIMAGE}$2
DESTDIR=`dirname $DESTFILE`
if [ ! -e $1 ]; then
[ -n "$VERBOSE" ] && echo "skipping file $1 -> $2"
return
fi
# Destination directory - make sure it's there and writable
#
if [ -d "${DESTDIR}" ]; then
if [ ! -w "${DESTDIR}" ]; then
bail "${DESTDIR} is not writable."
fi
else
$DOIT mkdir -p ${DESTDIR} || bail "Couldn't mkdir -p ${DESTDIR}"
[ -n "$VERBOSE" ] && echo "Created directory `dirname $2`"
fi
# Delete the original so that permissions don't persist.
#
$DOIT rm -f $DESTFILE
$DOIT cp -f $1 $DESTFILE || bail "Couldn't copy $1 to $DESTFILE"
$DOIT chmod $4 ${DESTFILE}
$DOIT chown $5 ${DESTFILE}
echo "$3 `basename $1` -> $2"
$DOIT echo "file $2" >>${DISCIMAGE}${DDK_INSTALL_LOG}
}
# Install a symbolic link
# $1=fromfile, $2=destfilename
#
install_link()
{
DESTFILE=${DISCIMAGE}$2
DESTDIR=`dirname $DESTFILE`
if [ ! -e ${DESTDIR}/$1 ]; then
[ -n "$VERBOSE" ] && echo $DOIT "skipping link ${DESTDIR}/$1"
return
fi
# Destination directory - make sure it's there and writable
#
if [ -d "${DESTDIR}" ]; then
if [ ! -w "${DESTDIR}" ]; then
bail "${DESTDIR} is not writable."
fi
else
$DOIT mkdir -p ${DESTDIR} || bail "Couldn't mkdir -p ${DESTDIR}"
[ -n "$VERBOSE" ] && echo "Created directory `dirname $2`"
fi
# Delete the original so that permissions don't persist.
#
$DOIT rm -f $DESTFILE
$DOIT ln -s $1 $DESTFILE || bail "Couldn't link $1 to $DESTFILE"
$DOIT echo "link $2" >>${DISCIMAGE}${DDK_INSTALL_LOG}
[ -n "$VERBOSE" ] && echo " linked `basename $1` -> $2"
}
# Tree-based installation function
# $1 = fromdir $2=destdir $3=blurb
#
install_tree()
{
# Make the destination directory if it's not there
#
if [ ! -d ${DISCIMAGE}$2 ]; then
$DOIT mkdir -p ${DISCIMAGE}$2 || bail "Couldn't mkdir -p ${DISCIMAGE}$2"
fi
if [ "$DONTDOIT" ]; then
echo "### tar -C $1 -cf - . | tar -C ${DISCIMAGE}$2 -x${VERBOSE}f -"
else
tar -C $1 -cf - . | tar -C ${DISCIMAGE}$2 -x${VERBOSE}f -
fi
if [ $? = 0 ]; then
echo "Installed $3 in ${DISCIMAGE}$2"
$DOIT echo "tree $2" >>${DISCIMAGE}${DDK_INSTALL_LOG}
else
echo "Failed copying $3 from $1 to ${DISCIMAGE}$2"
fi
}
# Uninstall something.
#
uninstall()
{
if [ ! -f ${DISCIMAGE}${DDK_INSTALL_LOG} ]; then
echo "Nothing to un-install."
return;
fi
BAD=0
VERSION=""
while read type data; do
case $type in
version) # do nothing
echo "Uninstalling existing version $data"
VERSION="$data"
;;
link|file)
if [ -z "$VERSION" ]; then
BAD=1;
echo "No version record at head of ${DISCIMAGE}${DDK_INSTALL_LOG}"
elif ! $DOIT rm -f ${DISCIMAGE}${data}; then
BAD=1;
else
[ -n "$VERBOSE" ] && echo "Deleted $type $data"
fi
;;
tree) # so far, do nothing
;;
esac
done < ${DISCIMAGE}${DDK_INSTALL_LOG};
if [ $BAD = 0 ]; then
echo "Uninstallation completed."
$DOIT rm -f ${DISCIMAGE}${DDK_INSTALL_LOG}
else
echo "Uninstallation failed!!!"
fi
}
# Help on how to invoke
#
usage()
{
echo "usage: $0 [options...]"
echo ""
echo "Options: -v verbose mode"
echo " -n dry-run mode"
echo " -u uninstall-only mode"
echo " --no-pvr don't install PowerVR driver components"
echo " --no-x don't install X window system"
echo " --no-display don't install integrated PowerVR display module"
echo " --no-bcdevice don't install buffer class device module"
echo " --root path use path as the root of the install file system"
exit 1
}
install_pvr()
{
$DOIT echo "version sgxddk_1.8@789263" >${DISCIMAGE}${DDK_INSTALL_LOG}
# Install the standard scripts
#
install_file rc.pvr /system/bin/sgx/rc.pvr "boot script" 0755 0:0
# Check the kernel module directory is there
#
if [ ! -d "${DISCIMAGE}" ]; then
echo ""
echo "Can't find on file system installation root"
echo -n "There is no kernel module area setup yet. "
if [ "$from" = target ]; then
echo "On your build machine you should invoke:"
echo
echo " $ cd \$KERNELDIR"
echo " $ make INSTALL_MOD_PATH=\$DISCIMAGE modules_install"
else
echo "You should invoke:"
echo
echo " $ cd $KERNELDIR"
echo " $ make INSTALL_MOD_PATH=$DISCIMAGE modules_install"
fi
echo
exit 1;
fi
# Install the standard kernel modules
# Touch some files that might not exist so that busybox/modprobe don't complain
#
install_file pvrsrvkm.ko /system/bin/sgx/pvrsrvkm.ko "kernel module" 0644 0:0
if [ -z "$NO_DISPLAYMOD" ]; then
install_file omaplfb.ko /system/bin/sgx/omaplfb.ko "kernel module" 0644 0:0
fi
# Install the standard libraries
#
install_file libGLESv1_CM_POWERVR_SGX530_125.so /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_125.so "shared library" 0644 0:0
install_file libusc.so /system/lib/libusc.so "shared library" 0644 0:0
install_file libGLESv2_POWERVR_SGX530_125.so /system/lib/egl/libGLESv2_POWERVR_SGX530_125.so "shared library" 0644 0:0
install_file libglslcompiler.so /system/lib/libglslcompiler.so "shared library" 0644 0:0
install_file libIMGegl.so /system/lib/libIMGegl.so "shared library" 0644 0:0
install_file libEGL_POWERVR_SGX530_125.so /system/lib/egl/libEGL_POWERVR_SGX530_125.so "shared library" 0644 0:0
install_file libpvr2d.so /system/lib/libpvr2d.so "shared library" 0644 0:0
install_file libsrv_um.so /system/lib/libsrv_um.so "shared library" 0644 0:0
install_file libsrv_init.so /system/lib/libsrv_init.so "shared library" 0644 0:0
install_file libPVRScopeServices.so /system/lib/libPVRScopeServices.so "shared library" 0644 0:0
install_file gralloc.omap3.so /system/lib/hw/gralloc.omap3.so "shared library" 0644 0:0
install_file hwcomposer.omap3.so /system/lib/hw/hwcomposer.omap3.so "shared library" 0644 0:0
install_file libpvrANDROID_WSEGL.so /system/lib/libpvrANDROID_WSEGL.so "shared library" 0644 0:0
# Install the standard executables
#
install_file pvrsrvinit /system/bin/pvrsrvinit "binary" 0755 0:0
install_file pvrsrvctl /system/bin/pvrsrvctl "binary" 0755 0:0
install_file sgx_init_test /system/bin/sgx_init_test "binary" 0755 0:0
install_file devmem2 /system/bin/devmem2 "binary" 0755 0:0
# Install the standard unittests
#
if [ ! -d ${DISCIMAGE}/data ]; then
mkdir ${DISCIMAGE}/data
chown 1000:1000 ${DISCIMAGE}/data
chmod 0771 ${DISCIMAGE}/data
fi
if [ ! -d ${DISCIMAGE}/data/app ]; then
mkdir ${DISCIMAGE}/data/app
chown 1000:1000 ${DISCIMAGE}/data/app
chmod 0771 ${DISCIMAGE}/data/app
fi
install_file services_test /system/bin/services_test "binary" 0755 0:0
install_file sgx_blit_test /system/bin/sgx_blit_test "binary" 0755 0:0
install_file sgx_clipblit_test /system/bin/sgx_clipblit_test "binary" 0755 0:0
install_file sgx_flip_test /system/bin/sgx_flip_test "binary" 0755 0:0
install_file sgx_render_flip_test /system/bin/sgx_render_flip_test "binary" 0755 0:0
install_file pvr2d_test /system/bin/pvr2d_test "binary" 0755 0:0
install_file testwrap /system/bin/testwrap "binary" 0755 0:0
install_file gles1test1.apk /data/app/gles1test1.apk "binary" 0644 1000:1000
install_file gles1_texture_stream.apk /data/app/gles1_texture_stream.apk "binary" 0644 1000:1000
install_file gles2test1.apk /data/app/gles2test1.apk "binary" 0644 1000:1000
install_file gles2_texture_stream.apk /data/app/gles2_texture_stream.apk "binary" 0644 1000:1000
install_file eglinfo.apk /data/app/eglinfo.apk "binary" 0644 1000:1000
install_file launcher.apk /data/app/launcher.apk "binary" 0644 1000:1000
install_file hal_client_test /system/bin/hal_client_test "binary" 0755 0:0
install_file hal_server_test /system/bin/hal_server_test "binary" 0755 0:0
install_file framebuffer_test /system/bin/framebuffer_test "binary" 0755 0:0
install_file texture_benchmark /system/bin/texture_benchmark "binary" 0755 0:0
VENDOR_LIB_NAME=`echo libEGL_POWERVR_SGX530_125.so | sed 's,libEGL_\|\.so,,g'`
$DOIT mkdir -p ${DISCIMAGE}/system/lib/egl
$DOIT cat >${DISCIMAGE}/system/lib/egl/egl.cfg <<EOF
0 0 android
0 1 ${VENDOR_LIB_NAME}
EOF
$DOIT echo "file /system/lib/egl/egl.cfg" >>${DISCIMAGE}${DDK_INSTALL_LOG}
}
# Work out if there are any special instructions.
#
while [ "$1" ]; do
case "$1" in
-v|--verbose)
VERBOSE=v;
;;
-r|--root)
DISCIMAGE=$2;
shift;
;;
-u|--uninstall)
UNINSTALL=y
;;
-n) DOIT=echo
;;
--no-pvr)
NO_PVR=y
;;
--no-x)
NO_X=y
;;
--no-display)
NO_DISPLAYMOD=y
;;
--no-bcdevice)
NO_BCDEVICE=y
;;
-h | --help | *)
usage
;;
esac
shift
done
# Find out where we are? On the target? On the host?
#
case `uname -m` in
arm*) host=0;
from=target;
DISCIMAGE=/;
;;
sh*) host=0;
from=target;
DISCIMAGE=/;
;;
i?86*) host=1;
from=host;
if [ -z "$DISCIMAGE" ]; then
echo "DISCIMAGE must be set for installation to be possible." >&2
exit 1
fi
;;
x86_64*) host=1;
from=host;
if [ -z "$DISCIMAGE" ]; then
echo "DISCIMAGE must be set for installation to be possible." >&2
exit 1
fi
;;
*) echo "Don't know host to perform on machine type `uname -m`" >&2;
exit 1
;;
esac
if [ ! -d "$DISCIMAGE" ]; then
echo "$0: $DISCIMAGE does not exist." >&2
exit 1
fi
echo
echo "Installing PowerVR Consumer/Embedded DDK 'sgxddk_1.8@789263' on $from"
echo
echo "File system installation root is $DISCIMAGE"
echo
# Uninstall whatever's there already.
#
uninstall
[ -n "$UNINSTALL" ] && exit
# Now start installing things we want.
#
[ -z "$NO_PVR" ] && install_pvr
# All done...
#
echo
echo "Installation complete!"
if [ "$host" = 0 ]; then
echo "You may now reboot your target."
fi
echo