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