forked from joneschrisg/android_device_samsung_galaxys2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract-files.sh
executable file
·306 lines (272 loc) · 8.11 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
295
296
297
298
299
300
301
302
303
304
305
306
#!/bin/sh
# 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=galaxys2
COMMON=c1-common
MANUFACTURER=samsung
DEVICE_BUILD_ID=`adb shell cat /system/build.prop | grep ro.build.display.id | sed -e 's/ro.build.display.id=//' | tr -d '\r'`
case "$DEVICE_BUILD_ID" in
"GINGERBREAD.UHKG7")
FIRMWARE=UHKG7 ;;
"GINGERBREAD.XWKE7")
FIRMWARE=XWKE7 ;;
"GINGERBREAD.UHKI2")
FIRMWARE=UHKI2 ;;
"GINGERBREAD.XWKE2")
echo 'Sorry, this firmware is too old (2.3.3). Upgrade to 2.3.4.' >&2
exit 1 ;;
"GINGERBREAD.ZSKI3")
FIRMWARE=ZSKI3 ;;
"GWK74")
FIRMWARE=GWK74 ;;
"GINGERBREAD.XWKI4")
FIRMWARE=XWKI4 ;;
"GINGERBREAD.ZNKG5")
FIRMWARE=ZNKG5 ;;
*)
echo Your device has unknown firmware $DEVICE_BUILD_ID >&2
exit 1 ;;
esac
BASE_PROPRIETARY_COMMON_DIR=vendor/$MANUFACTURER/$COMMON/proprietary
PROPRIETARY_DEVICE_DIR=../../../vendor/$MANUFACTURER/$DEVICE/proprietary
PROPRIETARY_COMMON_DIR=../../../$BASE_PROPRIETARY_COMMON_DIR
mkdir -p $PROPRIETARY_DEVICE_DIR
for NAME in audio cameradat egl firmware hw keychars wifi
do
mkdir -p $PROPRIETARY_COMMON_DIR/$NAME
done
# galaxys2
# c1-common
(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/$DEVICE-vendor-blobs.mk
# 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 := \\
# All the blobs necessary for galaxys2 devices
PRODUCT_COPY_FILES += \\
EOF
COMMON_BLOBS_LIST=../../../vendor/$MANUFACTURER/$COMMON/c1-vendor-blobs.mk
(cat << EOF) | sed s/__COMMON__/$COMMON/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > $COMMON_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 := \\
vendor/__MANUFACTURER__/__COMMON__/proprietary/libcamera.so:obj/lib/libcamera.so \\
vendor/__MANUFACTURER__/__COMMON__/proprietary/libril.so:obj/lib/libril.so \\
vendor/__MANUFACTURER__/__COMMON__/proprietary/libsecril-client.so:obj/lib/libsecril-client.so \\
vendor/__MANUFACTURER__/__COMMON__/proprietary/audio/libaudio.so:obj/lib/libaudio.so \\
vendor/__MANUFACTURER__/__COMMON__/proprietary/audio/libmediayamahaservice.so:obj/lib/libmediayamahaservice.so \\
vendor/__MANUFACTURER__/__COMMON__/proprietary/audio/libaudiopolicy.so:obj/lib/libaudiopolicy.so
# All the blobs necessary for galaxys2 devices
PRODUCT_COPY_FILES += \\
EOF
# 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_COMMON_DIR
copy_files()
{
for NAME in $1
do
echo Pulling \"$NAME\"
if adb pull /$2/$NAME $PROPRIETARY_COMMON_DIR/$3/$NAME
then
echo $BASE_PROPRIETARY_COMMON_DIR/$3/$NAME:$2/$NAME \\ >> $COMMON_BLOBS_LIST
else
echo Failed to pull $NAME. Giving up.
exit -1
fi
done
}
COMMON_LIBS="
libActionShot.so
libakm.so
libarccamera.so
libcamera_client.so
libcameraservice.so
libcamera.so
libcaps.so
libexif.so
libfimc.so
libfimg.so
libMali.so
libPanoraMax3.so
libril.so
libs5pjpeg.so
libseccameraadaptor.so
libseccamera.so
libsecril-client.so
libsec-ril.so
libtvoutcec.so
libtvoutddc.so
libtvoutedid.so
lib_tvoutengine.so
libtvoutfimc.so
libtvoutfimg.so
libtvouthdmi.so
libtvout_jni.so
libtvoutservice.so
libtvout.so
"
if [ $FIRMWARE = "UHKG7" -o $FIRMWARE = "ZSKI3" -o $FIRMWARE = "UHKI2" -o $FIRMWARE = "XWKI4" ]
then
COMMON_LIBS="$COMMON_LIBS
libsecjpeginterface.so
libsecjpegboard.so
libsecjpegarcsoft.so"
fi
if [ $FIRMWARE != "UHKG7" ] && [ $FIRMWARE != "ZSKI3" ] && \
[ $FIRMWARE != "GWK74" ] && [ $FIRMWARE != "UHKI2" ] && \
[ $FIRMWARE != "XWKI4" ] && [ $FIRMWARE != "ZNKG5" ] && \
[ $FIRMWARE != "XWKE7" ]
then
COMMON_LIBS="$COMMON_LIBS libsecjpegencoder.so"
fi
copy_files "$COMMON_LIBS" "system/lib" ""
COMMON_BINS="
rild
tvoutserver
`basename \`adb shell ls /system/bin/*.hcd\` | tr -d '\r'`
"
copy_files "$COMMON_BINS" "system/bin" ""
if [ $FIRMWARE != "UHKG7" -a $FIRMWARE != "ZSKI3" -a $FIRMWARE != "UHKI2" -a $FIRMWARE != "XWKI4" -a $FIRMWARE != "ZNKG5" -a $FIRMWARE = "XWKE7" ]
then
COMMON_CAMERADATA="
datapattern_420sp.yuv
datapattern_front_420sp.yuv
"
fi
copy_files "$COMMON_CAMERADATA" "system/cameradata" "cameradata"
COMMON_EGL="
libEGL_mali.so
libGLESv1_CM_mali.so
libGLESv2_mali.so
"
copy_files "$COMMON_EGL" "system/lib/egl" "egl"
COMMON_FIRMWARE="
qt602240.fw
"
copy_files "$COMMON_FIRMWARE" "system/etc/firmware" "firmware"
copy_files "mfc_fw.bin" "vendor/firmware" "firmware"
if [ $FIRMWARE = "GWK74" ]
then
COMMON_HW="
acoustics.default.so
alsa.default.so
copybit.smdkv310.so
gps.goldfish.so
gralloc.default.so
gralloc.smdkv310.so
lights.smdkv310.so
overlay.smdkv310.so
sensors.goldfish.so
"
else
COMMON_HW="
acoustics.default.so
alsa.default.so
copybit.GT-I9100.so
gralloc.default.so
gralloc.GT-I9100.so
lights.GT-I9100.so
overlay.GT-I9100.so
sensors.GT-I9100.so
"
fi
if [ $FIRMWARE = "ZSKI3" -o $FIRMWARE = "UHKI2" -o $FIRMWARE = "XWKI4" ]
then
COMMON_HW="$COMMON_HW gps.s5pc210.so"
else
COMMON_HW="$COMMON_HW gps.GT-I9100.so"
fi
copy_files "$COMMON_HW" "system/lib/hw" "hw"
COMMON_KEYCHARS="
Broadcom_Bluetooth_HID.kcm.bin
qwerty2.kcm.bin
qwerty.kcm.bin
sec_key.kcm.bin
sec_touchkey.kcm.bin
"
copy_files "$COMMON_KEYCHARS" "system/usr/keychars" "keychars"
COMMON_WIFI="
bcm4330_mfg.bin
bcm4330_sta.bin
nvram_mfg.txt
nvram_net.txt
nvram_net_02K.txt
wifi.conf
wpa_supplicant.conf
"
if [ $FIRMWARE != "ZNKG5" -a $FIRMWARE != "XWKE7" ]; then
COMMON_WIFI = "$COMMON_WIFI bcm4330_aps.bin"
fi
if [ $FIRMWARE = "GWK74" ]; then
copy_files "$COMMON_WIFI" "system/vendor/firmware" "wifi"
copy_files wpa_supplicant.conf "system/etc/wifi" "wifi"
else
copy_files "$COMMON_WIFI" "system/etc/wifi" "wifi"
fi
COMMON_WIFI_LIBS="
libhardware_legacy.so
libnetutils.so
"
copy_files "$COMMON_WIFI_LIBS" "system/lib" "wifi"
COMMON_AUDIO="
libasound.so
libaudio.so
libaudioeffect_jni.so
libaudiohw_op.so
libaudiohw_sf.so
libaudiopolicy.so
liblvvefs.so
libmediayamaha.so
libmediayamaha_jni.so
libmediayamahaservice.so
libmediayamaha_tuning_jni.so
libsamsungAcousticeq.so
lib_Samsung_Acoustic_Module_Llite.so
lib_Samsung_Resampler.so
libsamsungSoundbooster.so
lib_Samsung_Sound_Booster.so
libsoundalive.so
libSR_AudioIn.so
libyamahasrc.so
"
copy_files "$COMMON_AUDIO" "system/lib" "audio"
./extract-cm.sh
./setup-makefiles.sh