~beagleboard-kernel/+junk/2.6.34-devel

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
8
# Check if the host is X86_64
9
PLATFORM=`uname -m 2>/dev/null`
10
if [ "$PLATFORM" == "x86_64" ]; then
11
  IA32=`file /usr/share/lintian/overrides/ia32-libs | grep -v ERROR 2> /dev/null`
12
  if test "-$IA32-" = "--"
13
  then
14
    echo "Missing ia32-libs"
15
    sudo apt-get -y install ia32-libs
16
  fi
17
fi
18
17 by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid on a Bx board
19
SGX_VERSION=3_01_00_06
6 by Robert Nelson
sgx: add SGX lib/bin packaging script
20
21
SGX_BIN=OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}.bin
22
23
sudo rm -rfd ${DIR}/SDK/ || true
24
mkdir -p ${DIR}/SDK/
25
26
function sgx_setup {
27
if [ -e ${DIR}/dl/${SGX_BIN} ]; then
28
  echo "${SGX_BIN} found"
29
  if [ -e  ${DIR}/dl/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/Makefile ]; then
30
    echo "Extracted ${SGX_BIN} found"
31
    SGX+=E
32
  else
33
    cd ${DIR}/dl/
34
    echo "${SGX_BIN} needs to be executable"
35
    sudo chmod +x ./${SGX_BIN}
36
    echo "running ${SGX_BIN}, accept all defaults and agree to the license"
37
    ./${SGX_BIN} --mode console --prefix ${DIR}/dl/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}
38
    cd ${DIR}
39
    SGX+=E
40
  fi
41
else
42
  echo ""
43
  echo "${SGX_BIN} not found"
44
  echo "Download Latest from"
45
  echo "DL From: http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/gfxsdk/latest/index_FDS.html" 
46
  echo "Copy to: ${DIR}/dl"
47
  echo ""
