Home | History | Annotate | Download | only in self-extractors
      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.1-dev
     18 # 569806 = JDQ36B
     19 # 573038 = JDQ39
     20 # end jb-mr1.1-dev
     21 # start jb-mr2-dev
     22 # 686185 = JWR53
     23 # 689345 = JWR58
     24 # 690834 = JWR59
     25 # 692263 = JWR60
     26 # 695489 = JWR64
     27 # 699533 = JWR66
     28 # 701448 = JWR66C
     29 # 704243 = JWR66G
     30 # 709441 = JWR66M
     31 # 711294 = JWR66N
     32 # 736095 = JWR66U
     33 # 737497 = JWR66V
     34 # end jb-mr2-dev
     35 BRANCH=klp-dev
     36 if test $BRANCH = jb-mr1.1-dev
     37 then
     38   ZIP=occam-ota-573038
     39   BUILD=jdq39
     40 fi # jb-mr1.1-dev
     41 if test $BRANCH = jb-mr2-dev
     42 then
     43   ZIP=occam-ota-737497
     44   BUILD=jwr66v
     45 fi # jb-mr2-dev
     46 if test $BRANCH = klp-dev
     47 then
     48   ZIP=occam-ota-937116
     49   BUILD=kot49h
     50 fi # klp-dev
     51 ROOTDEVICE=mako
     52 DEVICE=mako
     53 MANUFACTURER=lge
     54 
     55 for COMPANY in broadcom lge qcom
     56 do
     57   echo Processing files from $COMPANY
     58   rm -rf tmp
     59   FILEDIR=tmp/vendor/$COMPANY/$DEVICE/proprietary
     60   mkdir -p $FILEDIR
     61   mkdir -p tmp/vendor/$MANUFACTURER/$ROOTDEVICE
     62   case $COMPANY in
     63   broadcom)
     64     TO_EXTRACT="\
     65             system/vendor/firmware/bcm2079x_firmware.ncd \
     66             system/vendor/firmware/bcm2079x_pre_firmware.ncd \
     67             "
     68     ;;
     69   lge)
     70     TO_EXTRACT="\
     71             system/lib/libacdbdata.so \
     72             system/lib/libAKM.so \
     73             system/lib/libcamera_fast_af.so \
     74             system/lib/libmorpho_noise_reduction.so \
     75             system/vendor/firmware/keymaster/keymaster.b00 \
     76             system/vendor/firmware/keymaster/keymaster.b01 \
     77             system/vendor/firmware/keymaster/keymaster.b02 \
     78             system/vendor/firmware/keymaster/keymaster.b03 \
     79             system/vendor/firmware/keymaster/keymaster.mdt \
     80             "
     81     ;;
     82   qcom)
     83     TO_EXTRACT="\
     84             system/bin/ATFWD-daemon \
     85             system/bin/bridgemgrd \
     86             system/bin/btnvtool \
     87             system/bin/diag_klog \
     88             system/bin/diag_mdlog \
     89             system/bin/ds_fmc_appd \
     90             system/bin/efsks \
     91             system/bin/hci_qcomm_init \
     92             system/bin/ks \
     93             system/bin/mm-qcamera-daemon \
     94             system/bin/mpdecision \
     95             system/bin/netmgrd \
     96             system/bin/nl_listener \
     97             system/bin/port-bridge \
     98             system/bin/qcks \
     99             system/bin/qmuxd \
    100             system/bin/qseecomd \
    101             system/bin/radish \
    102             system/bin/rmt_storage \
    103             system/bin/sensors.qcom \
    104             system/bin/thermald \
    105             system/bin/usbhub \
    106             system/bin/usbhub_init \
    107             system/bin/v4l2-qcamera-app \
    108             system/etc/firmware/tzapps.b00 \
    109             system/etc/firmware/tzapps.b01 \
    110             system/etc/firmware/tzapps.b02 \
    111             system/etc/firmware/tzapps.b03 \
    112             system/etc/firmware/tzapps.mdt \
    113             system/etc/firmware/vidc_1080p.fw \
    114             system/etc/firmware/vidc.b00 \
    115             system/etc/firmware/vidc.b01 \
    116             system/etc/firmware/vidc.b02 \
    117             system/etc/firmware/vidc.b03 \
    118             system/etc/firmware/vidc.mdt \
    119             system/lib/egl/eglsubAndroid.so \
    120             system/lib/egl/libEGL_adreno.so \
    121             system/lib/egl/libGLESv1_CM_adreno.so \
    122             system/lib/egl/libGLESv2_adreno.so \
    123             system/lib/egl/libplayback_adreno.so \
    124             system/lib/egl/libq3dtools_adreno.so \
    125             system/lib/hw/flp.msm8960.so \
    126             system/lib/hw/gps.msm8960.so \
    127             system/lib/hw/sensors.msm8960.so \
    128             system/lib/libacdbloader.so \
    129             system/lib/libadreno_utils.so \
    130             system/lib/libaudcal.so \
    131             system/lib/libaudioalsa.so \
    132             system/lib/libC2D2.so \
    133             system/lib/libc2d30-a3xx.so \
    134             system/lib/libc2d30.so \
    135             system/lib/libCB.so \
    136             system/lib/libchromatix_imx111_default_video.so \
    137             system/lib/libchromatix_imx111_preview.so \
    138             system/lib/libchromatix_imx111_zsl.so \
    139             system/lib/libchromatix_imx119_default_video.so \
    140             system/lib/libchromatix_imx119_preview.so \
    141             system/lib/libchromatix_mt9e013_default_video.so \
    142             system/lib/libchromatix_mt9e013_preview.so \
    143             system/lib/libchromatix_mt9e013_video_hfr.so \
    144             system/lib/libchromatix_ov5647_default_video.so \
    145             system/lib/libchromatix_ov5647_preview.so \
    146             system/lib/libchromatix_ov5647_video_hfr.so \
    147             system/lib/libchromatix_ov8825_default_video.so \
    148             system/lib/libchromatix_ov8825_preview.so \
    149             system/lib/libchromatix_ov9726_default_video.so \
    150             system/lib/libchromatix_ov9726_preview.so \
    151             system/lib/libchromatix_s5k4e1_default_video.so \
    152             system/lib/libchromatix_s5k4e1_preview.so \
    153             system/lib/libchromatix_vx6953_default_video.so \
    154             system/lib/libchromatix_vx6953_preview.so \
    155             system/lib/libCommandSvc.so \
    156             system/lib/libconfigdb.so \
    157             system/lib/libcsd-client.so \
    158             system/lib/libdiag.so \
    159             system/lib/libdrmdiag.so \
    160             system/lib/libdrmfs.so \
    161             system/lib/libdrmtime.so \
    162             system/lib/libdsi_netctrl.so \
    163             system/lib/libdsprofile.so \
    164             system/lib/libdss.so \
    165             system/lib/libdsucsd.so \
    166             system/lib/libdsutils.so \
    167             system/lib/libgemini.so \
    168             system/lib/libgps.utils.so \
    169             system/lib/libgsl.so \
    170             system/lib/libI420colorconvert.so \
    171             system/lib/libidl.so \
    172             system/lib/libimage-jpeg-dec-omx-comp.so \
    173             system/lib/libimage-jpeg-enc-omx-comp.so \
    174             system/lib/libimage-omx-common.so \
    175             system/lib/libllvm-a3xx.so \
    176             system/lib/libloc_core.so \
    177             system/lib/libloc_eng.so \
    178             system/lib/libmercury.so \
    179             system/lib/libmmcamera_faceproc.so \
    180             system/lib/libmmcamera_frameproc.so \
    181             system/lib/libmmcamera_hdr_lib.so \
    182             system/lib/libmmcamera_image_stab.so \
    183             system/lib/libmmcamera_statsproc31.so \
    184             system/lib/libmmcamera_wavelet_lib.so \
    185             system/lib/libmm-color-convertor.so \
    186             system/lib/libmmipl.so \
    187             system/lib/libmmjpeg.so \
    188             system/lib/libmmjps.so \
    189             system/lib/libmmmpod.so \
    190             system/lib/libmmmpo.so \
    191             system/lib/libmmstillomx.so \
    192             system/lib/libnetmgr.so \
    193             system/lib/liboemcamera.so \
    194             system/lib/liboemcrypto.so \
    195             system/lib/libqcci_legacy.so \
    196             system/lib/libqdi.so \
    197             system/lib/libqdp.so \
    198             system/lib/libqmi_cci.so \
    199             system/lib/libqmi_client_qmux.so \
    200             system/lib/libqmi_common_so.so \
    201             system/lib/libqmi_csi.so \
    202             system/lib/libqmi_csvt_srvc.so \
    203             system/lib/libqmi_encdec.so \
    204             system/lib/libqmiservices.so \
    205             system/lib/libqmi.so \
    206             system/lib/libQSEEComAPI.so \
    207             system/lib/libril-qc-qmi-1.so \
    208             system/lib/libril-qcril-hook-oem.so \
    209             system/lib/librs_adreno_sha1.so \
    210             system/lib/librs_adreno.so \
    211             system/lib/libRSDriver_adreno.so \
    212             system/lib/libsc-a3xx.so \
    213             system/lib/libsensor1.so \
    214             system/lib/libsensor_reg.so \
    215             system/lib/libsensor_user_cal.so \
    216             system/lib/libstagefright_hdcp.so \
    217             system/lib/libxml.so \
    218             system/vendor/firmware/a300_pfp.fw \
    219             system/vendor/firmware/a300_pm4.fw \
    220             system/vendor/firmware/dsps.b00 \
    221             system/vendor/firmware/dsps.b01 \
    222             system/vendor/firmware/dsps.b02 \
    223             system/vendor/firmware/dsps.b03 \
    224             system/vendor/firmware/dsps.b04 \
    225             system/vendor/firmware/dsps.b05 \
    226             system/vendor/firmware/dsps.mdt \
    227             system/vendor/firmware/q6.b00 \
    228             system/vendor/firmware/q6.b01 \
    229             system/vendor/firmware/q6.b03 \
    230             system/vendor/firmware/q6.b04 \
    231             system/vendor/firmware/q6.b05 \
    232             system/vendor/firmware/q6.b06 \
    233             system/vendor/firmware/q6.mdt \
    234             system/vendor/firmware/wcnss.b00 \
    235             system/vendor/firmware/wcnss.b01 \
    236             system/vendor/firmware/wcnss.b02 \
    237             system/vendor/firmware/wcnss.b04 \
    238             system/vendor/firmware/wcnss.b05 \
    239             system/vendor/firmware/wcnss.mdt \
    240             system/vendor/lib/libdrmdecrypt.so \
    241             system/vendor/lib/libgeofence.so \
    242             system/vendor/lib/libizat_core.so \
    243             system/vendor/lib/libloc_api_v02.so \
    244             system/vendor/lib/libloc_ds_api.so \
    245             "
    246     ;;
    247   esac
    248   echo \ \ Extracting files from OTA package
    249   for ONE_FILE in $TO_EXTRACT
    250   do
    251     echo \ \ \ \ Extracting $ONE_FILE
    252     unzip -j -o $ZIP $ONE_FILE -d $FILEDIR > /dev/null || echo \ \ \ \ Error extracting $ONE_FILE
    253     if test $ONE_FILE = system/vendor/bin/gpsd -o $ONE_FILE = system/vendor/bin/pvrsrvinit -o $ONE_FILE = system/bin/fRom
    254     then
    255       chmod a+x $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error chmoding $ONE_FILE
    256     fi
    257   done
    258   echo \ \ Setting up $COMPANY-specific makefiles
    259   cp -R $COMPANY/staging/* tmp/vendor/$COMPANY/$DEVICE || echo \ \ \ \ Error copying makefiles
    260   echo \ \ Setting up shared makefiles
    261   cp -R root/* tmp/vendor/$MANUFACTURER/$ROOTDEVICE || echo \ \ \ \ Error copying makefiles
    262   echo \ \ Generating self-extracting script
    263   SCRIPT=extract-$COMPANY-$DEVICE.sh
    264   cat PROLOGUE > tmp/$SCRIPT || echo \ \ \ \ Error generating script
    265   cat $COMPANY/COPYRIGHT >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    266   cat PART1 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    267   cat $COMPANY/LICENSE >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    268   cat PART2 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    269   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
    270   cat PART3 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    271   (cd tmp ; tar zc --owner=root --group=root vendor/ >> $SCRIPT || echo \ \ \ \ Error generating embedded tgz)
    272   chmod a+x tmp/$SCRIPT || echo \ \ \ \ Error generating script
    273   ARCHIVE=$COMPANY-$DEVICE-$BUILD-$(md5sum < tmp/$SCRIPT | cut -b -8 | tr -d \\n).tgz
    274   rm -f $ARCHIVE
    275   echo \ \ Generating final archive
    276   (cd tmp ; tar --owner=root --group=root -z -c -f ../$ARCHIVE $SCRIPT || echo \ \ \ \ Error archiving script)
    277   rm -rf tmp
    278 done
    279