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 (cd ../../../../out/target/product/toroplus ; zip -r ../../../../device/samsung/toroplus/self-extractors/full_toroplus-pseudo_ota.zip system)
     18 ZIP=full_toroplus-pseudo_ota.zip
     19 BUILD=jzo54k
     20 ROOTDEVICE=toroplus
     21 DEVICE=toroplus
     22 MANUFACTURER=samsung
     23 
     24 for COMPANY in broadcom csr imgtec invensense nxp samsung ti
     25 do
     26   echo Processing files from $COMPANY
     27   rm -rf tmp
     28   FILEDIR=tmp/vendor/$COMPANY/$DEVICE/proprietary
     29   mkdir -p $FILEDIR
     30   mkdir -p tmp/vendor/$MANUFACTURER/$ROOTDEVICE
     31   case $COMPANY in
     32   broadcom)
     33     TO_EXTRACT="\
     34             system/vendor/firmware/bcm4330.hcd \
     35             "
     36     ;;
     37   csr)
     38     TO_EXTRACT="\
     39             system/vendor/etc/sirfgps.conf \
     40             system/vendor/lib/hw/gps.omap4.so \
     41             "
     42     ;;
     43   imgtec)
     44     TO_EXTRACT="\
     45             system/vendor/bin/pvrsrvctl \
     46             system/vendor/lib/egl/libEGL_POWERVR_SGX540_120.so \
     47             system/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so \
     48             system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so \
     49             system/vendor/lib/hw/gralloc.omap4.so \
     50             system/vendor/lib/libglslcompiler.so \
     51             system/vendor/lib/libIMGegl.so \
     52             system/vendor/lib/libpvr2d.so \
     53             system/vendor/lib/libpvrANDROID_WSEGL.so \
     54             system/vendor/lib/libPVRScopeServices.so \
     55             system/vendor/lib/libsrv_init.so \
     56             system/vendor/lib/libsrv_um.so \
     57             system/vendor/lib/libusc.so \
     58             "
     59     ;;
     60   invensense)
     61     TO_EXTRACT="\
     62             system/vendor/lib/libinvensense_mpl.so \
     63             "
     64     ;;
     65   nxp)
     66     TO_EXTRACT="\
     67             system/vendor/firmware/libpn544_fw.so \
     68             "
     69     ;;
     70   samsung)
     71     TO_EXTRACT="\
     72             system/app/BIP.apk \
     73             system/app/SDM.apk \
     74             system/app/SecPhone.apk \
     75             system/app/SprintExtension.apk \
     76             system/app/SyncMLSvc.apk \
     77             system/bin/fRom \
     78             system/lib/libsecril-client.so \
     79             system/lib/libsyncml_core.so \
     80             system/lib/libsyncml_port.so \
     81             system/lib/lib_gsd4t.so \
     82             system/vendor/lib/libsec-ril_lte.so \
     83             "
     84     ;;
     85   ti)
     86     TO_EXTRACT="\
     87             system/vendor/firmware/ducati-m3.bin \
     88             "
     89     ;;
     90   esac
     91   echo \ \ Extracting files from OTA package
     92   for ONE_FILE in $TO_EXTRACT
     93   do
     94     echo \ \ \ \ Extracting $ONE_FILE
     95     unzip -j -o $ZIP $ONE_FILE -d $FILEDIR > /dev/null || echo \ \ \ \ Error extracting $ONE_FILE
     96     if test $ONE_FILE = system/vendor/bin/gpsd -o $ONE_FILE = system/vendor/bin/pvrsrvinit -o $ONE_FILE = system/bin/fRom
     97     then
     98       chmod a+x $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error chmoding $ONE_FILE
     99     fi
    100   done
    101   echo \ \ Setting up $COMPANY-specific makefiles
    102   cp -R $COMPANY/staging/* tmp/vendor/$COMPANY/$DEVICE || echo \ \ \ \ Error copying makefiles
    103   echo \ \ Setting up shared makefiles
    104   cp -R root/* tmp/vendor/$MANUFACTURER/$ROOTDEVICE || echo \ \ \ \ Error copying makefiles
    105   echo \ \ Generating self-extracting script
    106   SCRIPT=extract-$COMPANY-$DEVICE.sh
    107   cat PROLOGUE > tmp/$SCRIPT || echo \ \ \ \ Error generating script
    108   cat $COMPANY/COPYRIGHT >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    109   cat PART1 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    110   cat $COMPANY/LICENSE >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    111   cat PART2 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    112   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
    113   cat PART3 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    114   (cd tmp ; tar zc --owner=root --group=root vendor/ >> $SCRIPT || echo \ \ \ \ Error generating embedded tgz)
    115   chmod a+x tmp/$SCRIPT || echo \ \ \ \ Error generating script
    116   ARCHIVE=$COMPANY-$DEVICE-$BUILD-$(md5sum < tmp/$SCRIPT | cut -b -8 | tr -d \\n).tgz
    117   rm -f $ARCHIVE
    118   echo \ \ Generating final archive
    119   (cd tmp ; tar --owner=root --group=root -z -c -f ../$ARCHIVE $SCRIPT || echo \ \ \ \ Error archiving script)
    120   rm -rf tmp
    121 done
    122