48
fi
49
}
50
16 by Robert Nelson
move external scripts into file
51
function file-install-SGX {
52
53
echo "#!/bin/bash" > ${DIR}/SDK/install-SGX.sh
54
echo "" >> ${DIR}/SDK/install-SGX.sh
55
echo "DIR=\$PWD" >>  ${DIR}/SDK/install-SGX.sh
56
echo "" >> ${DIR}/SDK/install-SGX.sh
57
echo "if [ \$(uname -m) == \"armv7l\" ] ; then" >> ${DIR}/SDK/install-SGX.sh
58
echo "" >> ${DIR}/SDK/install-SGX.sh
59
echo " if [ -e  \${DIR}/target_libs.tar.gz ]; then" >> ${DIR}/SDK/install-SGX.sh
60
echo "" >> ${DIR}/SDK/install-SGX.sh
61
echo "  sudo ln -sf /usr/lib/libXdmcp.so.6.0.0 /usr/lib/libXdmcp.so.0" >> ${DIR}/SDK/install-SGX.sh
62
echo "  sudo ln -sf /usr/lib/libXau.so.6.0.0 /usr/lib/libXau.so.0" >> ${DIR}/SDK/install-SGX.sh
63
echo "" >> ${DIR}/SDK/install-SGX.sh
64
echo "  echo \"Extracting target files to rootfs\"" >> ${DIR}/SDK/install-SGX.sh
65
echo "  sudo tar xf target_libs.tar.gz -C /" >> ${DIR}/SDK/install-SGX.sh
66
echo "" >> ${DIR}/SDK/install-SGX.sh
67
echo "  if which lsb_release >/dev/null 2>&1 && [ \"\`lsb_release -is\`\" = Ubuntu ]; then" >> ${DIR}/SDK/install-SGX.sh
68
echo "" >> ${DIR}/SDK/install-SGX.sh
69
echo "    if [ \$(lsb_release -sc) == \"jaunty\" ]; then" >> ${DIR}/SDK/install-SGX.sh
70
echo "      sudo cp /opt/pvr/pvr /etc/rcS.d/S60pvr.sh" >> ${DIR}/SDK/install-SGX.sh
71
echo "      sudo chmod +x /etc/rcS.d/S60pvr.sh" >> ${DIR}/SDK/install-SGX.sh
17 by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid on a Bx board
72
echo "    else" >> ${DIR}/SDK/install-SGX.sh
16 by Robert Nelson
move external scripts into file
73
echo "      #karmic/lucid/etc" >> ${DIR}/SDK/install-SGX.sh
74
echo "      sudo cp /opt/pvr/pvr /etc/init.d/pvr" >> ${DIR}/SDK/install-SGX.sh
75
echo "      sudo chmod +x /etc/init.d/pvr" >> ${DIR}/SDK/install-SGX.sh
76
echo "      sudo update-rc.d pvr defaults" >> ${DIR}/SDK/install-SGX.sh
77
echo "    fi" >> ${DIR}/SDK/install-SGX.sh
78
echo "" >> ${DIR}/SDK/install-SGX.sh
79
echo "  else" >> ${DIR}/SDK/install-SGX.sh
80
echo "" >> ${DIR}/SDK/install-SGX.sh
81
echo "    sudo cp /opt/pvr/pvr /etc/init.d/pvr" >> ${DIR}/SDK/install-SGX.sh
82
echo "    sudo chmod +x /etc/init.d/pvr" >> ${DIR}/SDK/install-SGX.sh
83
echo "    sudo update-rc.d pvr defaults" >> ${DIR}/SDK/install-SGX.sh
84
echo "" >> ${DIR}/SDK/install-SGX.sh
85
echo "  fi" >> ${DIR}/SDK/install-SGX.sh
86
echo "" >> ${DIR}/SDK/install-SGX.sh
87
echo " else" >> ${DIR}/SDK/install-SGX.sh
88
echo "  echo \"target_libs.tar.gz is missing\"" >> ${DIR}/SDK/install-SGX.sh
89
echo "  exit" >> ${DIR}/SDK/install-SGX.sh
90
echo " fi" >> ${DIR}/SDK/install-SGX.sh
91
echo "" >> ${DIR}/SDK/install-SGX.sh
92
echo "else" >> ${DIR}/SDK/install-SGX.sh
93
echo " echo \"This script is to be run on an armv7 platform\"" >> ${DIR}/SDK/install-SGX.sh
94
echo " exit" >> ${DIR}/SDK/install-SGX.sh
95
echo "fi" >> ${DIR}/SDK/install-SGX.sh
96
echo "" >> ${DIR}/SDK/install-SGX.sh
97
98
}
99
100
function file-run-SGX {
101
102
echo "#!/bin/bash" > ${DIR}/SDK/run-SGX.sh
103
echo "" >> ${DIR}/SDK/run-SGX.sh
104
echo "DIR=\$PWD" >> ${DIR}/SDK/run-SGX.sh
105
echo "" >> ${DIR}/SDK/run-SGX.sh
106
echo "if [ \$(uname -m) == \"armv7l\" ] ; then" >> ${DIR}/SDK/run-SGX.sh
107
echo "" >> ${DIR}/SDK/run-SGX.sh
108
echo " sudo rm /etc/powervr-esrev" >> ${DIR}/SDK/run-SGX.sh
109
echo " sudo depmod -a omaplfb" >> ${DIR}/SDK/run-SGX.sh
110
echo "" >> ${DIR}/SDK/run-SGX.sh
111
echo " if which lsb_release >/dev/null 2>&1 && [ \"\`lsb_release -is\`\" = Ubuntu ]; then" >> ${DIR}/SDK/run-SGX.sh
112
echo "  if [ \$(lsb_release -sc) == \"jaunty\" ]; then" >> ${DIR}/SDK/run-SGX.sh
113
echo "   sudo /etc/rcS.d/S60pvr.sh restart" >> ${DIR}/SDK/run-SGX.sh
114
echo "  else " >> ${DIR}/SDK/run-SGX.sh
115
echo "   sudo /etc/init.d/pvr restart" >> ${DIR}/SDK/run-SGX.sh
116
echo "  fi" >> ${DIR}/SDK/run-SGX.sh
117
echo " else" >> ${DIR}/SDK/run-SGX.sh
118
echo "  sudo /etc/init.d/pvr restart" >> ${DIR}/SDK/run-SGX.sh
119
echo " fi" >> ${DIR}/SDK/run-SGX.sh
120
echo "" >> ${DIR}/SDK/run-SGX.sh
121
echo "else" >> ${DIR}/SDK/run-SGX.sh
122
echo " echo \"This script is to be run on an armv7 platform\"" >> ${DIR}/SDK/run-SGX.sh
123
echo " exit" >> ${DIR}/SDK/run-SGX.sh
124
echo "fi" >> ${DIR}/SDK/run-SGX.sh
125
echo "" >> ${DIR}/SDK/run-SGX.sh
126
127
}
128
6 by Robert Nelson
sgx: add SGX lib/bin packaging script
129
function copy_sgx_system_files {
17 by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid on a Bx board
130
	sudo rm -rfd ${DIR}/SDK/
6 by Robert Nelson
sgx: add SGX lib/bin packaging script
131
	mkdir -p ${DIR}/SDK/libs/usr/lib/ES2.0
132
	mkdir -p ${DIR}/SDK/libs/usr/bin/ES2.0
133
	mkdir -p ${DIR}/SDK/libs/usr/lib/ES3.0
134
	mkdir -p ${DIR}/SDK/libs/usr/bin/ES3.0
135
	mkdir -p ${DIR}/SDK/libs/opt/pvr
136
137
	sudo cp ${DIR}/dl/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es2.x/lib* ${DIR}/SDK/libs/usr/lib/ES2.0
138
	sudo cp ${DIR}/dl/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es2.x/p[dv]* ${DIR}/SDK/libs/usr/bin/ES2.0
139
140
	sudo cp ${DIR}/dl/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es3.x/lib* ${DIR}/SDK/libs/usr/lib/ES3.0
141
	sudo cp ${DIR}/dl/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/gfx_rel_es3.x/p[dv]* ${DIR}/SDK/libs/usr/bin/ES3.0
142
143
	cp -v ${DIR}/tools/pvr ${DIR}/SDK/libs/opt/pvr
144
	cd ${DIR}/SDK/libs
145
	tar czf ${DIR}/SDK/target_libs.tar.gz *
146
	cd ${DIR}
147
	sudo rm -rfd ${DIR}/SDK/libs || true
148
16 by Robert Nelson
move external scripts into file
149
file-install-SGX
150
	chmod +x ./SDK/install-SGX.sh
151
file-run-SGX
152
	chmod +x ./SDK/run-SGX.sh
6 by Robert Nelson
sgx: add SGX lib/bin packaging script
153
154
	cd ${DIR}/SDK
155
	tar czf ${DIR}/deploy/GFX_${SGX_VERSION}_libs.tar.gz *
156
	cd ${DIR}
17 by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid on a Bx board
157
6 by Robert Nelson
sgx: add SGX lib/bin packaging script
158
	sudo rm -rfd ${DIR}/SDK/ || true
159
	echo "SGX libs are in: deploy/GFX_${SGX_VERSION}_libs.tar.gz"
160
	
161
}
162
163
function tar_up_examples {
17 by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid on a Bx board
164
	cd ${DIR}
165
	mkdir -p ${DIR}/SDK/
166
	cp -r ${DIR}/dl/OMAP35x_Graphics_SDK_setuplinux_${SGX_VERSION}/GFX_Linux_SDK ${DIR}/SDK/
6 by Robert Nelson
sgx: add SGX lib/bin packaging script
167
	echo "taring SDK example files for use on the OMAP board"
17 by Robert Nelson
sgx: 3.01.00.06 seems to be working now, tested with lucid on a Bx board
168
169
	echo "removing windows binaries"
170
	find ${DIR}/SDK/ -name "*.exe" -exec rm -rf {} \;
171
	find ${DIR}/SDK/ -name "*.dll" -exec rm -rf {} \;
172
	find ${DIR}/SDK/ -type d -name "Win32" | xargs rm -r
173
	find ${DIR}/SDK/ -type d -name "MacOS" | xargs rm -r
174
175
	cd ${DIR}/SDK/GFX_Linux_SDK
176
	tar czf ${DIR}/SDK/GFX_Linux_SDK/OGLES.tar.gz ./OGLES
177
	rm -rfd ${DIR}/SDK/GFX_Linux_SDK/OGLES
178
	tar czf ${DIR}/SDK/GFX_Linux_SDK/OGLES2.tar.gz ./OGLES2
179
	rm -rfd ${DIR}/SDK/GFX_Linux_SDK/OGLES2
180
	tar czf ${DIR}/SDK/GFX_Linux_SDK/OVG.tar.gz ./OVG
181
	rm -rfd ${DIR}/SDK/GFX_Linux_SDK/OVG
182
183
	cd ${DIR}/SDK
184
	tar czfv ${DIR}/deploy/GFX_Linux_SDK.tar.gz ./GFX_Linux_SDK
6 by Robert Nelson
sgx: add SGX lib/bin packaging script
185
	echo "SGX examples are in: deploy/GFX_Linux_SDK.tar.gz"
186
	cd ${DIR}
187
}
188
189
 sgx_setup
190
191
if [ "$SGX" = "E" ]; then
192
	copy_sgx_system_files
193
	tar_up_examples
194
fi
195