forked from gp-b2g/device-gp-keon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract-files.sh
executable file
·294 lines (263 loc) · 7.08 KB
/
extract-files.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
#!/bin/bash
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEVICE=keon
MANUFACTURER=geeksphone
if [[ -z "${ANDROIDFS_DIR}" && -d ../../../backup-${DEVICE}/system ]]; then
ANDROIDFS_DIR=../../../backup-${DEVICE}
fi
if [[ -z "${ANDROIDFS_DIR}" ]]; then
echo Pulling files from device
DEVICE_BUILD_ID=`adb shell cat /system/build.prop | grep ro.build.display.id | sed -e 's/ro.build.display.id=//' | tr -d '\n\r'`
else
echo Pulling files from ${ANDROIDFS_DIR}
DEVICE_BUILD_ID=`cat ${ANDROIDFS_DIR}/system/build.prop | grep ro.build.display.id | sed -e 's/ro.build.display.id=//' | tr -d '\n\r'`
fi
echo Found firmware with build ID $DEVICE_BUILD_ID >&2
if [[ ! -d ../../../backup-${DEVICE}/system && -z "${ANDROIDFS_DIR}" ]]; then
echo Backing up system partition to backup-${DEVICE}
mkdir -p ../../../backup-${DEVICE} &&
adb pull /system ../../../backup-${DEVICE}/system
cp ../../../backup-${DEVICE}/system/etc/wifi/WCN* ../../../backup-${DEVICE}/system/etc/firmware/wlan/volans
fi
BASE_PROPRIETARY_DEVICE_DIR=vendor/$MANUFACTURER/$DEVICE/proprietary
PROPRIETARY_DEVICE_DIR=../../../$BASE_PROPRIETARY_DEVICE_DIR
mkdir -p $PROPRIETARY_DEVICE_DIR
for NAME in adreno hw wifi etc
do
mkdir -p $PROPRIETARY_DEVICE_DIR/$NAME
done
DEVICE_BLOBS_LIST=../../../vendor/$MANUFACTURER/$DEVICE/vendor-blobs.mk
(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > $DEVICE_BLOBS_LIST
# Copyright (C) 2010 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Prebuilt libraries that are needed to build open-source libraries
PRODUCT_COPY_FILES := device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml
# All the blobs
PRODUCT_COPY_FILES += \\
EOF
# copy_files_to_obj_lib
# Add blob into out/target/product/XXX/obj/lib for compile time checking by some files.
# In order to copy the same file into two different destination path by PRODUCT_COPY_FILES,
# this function duplicate candidate to another name then add it into PRODUCT_COPY_FILES.
# Then change candidate to original name in target of PRODUCT_COPY_FILES.
# $1 = src name
# $2 = additional path under $PROPRIETARY_DEVICE_DIR
copy_files_to_obj_lib()
{
for NAME in $1
do
if [[ -f $PROPRIETARY_DEVICE_DIR/$2/$NAME ]]; then
cp $PROPRIETARY_DEVICE_DIR/$2/$NAME "$PROPRIETARY_DEVICE_DIR/$2/obj$NAME"
echo $BASE_PROPRIETARY_DEVICE_DIR/$2/obj$NAME:obj/lib/$NAME \\ >> $DEVICE_BLOBS_LIST
else
echo Failed to copy $1 from existing backup blobs to obj/lib. Giving up.
exit -1
fi
done
}
# copy_file
# pull file from the device and adds the file to the list of blobs
#
# $1 = src name
# $2 = dst name
# $3 = directory path on device
# $4 = directory name in $PROPRIETARY_DEVICE_DIR
copy_file()
{
echo Pulling \"$1\"
if [[ -z "${ANDROIDFS_DIR}" ]]; then
adb pull /$3/$1 $PROPRIETARY_DEVICE_DIR/$4/$2
else
cp ${ANDROIDFS_DIR}/$3/$1 $PROPRIETARY_DEVICE_DIR/$4/$2
fi
if [[ -f $PROPRIETARY_DEVICE_DIR/$4/$2 ]]; then
echo $BASE_PROPRIETARY_DEVICE_DIR/$4/$2:$3/$2 \\ >> $DEVICE_BLOBS_LIST
else
echo Failed to pull $1. Giving up.
exit -1
fi
}
# copy_files
# pulls a list of files from the device and adds the files to the list of blobs
#
# $1 = list of files
# $2 = directory path on device
# $3 = directory name in $PROPRIETARY_DEVICE_DIR
copy_files()
{
for NAME in $1
do
copy_file "$NAME" "$NAME" "$2" "$3"
done
}
# copy_local_files
# puts files in this directory on the list of blobs to install
#
# $1 = list of files
# $2 = directory path on device
# $3 = local directory path
copy_local_files()
{
for NAME in $1
do
echo Adding \"$NAME\"
echo device/$MANUFACTURER/$DEVICE/$3/$NAME:$2/$NAME \\ >> $DEVICE_BLOBS_LIST
done
}
DEVICE_LIBS="
libaudioeq.so
libauth.so
libcm.so
libcommondefs.so
libdiag.so
libDivxDrm.so
libdivxdrmdecrypt.so
libdsi_netctrl.so
libdsm.so
libdss.so
libdsucsd.so
libdsutils.so
libgps.utils.so
libidl.so
libloc_adapter.so
libloc_api-rpc-qc.so
libloc_eng.so
libloc_ext.so
libmmipl.so
libmmparser.so
libmmosal.so
libnetmgr.so
libnv.so
liboemcamera.so
libgemini.so
liboncrpc.so
libpbmlib.so
libqdi.so
libqdp.so
libqmi.so
libqmiservices.so
libqueue.so
libril-qc-1.so
libril-qc-qmi-1.so
libril-qcril-hook-oem.so
libwms.so
libwmsts.so
libCommandSvc.so
libmmgsdilib.so
libmm-adspsvc.so
libmm-abl-oem.so
libmm-abl.so
libOmxAacDec.so
libOmxAmrEnc.so
libOmxEvrcDec.so
libOmxOn2Dec.so
libOmxrv9Dec.so
libOmxWmvDec.so
libOmxAacEnc.so
libOmxAmrRtpDec.so
libOmxEvrcEnc.so
libOmxQcelp13Dec.so
libOmxVidEnc.so
libOmxAdpcmDec.so
libOmxAmrwbDec.so
libOmxEvrcHwDec.so
libOmxMp3Dec.so
libOmxQcelp13Enc.so
libOmxVp8Dec.so
libOmxAmrDec.so
libOmxCore.so
libOmxH264Dec.so
libOmxMpeg4Dec.so
libOmxQcelpHwDec.so
libOmxWmaDec.so
libcnefeatureconfig.so
libmmjpeg.so
libmemalloc.so
"
copy_files "$DEVICE_LIBS" "system/lib" ""
COMMON_OBJ_LIBS="
libcnefeatureconfig.so
libmmjpeg.so
"
copy_files_to_obj_lib "$COMMON_OBJ_LIBS" ""
DEVICE_BINS="
abtfilt
akmd8963
amploader
bridgemgrd
fmconfig
fm_qsoc_patches
hci_qcomm_init
radish
netmgrd
port-bridge
qmiproxy
qmuxd
rmt_storage
"
copy_files "$DEVICE_BINS" "system/bin" ""
DEVICE_HW="
camera.msm7627a.so
sensors.msm7627a.so
gps.default.so
"
copy_files "$DEVICE_HW" "system/lib/hw" "hw"
DEVICE_WLAN_ATH="
athtcmd_ram.bin
bdata.bin
fw-3.bin
nullTestFlow.bin
utf.bin
"
copy_files "$DEVICE_WLAN_ATH" "system/etc/firmware/ath6k/AR6003/hw2.1.1" "wifi"
DEVICE_ETC="
init.qcom.bt.sh
AudioFilter.csv
init.qcom.wifi.sh
"
copy_files "$DEVICE_ETC" "system/etc" "etc"
LIB_ADRENO="
libgsl.so
libOpenVG.so
libsc-a2xx.so
libC2D2.so
"
copy_files "$LIB_ADRENO" "system/lib" "adreno"
LIB_EGL_ADRENO="
egl.cfg
eglsubAndroid.so
libEGL_adreno200.so
libGLES_android.so
libGLESv1_CM_adreno200.so
libGLESv2_adreno200.so
libq3dtools_adreno200.so
"
copy_files "$LIB_EGL_ADRENO" "system/lib/egl" "adreno"
LIB_FW_ADRENO="
yamato_pm4.fw
yamato_pfp.fw
"
copy_files "$LIB_FW_ADRENO" "system/etc/firmware" "adreno"