Home | History | Annotate | Download | only in self-extractors
      1 #!/bin/sh
      2 
      3 # Copyright 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 # start jb-mr1-dev
     18 # 561924 = JOP40G
     19 # end jb-mr1-dev
     20 # start jb-mr1.1-dev
     21 # 551245 = JDP82
     22 # 573038 = JDQ39
     23 # end jb-mr1.1-dev
     24 # start jb-mr2-dev
     25 # 681336 = JWR50
     26 # 683083 = JWR51
     27 # 684634 = JWR52
     28 # 686185 = JWR53
     29 # 689345 = JWR58
     30 # 690834 = JWR59
     31 # 692263 = JWR60
     32 # 695489 = JWR64
     33 # 699533 = JWR66
     34 # 701448 = JWR66C
     35 # 704243 = JWR66G
     36 # 711294 = JWR66N
     37 # 736095 = JWR66U
     38 # 737497 = JWR66V
     39 # end jb-mr2-dev
     40 BRANCH=jb-mr2-dev
     41 if test $BRANCH = jb-mr1-dev
     42 then
     43   ZIP=nakasig-ota-561924.zip
     44   BUILD=jop40g
     45 fi # jb-mr1-dev
     46 if test $BRANCH = jb-mr1.1-dev
     47 then
     48   ZIP=nakasig-ota-573038.zip
     49   BUILD=jdq39
     50 fi # jb-mr1.1-dev
     51 if test $BRANCH = jb-mr2-dev
     52 then
     53   ZIP=nakasig-ota-737497
     54   BUILD=jwr66v
     55 fi # jb-mr2-dev
     56 ROOTDEVICE=tilapia
     57 DEVICE=tilapia
     58 MANUFACTURER=asus
     59 
     60 for COMPANY in asus broadcom elan invensense nvidia nxp widevine
     61 do
     62   echo Processing files from $COMPANY
     63   rm -rf tmp
     64   FILEDIR=tmp/vendor/$COMPANY/$DEVICE/proprietary
     65   mkdir -p $FILEDIR
     66   mkdir -p tmp/vendor/$MANUFACTURER/$ROOTDEVICE
     67   case $COMPANY in
     68   asus)
     69     TO_EXTRACT="\
     70             system/bin/sensors-config \
     71             system/etc/apns-conf.xml \
     72             system/lib/hw/camera.tegra3.so \
     73             system/lib/hw/sensors.grouper.so \
     74             system/lib/libsensors.lightsensor.so \
     75             system/lib/libxgold-ril.so \
     76             system/vendor/lib/drm/libdrmwvmplugin.so \
     77             system/vendor/lib/libwvm.so \
     78             "
     79     ;;
     80   broadcom)
     81     TO_EXTRACT="\
     82             system/bin/glgps \
     83             system/etc/firmware/bcm4330.hcd \
     84             system/etc/gps/gpsconfig.xml \
     85             system/lib/hw/gps.tegra3.so \
     86             "
     87     ;;
     88   elan)
     89     TO_EXTRACT="\
     90             system/etc/firmware/touch_fw.ekt \
     91             "
     92     ;;
     93   invensense)
     94     TO_EXTRACT="\
     95             system/lib/libinvensense_hal.so \
     96             system/lib/libmllite.so \
     97             system/lib/libmplmpu.so \
     98             "
     99     ;;
    100   nvidia)
    101     TO_EXTRACT="\
    102             system/bin/tf_daemon \
    103             system/etc/firmware/nvavp_os_00001000.bin \
    104             system/etc/firmware/nvavp_os_0ff00000.bin \
    105             system/etc/firmware/nvavp_os_e0000000.bin \
    106             system/etc/firmware/nvavp_os_eff00000.bin \
    107             system/etc/firmware/nvavp_vid_ucode_alt.bin \
    108             system/etc/nvcamera.conf \
    109             system/etc/nvram.txt \
    110             system/lib/egl/libEGL_tegra.so \
    111             system/lib/egl/libGLESv1_CM_tegra.so \
    112             system/lib/egl/libGLESv2_tegra.so \
    113             system/lib/hw/gralloc.tegra3.so \
    114             system/lib/hw/hwcomposer.tegra3.so \
    115             system/lib/libardrv_dynamic.so \
    116             system/lib/libcgdrv.so \
    117             system/lib/libnvapputil.so \
    118             system/lib/libnvasfparserhal.so \
    119             system/lib/libnvaviparserhal.so \
    120             system/lib/libnvavp.so \
    121             system/lib/libnvcamerahdr.so \
    122             system/lib/libnvddk_2d.so \
    123             system/lib/libnvddk_2d_v2.so \
    124             system/lib/libnvdispmgr_d.so \
    125             system/lib/libnvmm.so \
    126             system/lib/libnvmmlite.so \
    127             system/lib/libnvmmlite_audio.so \
    128             system/lib/libnvmmlite_image.so \
    129             system/lib/libnvmmlite_utils.so \
    130             system/lib/libnvmmlite_video.so \
    131             system/lib/libnvmm_audio.so \
    132             system/lib/libnvmm_camera.so \
    133             system/lib/libnvmm_contentpipe.so \
    134             system/lib/libnvmm_image.so \
    135             system/lib/libnvmm_manager.so \
    136             system/lib/libnvmm_misc.so \
    137             system/lib/libnvmm_parser.so \
    138             system/lib/libnvmm_service.so \
    139             system/lib/libnvmm_utils.so \
    140             system/lib/libnvmm_video.so \
    141             system/lib/libnvmm_writer.so \
    142             system/lib/libnvodm_dtvtuner.so \
    143             system/lib/libnvodm_hdmi.so \
    144             system/lib/libnvodm_imager.so \
    145             system/lib/libnvodm_misc.so \
    146             system/lib/libnvodm_query.so \
    147             system/lib/libnvomx.so \
    148             system/lib/libnvomxilclient.so \
    149             system/lib/libnvos.so \
    150             system/lib/libnvparser.so \
    151             system/lib/libnvrm.so \
    152             system/lib/libnvrm_graphics.so \
    153             system/lib/libnvsm.so \
    154             system/lib/libnvtvmr.so \
    155             system/lib/libnvwinsys.so \
    156             system/lib/libnvwsi.so \
    157             system/lib/libstagefrighthw.so \
    158             system/lib/libtf_crypto_sst.so \
    159             "
    160     ;;
    161   nxp)
    162     TO_EXTRACT="\
    163             system/vendor/firmware/libpn544_fw.so \
    164             "
    165     ;;
    166   widevine)
    167     TO_EXTRACT="\
    168             system/lib/libdrmdecrypt.so \
    169             system/vendor/lib/libwvdrm_L1.so \
    170             system/vendor/lib/libWVStreamControlAPI_L1.so
    171             "
    172     ;;
    173   esac
    174   echo \ \ Extracting files from OTA package
    175   for ONE_FILE in $TO_EXTRACT
    176   do
    177     echo \ \ \ \ Extracting $ONE_FILE
    178     unzip -j -o $ZIP $ONE_FILE -d $FILEDIR > /dev/null || echo \ \ \ \ Error extracting $ONE_FILE
    179     if test $ONE_FILE = system/vendor/bin/gpsd -o $ONE_FILE = system/vendor/bin/pvrsrvinit -o $ONE_FILE = system/bin/fRom
    180     then
    181       chmod a+x $FILEDIR/$(basename $ONE_FILE) || echo \ \ \ \ Error chmoding $ONE_FILE
    182     fi
    183   done
    184   echo \ \ Setting up $COMPANY-specific makefiles
    185   cp -R $COMPANY/staging/* tmp/vendor/$COMPANY/$DEVICE || echo \ \ \ \ Error copying makefiles
    186   echo \ \ Setting up shared makefiles
    187   cp -R root/* tmp/vendor/$MANUFACTURER/$ROOTDEVICE || echo \ \ \ \ Error copying makefiles
    188   echo \ \ Generating self-extracting script
    189   SCRIPT=extract-$COMPANY-$DEVICE.sh
    190   cat PROLOGUE > tmp/$SCRIPT || echo \ \ \ \ Error generating script
    191   cat $COMPANY/COPYRIGHT >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    192   cat PART1 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    193   cat $COMPANY/LICENSE >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    194   cat PART2 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    195   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
    196   cat PART3 >> tmp/$SCRIPT || echo \ \ \ \ Error generating script
    197   (cd tmp ; tar zc --owner=root --group=root vendor/ >> $SCRIPT || echo \ \ \ \ Error generating embedded tgz)
    198   chmod a+x tmp/$SCRIPT || echo \ \ \ \ Error generating script
    199   ARCHIVE=$COMPANY-$DEVICE-$BUILD-$(md5sum < tmp/$SCRIPT | cut -b -8 | tr -d \\n).tgz
    200   rm -f $ARCHIVE
    201   echo \ \ Generating final archive
    202   (cd tmp ; tar --owner=root --group=root -z -c -f ../$ARCHIVE $SCRIPT || echo \ \ \ \ Error archiving script)
    203   rm -rf tmp
    204 done
    205