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 passion and crespo 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="passion crespo"
48 ARCHIVEDIR=archive-$(date +%s)
55 for DEVICENAME in $DEVICES
58 lunch full_$DEVICENAME-user
60 cat out/target/product/$DEVICENAME/installed-files.txt |
62 sort -f > $ARCHIVEDIR/$DEVICENAME-with.txt
65 for DEVICENAME in $DEVICES
68 lunch full_$DEVICENAME-user
70 cat out/target/product/$DEVICENAME/installed-files.txt |
72 sort -f > $ARCHIVEDIR/$DEVICENAME-without.txt
75 for DEVICENAME in $DEVICES
77 MANUFACTURERNAME=$( find device -type d | grep [^/]\*/[^/]\*/$DEVICENAME\$ | cut -f 2 -d / )
78 for FILESTYLE in extract unzip
83 echo '# Copyright (C) 2010 The Android Open Source Project'
85 echo '# Licensed under the Apache License, Version 2.0 (the "License");'
86 echo '# you may not use this file except in compliance with the License.'
87 echo '# You may obtain a copy of the License at'
89 echo '# http://www.apache.org/licenses/LICENSE-2.0'
91 echo '# Unless required by applicable law or agreed to in writing, software'
92 echo '# distributed under the License is distributed on an "AS IS" BASIS,'
93 echo '# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'
94 echo '# See the License for the specific language governing permissions and'
95 echo '# limitations under the License.'
97 echo '# This file is generated by device/common/generate-blob-scripts.sh - DO NOT EDIT'
99 echo DEVICE=$DEVICENAME
100 echo MANUFACTURER=$MANUFACTURERNAME
102 echo 'mkdir -p ../../../vendor/$MANUFACTURER/$DEVICE/proprietary'
104 diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
109 if test $FILESTYLE = extract
111 echo adb pull $FULLPATH ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary/$(basename $FULLPATH)
113 echo unzip -j -o ../../../\${DEVICE}_update.zip $(echo $FULLPATH | cut -b 2-) -d ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary
115 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
117 echo chmod 755 ../../../vendor/\$MANUFACTURER/\$DEVICE/proprietary/$(basename $FULLPATH)
122 echo -n '(cat << EOF) | sed s/__DEVICE__/$DEVICE/g | sed s/__MANUFACTURER__/$MANUFACTURER/g > ../../../vendor/$MANUFACTURER/$DEVICE/'
123 echo 'device-vendor-blobs.mk'
125 echo '# Copyright (C) 2010 The Android Open Source Project'
127 echo '# Licensed under the Apache License, Version 2.0 (the "License");'
128 echo '# you may not use this file except in compliance with the License.'
129 echo '# You may obtain a copy of the License at'
131 echo '# http://www.apache.org/licenses/LICENSE-2.0'
133 echo '# Unless required by applicable law or agreed to in writing, software'
134 echo '# distributed under the License is distributed on an "AS IS" BASIS,'
135 echo '# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.'
136 echo '# See the License for the specific language governing permissions and'
137 echo '# limitations under the License.'
139 echo -n '# This file is generated by device/__MANUFACTURER__/__DEVICE__/'
141 echo '-files.sh - DO NOT EDIT'
144 diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
149 if test $(basename $FULLPATH) = libgps.so -o $(basename $FULLPATH) = libcamera.so -o $(basename $FULLPATH) = libsecril-client.so
151 if test $FOUND = false
154 echo '# Prebuilt libraries that are needed to build open-source libraries'
155 echo 'PRODUCT_COPY_FILES := \\'
160 echo -n \ \ \ \ vendor/__MANUFACTURER__/__DEVICE__/proprietary/$(basename $FULLPATH):obj/lib/$(basename $FULLPATH)
166 diff $ARCHIVEDIR/$DEVICENAME-without.txt $ARCHIVEDIR/$DEVICENAME-with.txt |
171 if test $FOUND = false
174 echo -n '# All the blobs necessary for '
176 echo 'PRODUCT_COPY_FILES += \\'
181 echo -n \ \ \ \ vendor/__MANUFACTURER__/__DEVICE__/proprietary/$(basename $FULLPATH):$(echo $FULLPATH | cut -b 2-)
186 echo './setup-makefiles.sh'
188 ) > $ARCHIVEDIR/$DEVICENAME-$FILESTYLE-files.sh
189 cp $ARCHIVEDIR/$DEVICENAME-$FILESTYLE-files.sh device/$MANUFACTURERNAME/$DEVICENAME/$FILESTYLE-files.sh
193 cd device/$MANUFACTURERNAME/$DEVICENAME
195 git commit -m "auto-generated blob-handling scripts"
196 if test "$1" != "" -a "$2" != ""
198 echo uploading to server $1 branch $2
199 git push ssh://$1:29418/device/$MANUFACTURERNAME/$DEVICENAME.git HEAD:refs/for/$2
209 grep -v ^device/common$ |