1 #!/bin/sh 2 3 # Copyright 2012 The Android Open Source Project 4 # 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 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 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. 16 17 # start jb-mr1-dev 18 # 454897 = JOO61E 19 # 474128 = JOO86 20 # 476441 = JOO87B 21 # 483070 = JOP01 22 # 521994 = JOP32B 23 # 524024 = JOP36 24 # 526897 = JOP39B 25 # 527662 = JOP40C 26 # end jb-mr1-dev 27 # start jb-mr1.1-dev 28 # 551245 = JDP82 29 # 573038 = JDQ39 30 # end jb-mr1.1-dev 31 # start jb-mr2-dev 32 # 637162 = JWR11B 33 # 681336 = JWR50 34 # 683083 = JWR51 35 # 684634 = JWR52 36 # 686185 = JWR53 37 # 689345 = JWR58 38 # 690834 = JWR59 39 # 692263 = JWR60 40 # 695489 = JWR64 41 # 699533 = JWR66 42 # 701448 = JWR66C 43 # 704243 = JWR66G 44 # 711294 = JWR66N 45 # 736095 = JWR66U 46 # 737497 = JWR66V 47 # end jb-mr2-dev 48 BRANCH=klp-dev 49 if test $BRANCH = jb-mr1-dev 50 then 51 ZIP=mantaray-ota-527662 52 BUILD=jop40c 53 fi # jb-mr1-dev 54 if test $BRANCH = jb-mr1.1-dev 55 then 56 ZIP=mantaray-ota-573038 57 BUILD=jdq39 58 fi # jb-mr1.1-dev 59 if test $BRANCH = jb-mr2-dev 60 then 61 ZIP=mantaray-ota-737497 62 BUILD=jwr66v 63 fi # jb-mr2-dev 64 if test $BRANCH = klp-dev 65 then 66 ZIP=mantaray-ota-937116 67 BUILD=kot49h 68 fi # klp-dev 69 ROOTDEVICE=manta 70 DEVICE=manta 71 MANUFACTURER=samsung 72 73 for COMPANY in audience broadcom samsung 74 do 75 echo Processing files from $COMPANY 76 rm -rf tmp 77 FILEDIR=tmp/vendor/$COMPANY/$DEVICE/proprietary 78 mkdir -p $FILEDIR 79 mkdir -p tmp/vendor/$MANUFACTURER/$ROOTDEVICE 80 case $COMPANY in 81 audience) 82 TO_EXTRACT="\ 83 system/vendor/firmware/es305_fw.bin \ 84 " 85 ;; 86 broadcom) 87 TO_EXTRACT="\ 88 system/vendor/firmware/bcm2079x_firmware.ncd \ 89 system/vendor/firmware/bcm2079x_pre_firmware.ncd \ 90 system/vendor/firmware/bcm43241.hcd \ 91 " 92 ;; 93 samsung) 94 TO_EXTRACT="\ 95 system/vendor/firmware/fimc_is_fw.bin \ 96 system/vendor/firmware/fimc_is_fw2.bin \ 97 system/vendor/firmware/maxtouch.fw \ 98 system/vendor/firmware/mfc_fw.bin \ 99 system/vendor/firmware/setfile.bin \ 100 system/vendor/firmware/setfile_4e5.bin \ 101 system/vendor/firmware/setfile_6a3.bin \ 102 system/vendor/lib/egl/libGLES_mali.so \ 103 system/vendor/lib/libdrmdecrypt.so \ 104 system/vendor/lib/libmalicore.bc \ 105 system/vendor/lib/libRSDriverArm.so \ 106 system/vendor/lib/libstagefright_hdcp.so \ 107 system/vendor/secapp/00060308060501020000000000000000.tlbin \ 108 system/vendor/secapp/020a0000000000000000000000000000.drbin \ 109 system/vendor/secapp/07060000000000000000000000000000.tlbin \ 110 system/vendor/secapp/ffffffff000000000000000000000005.tlbin \ 111 " 112 ;; 113 esac 114 echo \ \ Extracting files from OTA package 115 for ONE_FILE in $TO_EXTRACT 116 do 117 echo \ \ \ \ Extracting $ONE_FILE 118 unzip -j -o $ZIP $ONE_FILE -d $FILEDIR > /dev/null || echo \ \ \ \ Error extracting $ONE_FILE 119 if test $ONE_FILE = system/vendor/bin/gpsd -o $ONE_FILE = system/vendor/bin/pvrsrvinit -o $ONE_FILE = system/bin/fRom 120 then 121 chmod a+x $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error chmoding $ONE_FILE 122 fi 123 done 124 echo \ \ Setting up $COMPANY-specific makefiles 125 cp -R $COMPANY/staging/* tmp/vendor/$COMPANY/$DEVICE || echo \ \ \ \ Error copying makefiles 126 echo \ \ Setting up shared makefiles 127 cp -R root/* tmp/vendor/$MANUFACTURER/$ROOTDEVICE || echo \ \ \ \ Error copying makefiles 128 echo \ \ Generating self-extracting script 129 SCRIPT=extract-$COMPANY-$DEVICE.sh 130 cat PROLOGUE > tmp/$SCRIPT || echo \ \ \ \ Error generating script 131 cat $COMPANY/COPYRIGHT >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 132 cat PART1 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 133 cat $COMPANY/LICENSE >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 134 cat PART2 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 135 echo tail -n +$(expr 2 + $(cat PROLOGUE $COMPANY/COPYRIGHT PART1 $COMPANY/LICENSE PART2 PART3 | wc -l)) \$0 \| tar zxv >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 136 cat PART3 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 137 (cd tmp ; tar zc --owner=root --group=root vendor/ >> $SCRIPT || echo \ \ \ \ Error generating embedded tgz) 138 chmod a+x tmp/$SCRIPT || echo \ \ \ \ Error generating script 139 ARCHIVE=$COMPANY-$DEVICE-$BUILD-$(md5sum < tmp/$SCRIPT | cut -b -8 | tr -d \\n).tgz 140 rm -f $ARCHIVE 141 echo \ \ Generating final archive 142 (cd tmp ; tar --owner=root --group=root -z -c -f ../$ARCHIVE $SCRIPT || echo \ \ \ \ Error archiving script) 143 rm -rf tmp 144 done 145