|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
1 |
#!/bin/bash -e
|
2 |
#SGX Modules
|
|
3 |
||
4 |
unset DIR
|
|
5 |
||
6 |
DIR=$PWD |
|
7 |
||
|
47
by Robert Nelson
merge sgx script changes from 2.6-devel |
8 |
if [ $(uname -m) == "armv7l" ] ; then |
9 |
echo "ERROR: This script can only be run on an x86 system. (TI *.bin is an x86 executable)" |
|
10 |
exit
|
|
11 |
fi
|
|
12 |
||
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
13 |
# Check if the host is X86_64
|
|
47
by Robert Nelson
merge sgx script changes from 2.6-devel |
14 |
PLATFORM=$(uname -m 2>/dev/null) |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
15 |
if [ "$PLATFORM" == "x86_64" ]; then |
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
16 |
IA32=$(file /usr/share/lintian/overrides/ia32-libs | grep -v ERROR 2> /dev/null) |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
17 |
if test "-$IA32-" = "--" |
18 |
then
|
|
19 |
echo "Missing ia32-libs" |
|
20 |
sudo apt-get -y install ia32-libs |
|
21 |
fi
|
|
22 |
fi
|
|
23 |
||
|
19
by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid (2.6.34) on a Bx board |
24 |
SGX_VERSION=3_01_00_06 |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
25 |
|
26 |
SGX_BIN=OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}.bin |
|
27 |
||
28 |
sudo rm -rfd ${DIR}/SDK/ || true |
|
29 |
mkdir -p ${DIR}/SDK/ |
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
30 |
mkdir -p ${DIR}/SDK_BIN/ |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
31 |
|
32 |
function sgx_setup { |
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
33 |
if [ -e ${DIR}/${SGX_BIN} ]; then |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
34 |
echo "${SGX_BIN} found" |
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
35 |
if [ -e ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/Makefile ]; then |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
36 |
echo "Extracted ${SGX_BIN} found" |
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
37 |
echo "" |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
38 |
SGX+=E
|
39 |
else
|
|
40 |
echo "${SGX_BIN} needs to be executable" |
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
41 |
echo "" |
42 |
sudo chmod +x ${DIR}/${SGX_BIN} |
|
43 |
echo "running ${SGX_BIN}" |
|
44 |
echo "" |
|
45 |
${DIR}/${SGX_BIN} --mode console --prefix ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION} <<setupSDK |
|
46 |
Y
|
|
47 |
Y
|
|
48 |
q
|
|
49 |
setupSDK
|
|
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
50 |
cd ${DIR} |
51 |
SGX+=E
|
|
52 |
fi
|
|
53 |
else
|
|
54 |
echo "" |
|
55 |
echo "${SGX_BIN} not found" |
|
56 |
echo "Download Latest from" |
|
57 |
echo "DL From: http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/latest/index_FDS.html" |
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
58 |
echo "Copy to: ${DIR}" |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
59 |
echo "" |
60 |
fi
|
|
61 |
}
|
|
62 |
||
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
63 |
function file-pvr-startup { |
64 |
||
65 |
cat > ${DIR}/SDK/libs/opt/pvr <<pvrscript |
|
66 |
#!/bin/sh
|
|
67 |
||
68 |
if [ "\$1" = "" ]; then
|
|
69 |
echo PVR-INIT: Please use start, stop, or restart.
|
|
70 |
exit 1
|
|
71 |
fi
|
|
72 |
||
73 |
if [ "\$1" = "stop" -o "\$1" = "restart" ]; then
|
|
74 |
echo Stopping PVR
|
|
75 |
rmmod bufferclass_ti 2>/dev/null
|
|
76 |
rmmod omaplfb 2>/dev/null
|
|
77 |
rmmod pvrsrvkm 2>/dev/null
|
|
78 |
fi
|
|
79 |
||
80 |
if [ "\$1" = "stop" ]; then
|
|
81 |
exit 0
|
|
82 |
fi
|
|
83 |
||
84 |
echo Starting PVR
|
|
85 |
modprobe omaplfb
|
|
86 |
modprobe bufferclass_ti
|
|
87 |
||
88 |
pvr_maj=\$(grep "pvrsrvkm$" /proc/devices | cut -b1,2,3)
|
|
89 |
bc_maj=\$(grep "bc" /proc/devices | cut -b1,2,3)
|
|
90 |
||
91 |
if [ -e /dev/pvrsrvkm ] ; then
|
|
92 |
rm -f /dev/pvrsrvkm
|
|
93 |
fi
|
|
94 |
||
95 |
#remove with 06
|
|
96 |
if [ -e /dev/bc_cat ] ; then
|
|
97 |
rm -f /dev/bc_cat
|
|
98 |
fi
|
|
99 |
||
100 |
mknod /dev/pvrsrvkm c \$pvr_maj 0
|
|
101 |
chmod 666 /dev/pvrsrvkm
|
|
102 |
||
103 |
#remove with 06
|
|
104 |
mknod /dev/bc_cat c \$bc_maj 0
|
|
105 |
chmod 666 /dev/bc_cat
|
|
106 |
||
107 |
touch /etc/powervr-esrev
|
|
108 |
||
109 |
SAVED_ESREVISION="\$(cat /etc/powervr-esrev)"
|
|
110 |
ES_REVISION="\$(cat /proc/cpuinfo | grep "CPU revision" | awk -F: '{print \$2}')"
|
|
|
47
by Robert Nelson
merge sgx script changes from 2.6-devel |
111 |
XM_REVISION="\$(dmesg | grep "OMAP3630 ES1.0" | awk '{print \$3}')"
|
112 |
||
113 |
if [ "\${XM_REVISION}" = "OMAP3630" ] ; then
|
|
114 |
ES_REVISION=' 5'
|
|
115 |
fi
|
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
116 |
|
117 |
if [ "\${ES_REVISION}" != "\${SAVED_ESREVISION}" ] ; then
|
|
118 |
echo -n "Starting SGX fixup for"
|
|
|
47
by Robert Nelson
merge sgx script changes from 2.6-devel |
119 |
if [ "\${ES_REVISION}" = " 5" ] ; then
|
120 |
echo " ES5.x"
|
|
121 |
cp -a /usr/lib/ES5.0/* /usr/lib
|
|
122 |
cp -a /usr/bin/ES5.0/* /usr/bin
|
|
123 |
else if [ "\${ES_REVISION}" = " 3" ] ; then
|
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
124 |
echo " ES3.x"
|
125 |
cp -a /usr/lib/ES3.0/* /usr/lib
|
|
126 |
cp -a /usr/bin/ES3.0/* /usr/bin
|
|
127 |
else
|
|
128 |
echo " ES2.x"
|
|
129 |
cp -a /usr/lib/ES2.0/* /usr/lib
|
|
130 |
cp -a /usr/bin/ES2.0/* /usr/bin
|
|
131 |
fi
|
|
|
47
by Robert Nelson
merge sgx script changes from 2.6-devel |
132 |
fi
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
133 |
|
134 |
echo "\${ES_REVISION}" > /etc/powervr-esrev
|
|
135 |
fi
|
|
136 |
||
137 |
/usr/bin/pvrsrvinit
|
|
138 |
||
139 |
pvrscript
|
|
140 |
||
141 |
}
|
|
142 |
||
143 |
||
|
16
by Robert Nelson
move external scripts into file |
144 |
function file-install-SGX { |
145 |
||
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
146 |
cat > ${DIR}/SDK/install-SGX.sh <<installSGX |
147 |
#!/bin/bash
|
|
148 |
||
149 |
DIR=\$PWD
|
|
150 |
||
151 |
if [ \$(uname -m) == "armv7l" ] ; then
|
|
152 |
||
153 |
if [ -e \${DIR}/target_libs.tar.gz ]; then
|
|
154 |
||
155 |
sudo ln -sf /usr/lib/libXdmcp.so.6.0.0 /usr/lib/libXdmcp.so.0
|
|
156 |
sudo ln -sf /usr/lib/libXau.so.6.0.0 /usr/lib/libXau.so.0
|
|
157 |
||
158 |
echo "Extracting target files to rootfs"
|
|
159 |
sudo tar xf target_libs.tar.gz -C /
|
|
160 |
||
161 |
if which lsb_release >/dev/null 2>&1 && [ "\$(lsb_release -is)" = Ubuntu ]; then
|
|
162 |
||
163 |
if [ \$(lsb_release -sc) == "jaunty" ]; then
|
|
164 |
sudo cp /opt/pvr /etc/rcS.d/S60pvr.sh
|
|
165 |
sudo chmod +x /etc/rcS.d/S60pvr.sh
|
|
166 |
else
|
|
167 |
#karmic/lucid/maverick/etc
|
|
168 |
sudo cp /opt/pvr /etc/init.d/pvr
|
|
169 |
sudo chmod +x /etc/init.d/pvr
|
|
170 |
sudo update-rc.d pvr defaults
|
|
171 |
fi
|
|
172 |
||
173 |
else
|
|
174 |
||
175 |
sudo cp /opt/pvr /etc/init.d/pvr
|
|
176 |
sudo chmod +x /etc/init.d/pvr
|
|
177 |
sudo update-rc.d pvr defaults
|
|
178 |
||
179 |
fi
|
|
180 |
||
181 |
else
|
|
182 |
echo "target_libs.tar.gz is missing"
|
|
183 |
exit
|
|
184 |
fi
|
|
185 |
||
186 |
else
|
|
187 |
echo "This script is to be run on an armv7 platform"
|
|
188 |
exit
|
|
189 |
fi
|
|
190 |
||
191 |
installSGX
|
|
|
16
by Robert Nelson
move external scripts into file |
192 |
|
193 |
}
|
|
194 |
||
195 |
function file-run-SGX { |
|
196 |
||
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
197 |
cat > ${DIR}/SDK/run-SGX.sh <<runSGX |
198 |
#!/bin/bash
|
|
199 |
||
200 |
DIR=\$PWD
|
|
201 |
||
202 |
if [ \$(uname -m) == "armv7l" ] ; then
|
|
203 |
||
204 |
sudo rm /etc/powervr-esrev
|
|
205 |
sudo depmod -a omaplfb
|
|
206 |
||
207 |
if which lsb_release >/dev/null 2>&1 && [ "\$(lsb_release -is)" = Ubuntu ]; then
|
|
208 |
if [ \$(lsb_release -sc) == "jaunty" ]; then
|
|
209 |
sudo /etc/rcS.d/S60pvr.sh restart
|
|
210 |
else
|
|
211 |
sudo /etc/init.d/pvr restart
|
|
212 |
fi
|
|
213 |
else
|
|
214 |
sudo /etc/init.d/pvr restart
|
|
215 |
fi
|
|
216 |
||
217 |
else
|
|
218 |
echo "This script is to be run on an armv7 platform"
|
|
219 |
exit
|
|
220 |
fi
|
|
221 |
||
222 |
runSGX
|
|
|
16
by Robert Nelson
move external scripts into file |
223 |
|
224 |
}
|
|
225 |
||
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
226 |
function copy_sgx_system_files { |
|
19
by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid (2.6.34) on a Bx board |
227 |
sudo rm -rfd ${DIR}/SDK/ |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
228 |
mkdir -p ${DIR}/SDK/libs/usr/lib/ES2.0 |
229 |
mkdir -p ${DIR}/SDK/libs/usr/bin/ES2.0 |
|
230 |
mkdir -p ${DIR}/SDK/libs/usr/lib/ES3.0 |
|
231 |
mkdir -p ${DIR}/SDK/libs/usr/bin/ES3.0 |
|
|
47
by Robert Nelson
merge sgx script changes from 2.6-devel |
232 |
mkdir -p ${DIR}/SDK/libs/usr/lib/ES5.0 |
233 |
mkdir -p ${DIR}/SDK/libs/usr/bin/ES5.0 |
|
234 |
||
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
235 |
mkdir -p ${DIR}/SDK/libs/opt/ |
236 |
||
237 |
sudo cp ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es2.x/lib* ${DIR}/SDK/libs/usr/lib/ES2.0 |
|
238 |
sudo cp ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es2.x/p[dv]* ${DIR}/SDK/libs/usr/bin/ES2.0 |
|
239 |
||
240 |
sudo cp ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es3.x/lib* ${DIR}/SDK/libs/usr/lib/ES3.0 |
|
241 |
sudo cp ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es3.x/p[dv]* ${DIR}/SDK/libs/usr/bin/ES3.0 |
|
242 |
||
|
47
by Robert Nelson
merge sgx script changes from 2.6-devel |
243 |
sudo cp ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es5.x/lib* ${DIR}/SDK/libs/usr/lib/ES5.0 |
244 |
sudo cp ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es5.x/p[dv]* ${DIR}/SDK/libs/usr/bin/ES5.0 |
|
245 |
||
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
246 |
file-pvr-startup |
247 |
||
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
248 |
cd ${DIR}/SDK/libs |
249 |
tar czf ${DIR}/SDK/target_libs.tar.gz * |
|
250 |
cd ${DIR} |
|
251 |
sudo rm -rfd ${DIR}/SDK/libs || true |
|
252 |
||
|
16
by Robert Nelson
move external scripts into file |
253 |
file-install-SGX |
254 |
chmod +x ./SDK/install-SGX.sh |
|
255 |
file-run-SGX |
|
256 |
chmod +x ./SDK/run-SGX.sh |
|
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
257 |
|
258 |
cd ${DIR}/SDK |
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
259 |
tar czf ${DIR}/GFX_${SGX_VERSION}_libs.tar.gz * |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
260 |
cd ${DIR} |
|
19
by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid (2.6.34) on a Bx board |
261 |
|
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
262 |
sudo rm -rfd ${DIR}/SDK/ || true |
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
263 |
echo "SGX libs are in: GFX_${SGX_VERSION}_libs.tar.gz" |
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
264 |
|
265 |
}
|
|
266 |
||
267 |
function tar_up_examples { |
|
|
19
by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid (2.6.34) on a Bx board |
268 |
cd ${DIR} |
269 |
mkdir -p ${DIR}/SDK/ |
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
270 |
cp -r ${DIR}/SDK_BIN/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/GFX_Linux_SDK ${DIR}/SDK/ |
271 |
echo "" |
|
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
272 |
echo "taring SDK example files for use on the OMAP board" |
|
19
by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid (2.6.34) on a Bx board |
273 |
|
274 |
echo "removing windows binaries" |
|
275 |
find ${DIR}/SDK/ -name "*.exe" -exec rm -rf {} \; |
|
276 |
find ${DIR}/SDK/ -name "*.dll" -exec rm -rf {} \; |
|
277 |
find ${DIR}/SDK/ -type d -name "Win32" | xargs rm -r |
|
278 |
find ${DIR}/SDK/ -type d -name "MacOS" | xargs rm -r |
|
279 |
||
280 |
cd ${DIR}/SDK/GFX_Linux_SDK |
|
281 |
tar czf ${DIR}/SDK/GFX_Linux_SDK/OGLES.tar.gz ./OGLES |
|
282 |
rm -rfd ${DIR}/SDK/GFX_Linux_SDK/OGLES |
|
283 |
tar czf ${DIR}/SDK/GFX_Linux_SDK/OGLES2.tar.gz ./OGLES2 |
|
284 |
rm -rfd ${DIR}/SDK/GFX_Linux_SDK/OGLES2 |
|
285 |
tar czf ${DIR}/SDK/GFX_Linux_SDK/OVG.tar.gz ./OVG |
|
286 |
rm -rfd ${DIR}/SDK/GFX_Linux_SDK/OVG |
|
287 |
||
288 |
cd ${DIR}/SDK |
|
|
23
by Robert Nelson
merge from 2.6-stable and bump to 2.6.35-rc2 |
289 |
tar czfv ${DIR}/GFX_Linux_SDK.tar.gz ./GFX_Linux_SDK |
290 |
echo "SGX examples are in: GFX_Linux_SDK.tar.gz" |
|
|
6
by Robert Nelson
sgx: add SGX lib/bin packaging script |
291 |
cd ${DIR} |
292 |
}
|
|
293 |
||
294 |
sgx_setup |
|
295 |
||
296 |
if [ "$SGX" = "E" ]; then |
|
297 |
copy_sgx_system_files
|
|
298 |
tar_up_examples |
|
299 |
fi
|
|
300 |