forked from RobertCNelson/stable-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_dsp_package.sh
executable file
·235 lines (172 loc) · 4.56 KB
/
create_dsp_package.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
#!/bin/bash -e
#Based on: http://omappedia.org/wiki/DSPBridge_Project#Build_Userspace_Files
unset BUILD
unset CC
DIR=$PWD
if [ $(uname -m) == "armv7l" ] ; then
echo "ERROR: This script can only be run on an x86 system. (TI *.bin is an x86 executable)"
exit
fi
TI_DSP_BIN=TI_DSPbinaries_RLS23.i3.8-3.12
TI_DSP_DIR=352/3680
DL_DIR=${DIR}/dl
mkdir -p ${DL_DIR}
function libstd_dependicy {
DIST=$(lsb_release -sc)
if [ $(uname -m) == "x86_64" ] ; then
LIBSTD=$(file /usr/lib32/libstdc++.so.5 | grep -v ERROR | awk '{print $1}')
if [ "-$LIBSTD-" = "--" ] ; then
sudo apt-get install -y ia32-libs
fi
else
LIBSTD=$(file /usr/lib/libstdc++.so.5 | grep -v ERROR | awk '{print $1}')
if [ "-$LIBSTD-" = "--" ] ; then
sudo apt-get install libstdc++5
fi
fi
cd ${DIR}
}
function ti_DSP_binaries {
if [ -e ${DIR}/dl/${TI_DSP_BIN}-Linux-x86-Install ]; then
echo "DSPbinaries-${TI_DSP_BIN}-Linux-x86-Install found..."
if [ -e ${DIR}/dl/TI_DSP_${TI_DSP_BIN}/Binaries/baseimage.dof ]; then
echo "Installed ${TI_DSP_BIN}-Linux-x86-Install found..."
else
cd ${DIR}/dl/
echo "Setting permissions ${TI_DSP_BIN}-Linux-x86-Install needs to be executable..."
sudo chmod +x ${DIR}/dl/${TI_DSP_BIN}-Linux-x86-Install
${DIR}/dl/${TI_DSP_BIN}-Linux-x86-Install --mode console --prefix ${DIR}/dl/TI_DSP_${TI_DSP_BIN}/ <<setupDSP
Y
setupDSP
cd ${DIR}
fi
else
wget -c --directory-prefix=${DL_DIR} --no-check-certificate https://gforge.ti.com/gf/download/frsrelease/${TI_DSP_DIR}/${TI_DSP_BIN}-Linux-x86-Install
ti_DSP_binaries
fi
}
function file-DSP-startup {
cat > ${DIR}/DSP/opt/dsp <<dspscript
#!/bin/sh
case "\$1" in
start)
modprobe mailbox_mach
modprobe bridgedriver base_img=/lib/dsp/baseimage.dof
;;
esac
dspscript
}
function file-install-DSP {
cat > ${DIR}/DSP/install-DSP.sh <<installDSP
#!/bin/bash
DIR=\$PWD
if [ \$(uname -m) == "armv7l" ] ; then
if [ -e \${DIR}/dsp_libs.tar.gz ]; then
echo "Extracting target files to rootfs"
sudo tar xf dsp_libs.tar.gz -C /
if which lsb_release >/dev/null 2>&1 && [ "\$(lsb_release -is)" = Ubuntu ]; then
if [ \$(lsb_release -sc) == "jaunty" ]; then
sudo cp /opt/dsp /etc/rcS.d/S61dsp.sh
sudo chmod +x /etc/rcS.d/S61dsp.sh
else
#karmic/lucid/maverick/etc
sudo cp /opt/dsp /etc/init.d/dsp
sudo chmod +x /etc/init.d/dsp
sudo update-rc.d dsp defaults
fi
else
sudo cp /opt/dsp /etc/init.d/dsp
sudo chmod +x /etc/init.d/dsp
sudo update-rc.d dsp defaults
fi
else
echo "dsp_libs.tar.gz is missing"
exit
fi
else
echo "This script is to be run on an armv7 platform"
exit
fi
installDSP
}
function file-install-gst-dsp {
cat > ${DIR}/DSP/install-gst-dsp.sh <<installgst
#!/bin/bash
DIR=\$PWD
function no_connection {
echo "setup internet connection before running.."
exit
}
if [ \$(uname -m) == "armv7l" ] ; then
ping -c 1 -w 100 www.google.com | grep "ttl=" || no_connection
sudo apt-get -y install git-core pkg-config build-essential gstreamer-tools libgstreamer0.10-dev
mkdir -p \${DIR}/git/
if ! ls \${DIR}/git/gst-dsp >/dev/null 2>&1;then
cd \${DIR}/git/
git clone git://github.com/felipec/gst-dsp.git
fi
cd \${DIR}/git/gst-dsp
make clean
git pull
make CROSS_COMPILE=
sudo make install
cd \${DIR}/
if ! ls \${DIR}/git/gst-omapfb >/dev/null 2>&1;then
cd \${DIR}/git/
git clone git://github.com/felipec/gst-omapfb.git
fi
cd \${DIR}/git/gst-omapfb
make clean
git pull
make CROSS_COMPILE=
sudo make install
cd \${DIR}/
if ! ls \${DIR}/git/dsp-tools >/dev/null 2>&1;then
cd \${DIR}/git/
git clone git://github.com/felipec/dsp-tools.git
fi
cd \${DIR}/git/dsp-tools
make clean
git checkout master -f
git pull
git branch -D firmware-tmp || true
git checkout origin/firmware -b firmware-tmp
sudo cp -v firmware/test.dll64P /lib/dsp/
git checkout master -f
git branch -D firmware-tmp || true
make CROSS_COMPILE=
sudo make install
cd \${DIR}/
else
echo "This script is to be run on an armv7 platform"
exit
fi
installgst
}
function create_DSP_package {
cd ${DIR}
sudo rm -rf ${DIR}/DSP/
mkdir -p ${DIR}/DSP/
mkdir -p ${DIR}/DSP/lib/dsp
mkdir -p ${DIR}/DSP/opt/
sudo cp -v ${DIR}/dl/TI_DSP_${TI_DSP_BIN}/binaries/* ${DIR}/DSP/lib/dsp
file-DSP-startup
cd ${DIR}/DSP/
tar czf ${DIR}/dsp_libs.tar.gz *
cd ${DIR}
sudo rm -rf ${DIR}/DSP/
mkdir -p ${DIR}/DSP/
mv ${DIR}/dsp_libs.tar.gz ${DIR}/DSP/
file-install-DSP
chmod +x ./DSP/install-DSP.sh
file-install-gst-dsp
chmod +x ./DSP/install-gst-dsp.sh
cd ${DIR}/DSP
tar czf ${DIR}/DSP_Install_libs.tar.gz *
cd ${DIR}
sudo rm -rf ${DIR}/DSP/
cd ${DIR}
}
libstd_dependicy
ti_DSP_binaries
create_DSP_package