3 # Copyright (C) 2010 The Android Open Source Project
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # This script auto-generates the scripts that manage the handling of the
18 # proprietary blobs necessary to build the Android Open-Source Project code
19 # for a variety of hardware targets
21 # It needs to be run from the root of a source tree that can repo sync,
22 # runs builds with and without the vendor tree, and uses the difference
23 # to generate the scripts.
25 # It can optionally upload the results to a Gerrit server for review.
27 # WARNING: It destroys the source tree. Don't leave anything precious there.
29 # Caveat: this script does many full builds (2 per device). It takes a while
30 # to run. It's best # suited for overnight runs on multi-CPU machines
33 # Syntax: device/common/generate-blob-scripts.sh -f|--force [<server> <branch>]
35 # If the server and branch paramters are both present, the script will upload
36 # new files (if there's been any change) to the mentioned Gerrit server,
37 # in the specified branch.
39 if test "$1" != "-f" -a "$1" != "--force"
41 echo This script must be run with the --force option
46 DEVICES="crespo crespo4g stingray panda toro maguro"
52 ARCHIVEDIR=archive-$(date +%s)
53 if test -d archive-ref
55 cp -R archive-ref $ARCHIVEDIR
60 for DEVICENAME in $DEVICES
63 lunch full_$DEVICENAME-user
65 cat out/target/product/$DEVICENAME/installed-files.txt |
67 sort -f > $ARCHIVEDIR/$DEVICENAME-with.txt
70 for DEVICENAME in $DEVICES
73 lunch full_$DEVICENAME-user
75 cat out/target/product/$DEVICENAME/installed-files.txt |
77 sort -f > $ARCHIVEDIR/$DEVICENAME-without.txt
81 for DEVICENAME in $DEVICES
83 MANUFACTURERNAME=$( find device -type d | grep [^/]\*/[^/]\*/$DEVICENAME\$ | cut -f 2 -d / )
84 for FILESTYLE in extract unzip
89 echo '# Copyright (C) 2010 The Android Open Source Project'
91 echo '# Licensed under the Apache License, Version 2.0 (the "License");'
92 echo '# you may not use this file except in compliance with the License.'
93 echo '# You may obtain a copy of the License at'
95 echo '# http://www.apache.org/licenses/LICENSE-2.0'
97 echo '# Unless required by applicable law or agreed to in writing, software'
98 echo '# distributed under the License is distributed on an "AS IS" BASIS,'
99 echo '# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'
100 echo '# See the License for the specific language governing permissions and'
101 echo '# limitations under the License.'
103 echo '# This file is generated by device/common/generate-blob-scripts.sh - DO NOT EDIT'
105 echo DEVICE=$DEVICENAME
106 echo MANUFACTURER=$MANUFACTURERNAME
108 echo 'mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/proprietary'
110 diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
116 if test $FILESTYLE = extract
118 echo adb pull $FULLPATH ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary/$(basename $FULLPATH)
120 echo unzip -j -o ../../../\${DEVICE}_update.zip $(echo $FULLPATH | cut -b 2-) -d ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary
122 if test $(basename $FULLPATH) = akmd -o $(basename $FULLPATH) = mm-venc-omx-test -o $(basename $FULLPATH) = parse_radio_log -o $(basename $FULLPATH) = akmd8973 -o $(basename $FULLPATH) = gpsd -o $(basename $FULLPATH) = pvrsrvinit -o $(basename $FULLPATH) = fRom
124 echo chmod 755 ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary/$(basename $FULLPATH)
129 echo -n '(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/'
130 echo 'device-vendor-blobs.mk'
132 echo '# Copyright (C) 2010 The Android Open Source Project'
134 echo '# Licensed under the Apache License, Version 2.0 (the "License");'
135 echo '# you may not use this file except in compliance with the License.'
136 echo '# You may obtain a copy of the License at'
138 echo '# http://www.apache.org/licenses/LICENSE-2.0'
140 echo '# Unless required by applicable law or agreed to in writing, software'
141 echo '# distributed under the License is distributed on an "AS IS" BASIS,'
142 echo '# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'
143 echo '# See the License for the specific language governing permissions and'
144 echo '# limitations under the License.'
146 echo -n '# This file is generated by device/__MANUFACTURER__/__DEVICE__/'
148 echo '-files.sh - DO NOT EDIT'
151 diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
157 if test $(basename $FULLPATH) = libgps.so -o $(basename $FULLPATH) = libcamera.so -o $(basename $FULLPATH) = libsecril-client.so
159 if test $FOUND = false
162 echo '# Prebuilt libraries that are needed to build open-source libraries'
163 echo 'PRODUCT_COPY_FILES := \\'
168 echo -n \ \ \ \ vendor/__MANUFACTURER__/__DEVICE__/proprietary/$(basename $FULLPATH):obj/lib/$(basename $FULLPATH)
174 diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
181 if test $FOUND = false
184 echo -n '# All the blobs necessary for '
186 echo 'PRODUCT_COPY_FILES += \\'
191 echo -n \ \ \ \ vendor/__MANUFACTURER__/__DEVICE__/proprietary/$(basename $FULLPATH):$(echo $FULLPATH | cut -b 2-)
196 diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
202 if test $FOUND = false
205 echo -n '# All the apks necessary for '
207 echo 'PRODUCT_PACKAGES += \\'
213 echo -n $(basename $FULLPATH) | sed 's/\.apk//g'
222 echo -n '(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/'
223 echo 'proprietary/Android.mk'
225 echo '# Copyright (C) 2011 The Android Open Source Project'
227 echo '# Licensed under the Apache License, Version 2.0 (the "License");'
228 echo '# you may not use this file except in compliance with the License.'
229 echo '# You may obtain a copy of the License at'
231 echo '# http://www.apache.org/licenses/LICENSE-2.0'
233 echo '# Unless required by applicable law or agreed to in writing, software'
234 echo '# distributed under the License is distributed on an "AS IS" BASIS,'
235 echo '# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'
236 echo '# See the License for the specific language governing permissions and'
237 echo '# limitations under the License.'
239 echo -n '# This file is generated by device/__MANUFACTURER__/__DEVICE__/'
241 echo '-files.sh - DO NOT EDIT'
243 echo ifeq \(\\\$\(TARGET_DEVICE\),$DEVICENAME\)
244 echo LOCAL_PATH:=\\\$\(call my-dir\)
247 diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
253 if test $FOUND = false
256 echo -n '# Module makefile rules for apks on '
262 echo $(basename $FULLPATH) | sed 's/\.apk//g'
264 echo include \\\$\(CLEAR_VARS\)
266 echo LOCAL_MODULE := $(basename $FULLPATH) | sed 's/\.apk//g'
267 echo LOCAL_SRC_FILES := \\\$\(LOCAL_MODULE\).apk
268 echo LOCAL_MODULE_CLASS := APPS
269 echo LOCAL_MODULE_TAGS := optional
270 echo LOCAL_CERTIFICATE := PRESIGNED
271 echo LOCAL_MODULE_SUFFIX := \\\$\(COMMON_ANDROID_PACKAGE_SUFFIX\)
272 echo include \\\$\(BUILD_PREBUILT\)
280 echo './setup-makefiles.sh'
282 ) > $ARCHIVEDIR/$DEVICENAME-$FILESTYLE-files.sh
283 cp $ARCHIVEDIR/$DEVICENAME-$FILESTYLE-files.sh device/$MANUFACTURERNAME/$DEVICENAME/$FILESTYLE-files.sh
284 chmod a+x device/$MANUFACTURERNAME/$DEVICENAME/$FILESTYLE-files.sh
288 cd device/$MANUFACTURERNAME/$DEVICENAME
290 git commit -m "$(echo -e 'auto-generated blob-handling scripts\n\nBug: 4295425')"
291 if test "$1" != "" -a "$2" != ""
293 echo uploading to server $1 branch $2
294 git push ssh://$1:29418/device/$MANUFACTURERNAME/$DEVICENAME.git HEAD:refs/for/$2/autoblobs
304 grep -v ^device/common$ |