Home | History | Annotate | Download | only in self-extractors
      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 # 189728 = IRK82
     18 # 201178 = IRL10B
     19 # 213821 = ICL26
     20 # 221202 = ICL39
     21 ZIP=mysid-ota-221202.zip
     22 BUILD=icl39
     23 ROOTDEVICE=toro
     24 DEVICE=toro
     25 MANUFACTURER=samsung
     26 
     27 for COMPANY in broadcom csr imgtec invensense nxp samsung ti
     28 do
     29   echo Processing files from $COMPANY
     30   rm -rf tmp
     31   FILEDIR=tmp/vendor/$COMPANY/$DEVICE/proprietary
     32   mkdir -p $FILEDIR
     33   mkdir -p tmp/vendor/$MANUFACTURER/$ROOTDEVICE
     34   case $COMPANY in
     35   broadcom)
     36     TO_EXTRACT="\
     37             system/vendor/firmware/bcm4330.hcd \
     38             "
     39     ;;
     40   csr)
     41     TO_EXTRACT="\
     42             system/vendor/etc/sirfgps.conf \
     43             system/vendor/lib/hw/gps.omap4.so \
     44             "
     45     ;;
     46   imgtec)
     47     TO_EXTRACT="\
     48             system/vendor/bin/pvrsrvinit \
     49             system/vendor/lib/egl/libEGL_POWERVR_SGX540_120.so \
     50             system/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so \
     51             system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so \
     52             system/vendor/lib/hw/gralloc.omap4.so \
     53             system/vendor/lib/libglslcompiler.so \
     54             system/vendor/lib/libIMGegl.so \
     55             system/vendor/lib/libpvr2d.so \
     56             system/vendor/lib/libpvrANDROID_WSEGL.so \
     57             system/vendor/lib/libPVRScopeServices.so \
     58             system/vendor/lib/libsrv_init.so \
     59             system/vendor/lib/libsrv_um.so \
     60             system/vendor/lib/libusc.so \
     61             "
     62     ;;
     63   invensense)
     64     TO_EXTRACT="\
     65             system/vendor/lib/libinvensense_mpl.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/BIP.apk \
     76             system/app/IMSFramework.apk \
     77             system/app/RTN.apk \
     78             system/app/SDM.apk \
     79             system/app/SPG.apk \
     80             system/app/SyncMLSvc.apk \
     81             system/bin/fRom \
     82             system/lib/lib_gsd4t.so \
     83             system/lib/libsecril-client.so \
     84             system/lib/libsyncml_core.so \
     85             system/lib/libsyncml_port.so \
     86             system/vendor/lib/libims_jni.so \
     87             system/vendor/lib/libims.so \
     88             system/vendor/lib/libsec-ril_lte.so \
     89             "
     90     ;;
     91   ti)
     92     TO_EXTRACT="\
     93             system/vendor/firmware/ducati-m3.bin \
     94             "
     95     ;;
     96   esac
     97   echo \ \ Extracting files from OTA package
     98   for ONE_FILE in $TO_EXTRACT
     99   do
    100     echo \ \ \ \ Extracting $ONE_FILE
    101     unzip -j -o $ZIP $ONE_FILE -d $FILEDIR > /dev/null || echo \ \ \ \ Error extracting $ONE_FILE
    102     if test $ONE_FILE = system/vendor/bin/gpsd -o $ONE_FILE = system/vendor/bin/pvrsrvinit -o $ONE_FILE = system/bin/fRom
    103     then
    104       chmod a+x $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error chmoding $ONE_FILE
    105     fi
    106     if test $(echo $ONE_FILE | grep \\.apk\$ | wc -l) = 1
    107     then
    108       echo \ \ \ \ Splitting $ONE_FILE
    109       mkdir -p $FILEDIR/$(basename $ONE_FILE).parts || echo \ \ \ \ Error making parts dir for $ONE_FILE
    110       unzip $FILEDIR/$(basename $ONE_FILE) -d $FILEDIR/$(basename $ONE_FILE).parts > /dev/null || echo \ \ \ \ Error unzipping $ONE_FILE
    111       rm $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error removing original $ONE_FILE
    112       rm -rf $FILEDIR/$(basename $ONE_FILE).parts/META-INF || echo \ \ \ \ Error removing META-INF for $ONE_FILE
    113     fi
    114   done
    115   echo \ \ Setting up $COMPANY-specific makefiles
    116   cp -R $COMPANY/staging/* tmp/vendor/$COMPANY/$DEVICE || echo \ \ \ \ Error copying makefiles
    117   echo \ \ Setting up shared makefiles
    118   cp -R root/* tmp/vendor/$MANUFACTURER/$ROOTDEVICE || echo \ \ \ \ Error copying makefiles
    119   echo \ \ Generating self-extracting script
    120   SCRIPT=extract-$COMPANY-$DEVICE.sh
    121   cat PROLOGUE > tmp/$SCRIPT || echo \ \ \ \ Error generating script
    122   cat $COMPANY/COPYRIGHT >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    123   cat PART1 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    124   cat $COMPANY/LICENSE >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    125   cat PART2 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    126   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
    127   cat PART3 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    128   (cd tmp ; tar zc --owner=root --group=root vendor/ >> $SCRIPT || echo \ \ \ \ Error generating embedded tgz)
    129   chmod a+x tmp/$SCRIPT || echo \ \ \ \ Error generating script
    130   ARCHIVE=$COMPANY-$DEVICE-$BUILD-$(md5sum < tmp/$SCRIPT | cut -b -8 | tr -d \\n).tgz
    131   rm -f $ARCHIVE
    132   echo \ \ Generating final archive
    133   (cd tmp ; tar --owner=root --group=root -z -c -f ../$ARCHIVE $SCRIPT || echo \ \ \ \ Error archiving script)
    134   rm -rf tmp
    135 done
    136