1 #!/bin/sh 2 3 # Copyright (C) 2010 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 # 138179 = IRJ89 18 # 146649 = IRK18 19 # 185907 = IRK76 20 ZIP=sojus-ota-185907.zip 21 BUILD=irk76 22 ROOTDEVICE=crespo 23 DEVICE=crespo4g 24 MANUFACTURER=samsung 25 26 for COMPANY in akm broadcom cypress imgtec nxp samsung 27 do 28 echo Processing files from $COMPANY 29 rm -rf tmp 30 FILEDIR=tmp/vendor/$COMPANY/$DEVICE/proprietary 31 mkdir -p $FILEDIR 32 mkdir -p tmp/vendor/$MANUFACTURER/$ROOTDEVICE 33 case $COMPANY in 34 akm) 35 TO_EXTRACT="\ 36 system/vendor/lib/libakm.so \ 37 " 38 ;; 39 broadcom) 40 TO_EXTRACT="\ 41 system/vendor/bin/gpsd \ 42 system/vendor/firmware/bcm4329.hcd \ 43 system/vendor/lib/hw/gps.s5pc110.so \ 44 " 45 ;; 46 cypress) 47 TO_EXTRACT="\ 48 system/vendor/firmware/cypress-touchkey.bin \ 49 " 50 ;; 51 imgtec) 52 TO_EXTRACT="\ 53 system/vendor/bin/pvrsrvinit \ 54 system/vendor/lib/egl/libEGL_POWERVR_SGX540_120.so \ 55 system/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so \ 56 system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so \ 57 system/vendor/lib/hw/gralloc.s5pc110.so \ 58 system/vendor/lib/libglslcompiler.so \ 59 system/vendor/lib/libIMGegl.so \ 60 system/vendor/lib/libpvr2d.so \ 61 system/vendor/lib/libpvrANDROID_WSEGL.so \ 62 system/vendor/lib/libPVRScopeServices.so \ 63 system/vendor/lib/libsrv_init.so \ 64 system/vendor/lib/libsrv_um.so \ 65 system/vendor/lib/libusc.so \ 66 " 67 ;; 68 nxp) 69 TO_EXTRACT="\ 70 system/vendor/firmware/libpn544_fw.so \ 71 " 72 ;; 73 samsung) 74 TO_EXTRACT="\ 75 system/app/SprintMenu.apk \ 76 system/app/SystemUpdateUI.apk \ 77 system/app/WiMAXHiddenMenu.apk \ 78 system/app/WiMAXSettings.apk \ 79 system/lib/libsecril-client.so \ 80 system/lib/libWiMAXNative.so \ 81 system/vendor/firmware/wimaxfw.bin \ 82 system/vendor/firmware/wimaxloader.bin \ 83 system/vendor/firmware/wimax_boot.bin \ 84 system/vendor/lib/libsec-ril.so \ 85 system/vendor/lib/libSECmWiMAXcAPI.so \ 86 system/vendor/lib/wimax_service.jar \ 87 " 88 ;; 89 esac 90 echo \ \ Extracting files from OTA package 91 for ONE_FILE in $TO_EXTRACT 92 do 93 echo \ \ \ \ Extracting $ONE_FILE 94 unzip -j -o $ZIP $ONE_FILE -d $FILEDIR > /dev/null || echo \ \ \ \ Error extracting $ONE_FILE 95 if test $ONE_FILE = system/vendor/bin/gpsd -o $ONE_FILE = system/vendor/bin/pvrsrvinit 96 then 97 chmod a+x $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error chmoding $ONE_FILE 98 fi 99 if test $(echo $ONE_FILE | grep \\.apk\$ | wc -l) = 1 100 then 101 echo \ \ \ \ Splitting $ONE_FILE 102 mkdir -p $FILEDIR/$(basename $ONE_FILE).parts || echo \ \ \ \ Error making parts dir for $ONE_FILE 103 unzip $FILEDIR/$(basename $ONE_FILE) -d $FILEDIR/$(basename $ONE_FILE).parts > /dev/null || echo \ \ \ \ Error unzipping $ONE_FILE 104 rm $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error removing original $ONE_FILE 105 rm -rf $FILEDIR/$(basename $ONE_FILE).parts/META-INF || echo \ \ \ \ Error removing META-INF for $ONE_FILE 106 fi 107 done 108 echo \ \ Setting up $COMPANY-specific makefiles 109 cp -R $COMPANY/staging/* tmp/vendor/$COMPANY/$DEVICE || echo \ \ \ \ Error copying makefiles 110 echo \ \ Setting up shared makefiles 111 cp -R root/* tmp/vendor/$MANUFACTURER/$ROOTDEVICE || echo \ \ \ \ Error copying makefiles 112 echo \ \ Generating self-extracting script 113 SCRIPT=extract-$COMPANY-$DEVICE.sh 114 cat PROLOGUE > tmp/$SCRIPT || echo \ \ \ \ Error generating script 115 cat $COMPANY/COPYRIGHT >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 116 cat PART1 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 117 cat $COMPANY/LICENSE >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 118 cat PART2 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 119 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 120 cat PART3 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script 121 (cd tmp ; tar zc --owner=root --group=root vendor/ >> $SCRIPT || echo \ \ \ \ Error generating embedded tgz) 122 chmod a+x tmp/$SCRIPT || echo \ \ \ \ Error generating script 123 ARCHIVE=$COMPANY-$DEVICE-$BUILD-$(md5sum < tmp/$SCRIPT | cut -b -8 | tr -d \\n).tgz 124 rm -f $ARCHIVE 125 echo \ \ Generating final archive 126 (cd tmp ; tar --owner=root --group=root -z -c -f ../$ARCHIVE $SCRIPT || echo \ \ \ \ Error archiving script) 127 rm -rf tmp 128 done 129