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 klp-dev
     18 # 730924 = KRS02B
     19 # 741161 = KRS15
     20 # end klp-dev
     21 BRANCH=klp-dev
     22 if test $BRANCH = klp-dev
     23 then
     24   ZIP=hammerhead-ota-866693
     25   BUILD=866693
     26 fi # klp-dev
     27 ROOTDEVICE=hammerhead
     28 DEVICE=hammerhead
     29 MANUFACTURER=lge
     30 
     31 for COMPANY in broadcom lge qcom
     32 do
     33   echo Processing files from $COMPANY
     34   rm -rf tmp
     35   FILEDIR=tmp/vendor/$COMPANY/$DEVICE/proprietary
     36   mkdir -p $FILEDIR
     37   mkdir -p tmp/vendor/$MANUFACTURER/$ROOTDEVICE
     38   case $COMPANY in
     39   broadcom)
     40     TO_EXTRACT="\
     41             system/vendor/firmware/bcm2079x-b5_firmware.ncd \
     42             system/vendor/firmware/bcm2079x-b5_pre_firmware.ncd \
     43             system/vendor/firmware/bcm4335c0.hcd \
     44             "
     45     ;;
     46   lge)
     47     TO_EXTRACT="\
     48             system/app/OmaDmclient.apk \
     49             system/app/qcrilmsgtunnel.apk \
     50             system/app/SprintHiddenMenu.apk \
     51             system/app/UpdateSetting.apk \
     52             system/etc/Bluetooth_cal.acdb \
     53             system/etc/DxHDCP.cfg \
     54             system/etc/General_cal.acdb \
     55             system/etc/Global_cal.acdb \
     56             system/etc/Handset_cal.acdb \
     57             system/etc/Hdmi_cal.acdb \
     58             system/etc/Headset_cal.acdb \
     59             system/etc/permissions/serviceitems.xml \
     60             system/etc/qcril.db \
     61             system/etc/sensor_def_hh.conf \
     62             system/etc/Speaker_cal.acdb \
     63             system/framework/serviceitems.jar \
     64             system/vendor/bin/vss_init \
     65             system/vendor/firmware/bu24205_LGIT_VER_2_DATA1.bin \
     66             system/vendor/firmware/bu24205_LGIT_VER_2_DATA2.bin \
     67             system/vendor/firmware/bu24205_LGIT_VER_2_DATA3.bin \
     68             system/vendor/firmware/bu24205_LGIT_VER_3_CAL.bin \
     69             system/vendor/firmware/bu24205_LGIT_VER_3_DATA1.bin \
     70             system/vendor/firmware/bu24205_LGIT_VER_3_DATA2.bin \
     71             system/vendor/firmware/bu24205_LGIT_VER_3_DATA3.bin \
     72             system/vendor/firmware/discretix/dxhdcp2.b00 \
     73             system/vendor/firmware/discretix/dxhdcp2.b01 \
     74             system/vendor/firmware/discretix/dxhdcp2.b02 \
     75             system/vendor/firmware/discretix/dxhdcp2.b03 \
     76             system/vendor/firmware/discretix/dxhdcp2.mdt \
     77             system/vendor/firmware/keymaster/keymaster.b00 \
     78             system/vendor/firmware/keymaster/keymaster.b01 \
     79             system/vendor/firmware/keymaster/keymaster.b02 \
     80             system/vendor/firmware/keymaster/keymaster.b03 \
     81             system/vendor/firmware/keymaster/keymaster.mdt \
     82             system/vendor/lib/libAKM8963.so \
     83             system/vendor/lib/libDxHdcp.so \
     84             system/vendor/lib/libvdmengine.so \
     85             system/vendor/lib/libvdmfumo.so \
     86             system/vendor/lib/libvss_common_core.so \
     87             system/vendor/lib/libvss_common_idl.so \
     88             system/vendor/lib/libvss_common_iface.so \
     89             system/vendor/lib/libvss_nv_core.so \
     90             system/vendor/lib/libvss_nv_idl.so \
     91             system/vendor/lib/libvss_nv_iface.so \
     92             "
     93     ;;
     94   qcom)
     95     TO_EXTRACT="\
     96             system/bin/bridgemgrd \
     97             system/bin/diag_klog \
     98             system/bin/diag_mdlog \
     99             system/bin/ds_fmc_appd \
    100             system/bin/irsc_util \
    101             system/bin/mm-qcamera-daemon \
    102             system/bin/mpdecision \
    103             system/bin/netmgrd \
    104             system/bin/nl_listener \
    105             system/bin/port-bridge \
    106             system/bin/qmuxd \
    107             system/bin/qseecomd \
    108             system/bin/radish \
    109             system/bin/rmt_storage \
    110             system/bin/sensors.qcom \
    111             system/bin/subsystem_ramdump \
    112             system/bin/thermal-engine-hh \
    113             system/bin/time_daemon \
    114             system/bin/usbhub \
    115             system/bin/usbhub_init \
    116             system/etc/firmware/cpp_firmware_v1_1_1.fw \
    117             system/etc/firmware/cpp_firmware_v1_1_6.fw \
    118             system/etc/firmware/cpp_firmware_v1_2_0.fw \
    119             system/etc/permissions/qcrilhook.xml \
    120             system/framework/qcrilhook.jar \
    121             system/lib/hw/flp.msm8974.so \
    122             system/lib/hw/gps.msm8974.so \
    123             system/lib/libadsprpc.so \
    124             system/lib/libchromatix_imx179_common.so \
    125             system/lib/libchromatix_imx179_default_video.so \
    126             system/lib/libchromatix_imx179_preview.so \
    127             system/lib/libchromatix_imx179_snapshot.so \
    128             system/lib/libchromatix_mt9m114b_common.so \
    129             system/lib/libchromatix_mt9m114b_default_video.so \
    130             system/lib/libchromatix_mt9m114b_preview.so \
    131             system/lib/libchromatix_mt9m114b_snapshot.so \
    132             system/lib/libdrmdiag.so \
    133             system/lib/libdrmfs.so \
    134             system/lib/libdrmtime.so \
    135             system/lib/libgps.utils.so \
    136             system/lib/libI420colorconvert.so \
    137             system/lib/libloc_core.so \
    138             system/lib/libloc_eng.so \
    139             system/lib/libmm-abl.so \
    140             system/lib/libmmcamera_hdr_lib.so \
    141             system/lib/libmmcamera_image_stab.so \
    142             system/lib/libmmcamera_imx179.so \
    143             system/lib/libmmcamera_mt9m114b.so \
    144             system/lib/libmmcamera_wavelet_lib.so \
    145             system/lib/libmm-color-convertor.so \
    146             system/lib/libmmQSM.so \
    147             system/lib/liboemcrypto.so \
    148             system/lib/libQSEEComAPI.so \
    149             system/lib/libril-qc-qmi-1.so \
    150             system/lib/libstagefright_hdcp.so \
    151             system/lib/libxml.so \
    152             system/vendor/firmware/a330_pfp.fw \
    153             system/vendor/firmware/a330_pm4.fw \
    154             system/vendor/firmware/venus.b00 \
    155             system/vendor/firmware/venus.b01 \
    156             system/vendor/firmware/venus.b02 \
    157             system/vendor/firmware/venus.b03 \
    158             system/vendor/firmware/venus.b04 \
    159             system/vendor/firmware/venus.mdt \
    160             system/vendor/lib/egl/eglsubAndroid.so \
    161             system/vendor/lib/egl/libEGL_adreno.so \
    162             system/vendor/lib/egl/libGLESv1_CM_adreno.so \
    163             system/vendor/lib/egl/libGLESv2_adreno.so \
    164             system/vendor/lib/egl/libplayback_adreno.so \
    165             system/vendor/lib/egl/libq3dtools_adreno.so \
    166             system/vendor/lib/hw/sensors.msm8974.so \
    167             system/vendor/lib/libacdbloader.so \
    168             system/vendor/lib/libacdbrtac.so \
    169             system/vendor/lib/libadiertac.so \
    170             system/vendor/lib/libadreno_utils.so \
    171             system/vendor/lib/libaudcal.so \
    172             system/vendor/lib/libC2D2.so \
    173             system/vendor/lib/libc2d30-a3xx.so \
    174             system/vendor/lib/libc2d30.so \
    175             system/vendor/lib/libCB.so \
    176             system/vendor/lib/libCommandSvc.so \
    177             system/vendor/lib/libconfigdb.so \
    178             system/vendor/lib/libdiag.so \
    179             system/vendor/lib/libdrmdecrypt.so \
    180             system/vendor/lib/libdsi_netctrl.so \
    181             system/vendor/lib/libdsutils.so \
    182             system/vendor/lib/libFuzzmmstillomxenc.so \
    183             system/vendor/lib/libgeofence.so \
    184             system/vendor/lib/libgsl.so \
    185             system/vendor/lib/libidl.so \
    186             system/vendor/lib/libizat_core.so \
    187             system/vendor/lib/libjpegdhw.so \
    188             system/vendor/lib/libjpegehw.so \
    189             system/vendor/lib/libllvm-a3xx.so \
    190             system/vendor/lib/libloc_api_v02.so \
    191             system/vendor/lib/libloc_ds_api.so \
    192             system/vendor/lib/libmmcamera2_c2d_module.so \
    193             system/vendor/lib/libmmcamera2_cpp_module.so \
    194             system/vendor/lib/libmmcamera2_iface_modules.so \
    195             system/vendor/lib/libmmcamera2_imglib_modules.so \
    196             system/vendor/lib/libmmcamera2_isp_modules.so \
    197             system/vendor/lib/libmmcamera2_pproc_modules.so \
    198             system/vendor/lib/libmmcamera2_sensor_modules.so \
    199             system/vendor/lib/libmmcamera2_stats_algorithm.so \
    200             system/vendor/lib/libmmcamera2_stats_modules.so \
    201             system/vendor/lib/libmmcamera2_vpe_module.so \
    202             system/vendor/lib/libmmcamera2_wnr_module.so \
    203             system/vendor/lib/libmmcamera_faceproc.so \
    204             system/vendor/lib/libmmcamera_imglib.so \
    205             system/vendor/lib/libmmcamera_imx179_eeprom.so \
    206             system/vendor/lib/libmmipl.so \
    207             system/vendor/lib/libmmjpeg.so \
    208             system/vendor/lib/libmmqjpeg_codec.so \
    209             system/vendor/lib/libnetmgr.so \
    210             system/vendor/lib/liboemcamera.so \
    211             system/vendor/lib/libqcci_legacy.so \
    212             system/vendor/lib/libqdi.so \
    213             system/vendor/lib/libqdp.so \
    214             system/vendor/lib/libqmi_cci.so \
    215             system/vendor/lib/libqmi_client_qmux.so \
    216             system/vendor/lib/libqmi_common_so.so \
    217             system/vendor/lib/libqmi_csi.so \
    218             system/vendor/lib/libqmi_encdec.so \
    219             system/vendor/lib/libqmiservices.so \
    220             system/vendor/lib/libqmi.so \
    221             system/vendor/lib/libqomx_jpegenc.so \
    222             system/vendor/lib/libril-qcril-hook-oem.so \
    223             system/vendor/lib/librs_adreno_sha1.so \
    224             system/vendor/lib/librs_adreno.so \
    225             system/vendor/lib/libRSDriver_adreno.so \
    226             system/vendor/lib/libsc-a3xx.so \
    227             system/vendor/lib/libsensor1.so \
    228             system/vendor/lib/libsensor_reg.so \
    229             system/vendor/lib/libsensor_user_cal.so \
    230             system/vendor/lib/libtime_genoff.so \
    231             system/vendor/lib/libTimeService.so \
    232             "
    233     ;;
    234   esac
    235   echo \ \ Extracting files from OTA package
    236   for ONE_FILE in $TO_EXTRACT
    237   do
    238     echo \ \ \ \ Extracting $ONE_FILE
    239     unzip -j -o $ZIP $ONE_FILE -d $FILEDIR > /dev/null || echo \ \ \ \ Error extracting $ONE_FILE
    240     if test $ONE_FILE = system/vendor/bin/gpsd -o $ONE_FILE = system/vendor/bin/pvrsrvinit -o $ONE_FILE = system/bin/fRom
    241     then
    242       chmod a+x $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error chmoding $ONE_FILE
    243     fi
    244   done
    245   echo \ \ Setting up $COMPANY-specific makefiles
    246   cp -R $COMPANY/staging/* tmp/vendor/$COMPANY/$DEVICE || echo \ \ \ \ Error copying makefiles
    247   echo \ \ Setting up shared makefiles
    248   cp -R root/* tmp/vendor/$MANUFACTURER/$ROOTDEVICE || echo \ \ \ \ Error copying makefiles
    249   echo \ \ Generating self-extracting script
    250   SCRIPT=extract-$COMPANY-$DEVICE.sh
    251   cat PROLOGUE > tmp/$SCRIPT || echo \ \ \ \ Error generating script
    252   cat $COMPANY/COPYRIGHT >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    253   cat PART1 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    254   cat $COMPANY/LICENSE >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    255   cat PART2 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    256   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
    257   cat PART3 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    258   (cd tmp ; tar zc --owner=root --group=root vendor/ >> $SCRIPT || echo \ \ \ \ Error generating embedded tgz)
    259   chmod a+x tmp/$SCRIPT || echo \ \ \ \ Error generating script
    260   ARCHIVE=$COMPANY-$DEVICE-$BUILD-$(md5sum < tmp/$SCRIPT | cut -b -8 | tr -d \\n).tgz
    261   rm -f $ARCHIVE
    262   echo \ \ Generating final archive
    263   (cd tmp ; tar --owner=root --group=root -z -c -f ../$ARCHIVE $SCRIPT || echo \ \ \ \ Error archiving script)
    264   rm -rf tmp
    265 done
    266