#!/bin/bash ############################################### #脚本需要放置在根目录下运行 ############################################### stty erase '^H' version="" WORKSPACE=$(pwd) ANDROID_DIR=$WORKSPACE"/kernel/android/pie" ROOTFS_NAME="R1" #SQA_PATH=$WORKSPACE"/SQA_DailyBuild/cts-golden" SQA_PATH=$WORKSPACE"/SQA_DailyBuild/odin" SQA_AUDIO_FW_PATH=$WORKSPACE"/SQA_DailyBuild/tv051" #ANDROIDDEVICE="R1" VIDEO_ADDNAME=".opt.2k" AUDIO_ADDNAME=".MS12D.AC4.dbx" BOOTCODE="RTD285OB6_B1_F1_TV051" NEWSAN_BOOTCODE="RTD285OB6_B1_F1_TV051_SA" CUS_ID="tv051" PROJECTNAME="develop.android.pie.rtd284o.tv051.emmc.andtv.optee" COPYTMPNAME=$PROJECTNAME"_img" KEY_OPTION=$WORKSPACE"/kernel/android/pie/device/tv051/R1/rt2841Releasekeys" Temp_file=$WORKSPACE"/temp_file/temp_file_41" RTK_TV_NEWMENU=FALSE INSTALL_SCAST_APP=true INSTALL_E_SHOW_APP=true INSTALL_ESTICKER_APP=false # 带S表示SCBC的; INSTALL_ESTICKER_S_APP=true INSTALL_PRIMEVIDEO_APP=false # 带S表示SCBC的; INSTALL_PRIMEVIDEO_S_APP=true # 导入公版蓝牙 INSTALL_AUDIOCONNECT_APP=true # 导入松下蓝牙; INSTALL_AUDIOLINK_APP=false TARGET_INSTALL_ARTEL_TVAPP=false TCL_APPS_SVN_SRC_APK=https://odm-design-center-hz.tclking.com/svn/scbc_apps/trunk/app/apk # check cur path is android top if [ ! -d $ANDROID_DIR/frameworks ]; then echo "please run me from android top path." exit 0 fi if [ ! -d "$Temp_file" ]; then cd $WORKSPACE mkdir temp_file chmod 755 -R temp_file fi function customize_app() { export INSTALL_SCAST_APP=$INSTALL_SCAST_APP export INSTALL_E_SHOW_APP=$INSTALL_E_SHOW_APP export INSTALL_ESTICKER_APP=$INSTALL_ESTICKER_APP export INSTALL_ESTICKER_S_APP=$INSTALL_ESTICKER_S_APP export INSTALL_PRIMEVIDEO_APP=$INSTALL_PRIMEVIDEO_APP export INSTALL_PRIMEVIDEO_S_APP=$INSTALL_PRIMEVIDEO_S_APP export INSTALL_AUDIOCONNECT_APP=$INSTALL_AUDIOCONNECT_APP export INSTALL_AUDIOLINK_APP=$INSTALL_AUDIOLINK_APP echo "INSTALL_SCAST_APP: " $INSTALL_SCAST_APP echo "INSTALL_E_SHOW_APP: " $INSTALL_E_SHOW_APP echo "INSTALL_ESTICKER_APP: " $INSTALL_ESTICKER_APP echo "INSTALL_ESTICKER_S_APP: " $INSTALL_ESTICKER_S_APP echo "INSTALL_PRIMEVIDEO_APP: " $INSTALL_PRIMEVIDEO_APP echo "INSTALL_PRIMEVIDEO_S_APP: " $INSTALL_PRIMEVIDEO_S_APP echo "INSTALL_AUDIOCONNECT_APP: " $INSTALL_AUDIOCONNECT_APP echo "INSTALL_AUDIOLINK_APP: " $INSTALL_AUDIOLINK_APP } var_d=$(date '+%m%d%H') mmver="V$var_d" echo "MAIN::var_d=" $var_d echo "MAIN::mmver=" $mmver function pre_build_debug() { version="V8-T841T01-debug$var_d" CTS_build=n OTA_build=y Rebuild=y Checkout_app=y export TCL_PRODUCT_VERSION=$version export TARGET_INSTALL_ARTEL_TVAPP=$INSTALL_ARTEL_TVAPP echo "userdebug: TCL_PRODUCT_VERSION: " $TCL_PRODUCT_VERSION echo "TARGET_INSTALL_ARTEL_TVAPP: " $INSTALL_ARTEL_TVAPP repo forall -c "pwd && git clean -xfd && git checkout -- ." rm -rf out repo init -u ssh://10.126.16.60:29418/rt2841_manifest -m odin-gms.xml -b master repo sync -j8 if [ x$Checkout_app = "xy" ]; then HEAD_VERSION=$(svn info $TCL_APPS_SVN_SRC_APK | grep Revision | cut -d' ' -f2) if [ -z "$HEAD_VERSION" ]; then echo "HEAD_VERSION is empty, continue without update apps." HEAD_VERSION="0000" else echo "Update apps to SVN $HEAD_VERSION" ./kernel/android/pie/device/tv051/R1/update_debug_apps_rt2841.sh echo "===================================save_apps_svn ==============================" ./kernel/android/pie/device/tv051/R2/save_apps_svn.sh fi fi customize_app mmver="V$var_d"_SVN-"$HEAD_VERSION" repo manifest -r -o manifest-master-$mmver.xml cd $ANDROID_DIR/build/make sed -i "s/ro.build.user=.*/ro.build.user=\DailyBuild\"/" tools/buildinfo.sh sed -i "s/ro.build.host=.*/ro.build.host=\scbc-X299-WU8\"/" tools/buildinfo.sh } function build_android() { if [ x$CTS_build = "xy" ]; then ANDROIDLUNCHNAME="R1-user" COMPILEMODE="user" else ANDROIDLUNCHNAME="R1-userdebug" COMPILEMODE="userdebug" fi if [ x$Rebuild = "xy" ]; then make_kernel_android Compile_Libvip else make_kernel_android_noclean Compile_Libvip fi make_img if [ x$OTA_build = "xy" ]; then if [ x$CTS_build = "xy" ]; then echo "There is not make ota !!!!" else make_ota fi fi } #报错退出 function make_error_exit() { if [ "$(echo $?)" != "0" ]; then #在make clean;make如果失败,则走到这一步,即可在下面进行打印或操作; echo "There is a error , The compiler is fail !!!!" exit fi } #编译VIP function Compile_Libvip() { # Compile VIP TABLE cd $WORKSPACE/kernel/android/pie/vendor/realtek/frameworks/native/libvip/ ./genPanelFactory.pl } #编译kernel 时间比较长 function make_kernel_android() { echo "start make kernel & android" cd $ANDROID_DIR rtk_image=$ANDROID_DIR/device/tv051/$ROOTFS_NAME/rtk_images/ # Copy binary files (audio/video/bootcode/bootfile/kcpu/factory) for ota build unzip -o $SQA_PATH/AV_FW/bluecore.video"$VIDEO_ADDNAME".zip -d $rtk_image unzip -o $SQA_AUDIO_FW_PATH/AV_FW/bluecore.audio"$AUDIO_ADDNAME".zip -d $rtk_image cp -f $ANDROID_DIR/vendor/realtek/optee_os/optee_img_v3/tee.bin $rtk_image if [ x$CUSTOMER = "xNEWSAN" ]; then cp -f $WORKSPACE/SQA_DailyBuild/6in1Board/bootcode/$NEWSAN_BOOTCODE/bootloader.tar $rtk_image else cp -f $WORKSPACE/SQA_DailyBuild/bootcode/$BOOTCODE/bootloader.tar $rtk_image fi cp -f $WORKSPACE/image_file_creator/components/packages/package7/customer/$CUS_ID/bootfile.image $rtk_image cp -f $Temp_file/* $rtk_image # Run process.sh to encrypt cd $rtk_image ./process.sh # Add default power to 'On' cd $ANDROID_DIR"/vendor/realtek/hardware/interfaces/rtkconfigs/1.0/default/RtkProjectConfigs/ProjectConfigs/model" sed -i 's/^ModeStatus = 1/ModeStatus = 0/g' EU_1_RT41_32.ini cd $WORKSPACE/kernel/system # make kernel/android user build + ota # ./build_android_pie.sh [-p project_name] [-c y/n] [-v Build_variant] [-d device_name] {-j job} {-k key_path} case $COMPILEMODE in user) ./build_android_pie.sh -p $PROJECTNAME -c y -v $COMPILEMODE -d $ROOTFS_NAME -j 32 -k $KEY_OPTION -V n -n $RTK_TV_NEWMENU ;; *) ./build_android_pie.sh -p $PROJECTNAME -c y -v $COMPILEMODE -d $ROOTFS_NAME -j 32 -V n -n $RTK_TV_NEWMENU ;; esac make_error_exit echo "make kernel_android succeed" } function make_kernel_android_noclean() { echo "start make kernel & android without clean" echo "start make kernel & android" cd $ANDROID_DIR rtk_image=$ANDROID_DIR/device/tv051/$ROOTFS_NAME/rtk_images/ # Copy binary files (audio/video/bootcode/bootfile/kcpu/factory) for ota build unzip -o $SQA_PATH/AV_FW/bluecore.video"$VIDEO_ADDNAME".zip -d $rtk_image unzip -o $SQA_AUDIO_FW_PATH/AV_FW/bluecore.audio"$AUDIO_ADDNAME".zip -d $rtk_image cp -f $ANDROID_DIR/vendor/realtek/optee_os/optee_img_v3/tee.bin $rtk_image if [ x$CUSTOMER = "xNEWSAN" ]; then cp -f $WORKSPACE/SQA_DailyBuild/6in1Board/bootcode/$NEWSAN_BOOTCODE/bootloader.tar $rtk_image else cp -f $WORKSPACE/SQA_DailyBuild/bootcode/$BOOTCODE/bootloader.tar $rtk_image fi cp -f $Temp_file/* $rtk_image cd $rtk_image ./process.sh cd $WORKSPACE/kernel/system # make kernel/android user build + ota # ./build_android_pie.sh [-p project_name] [-c y/n] [-v Build_variant] [-d device_name] {-j job} {-k key_path} case $COMPILEMODE in user) ./build_android_pie.sh -p $PROJECTNAME -c n -v $COMPILEMODE -d $ROOTFS_NAME -j 32 -k $KEY_OPTION -V n -n $RTK_TV_NEWMENU ;; *) ./build_android_pie.sh -p $PROJECTNAME -c n -v $COMPILEMODE -d $ROOTFS_NAME -j 32 -V n -n $RTK_TV_NEWMENU ;; esac make_error_exit echo "make kernel & android without clean succeed" } #编译ota function make_ota() { cd $ANDROID_DIR rtk_image=$ANDROID_DIR/device/tv051/$ROOTFS_NAME/rtk_images/ # Copy binary files (audio/video/bootcode/bootfile/kcpu/factory) for ota build unzip -o $SQA_PATH/AV_FW/bluecore.video"$VIDEO_ADDNAME".zip -d $rtk_image unzip -o $SQA_AUDIO_FW_PATH/AV_FW/bluecore.audio"$AUDIO_ADDNAME".zip -d $rtk_image cp -f $ANDROID_DIR/vendor/realtek/optee_os/optee_img_v3/tee.bin $rtk_image if [ x$CUSTOMER = "xNEWSAN" ]; then cp -f $WORKSPACE/SQA_DailyBuild/6in1Board/bootcode/$NEWSAN_BOOTCODE/bootloader.tar $rtk_image else cp -f $WORKSPACE/SQA_DailyBuild/bootcode/$BOOTCODE/bootloader.tar $rtk_image fi cp -f $WORKSPACE/image_file_creator/components/packages/package7/customer/$CUS_ID/bootfile.image $rtk_image cp -f $WORKSPACE/image_file_creator/components/tmp/pkgfile/package7/factory.tar $rtk_image source build/envsetup.sh #选择需要设备 lunch $ANDROIDLUNCHNAME make otapackage -j4 make_error_exit } #make img function make_img() { echo "start to make_img()>>>>>>>>>>>>>>>>>>>>>>>>>>>>" echo $PROJECTNAME echo $COPYTMPNAME cd $WORKSPACE/image_file_creator/ #git clean -fdx #git reset --hard ### Copy OPTEE to different image_file_creator echo "copy kernel/optee" cp -rf ../kernel/system/tmp/$COPYTMPNAME/* components/packages/package7/ cp -f $ANDROID_DIR/vendor/realtek/optee_os/optee_img_v3/tee.bin components/packages/package7/customer/$CUS_ID/ cp -f $ANDROID_DIR/vendor/realtek/optee_os/optee_img_v3/tee.map components/packages/package7/customer/$CUS_ID/ echo "copy bin_panel" mkdir -p $WORKSPACE/image_file_creator/components/packages/package7/ap/bin/Resource/factory/bin_panel/PanelParam/ mkdir -p $WORKSPACE/image_file_creator/components/packages/package7/factory/bin_panel/PanelParam/ cd $WORKSPACE/kernel/android/pie/vendor/realtek/frameworks/native/libvip/bin_panel/PanelParam/ cp -rf *_osd.bin *_pq.bin hdr_table.bin $WORKSPACE/image_file_creator/components/packages/package7/ap/bin/Resource/factory/bin_panel/PanelParam/ cp -rf *_osd.bin *_pq.bin hdr_table.bin $WORKSPACE/image_file_creator/components/packages/package7/factory/bin_panel/PanelParam/ cd - echo "copy video/audio fw" # VCPU 1 cp -f $SQA_PATH"/AV_FW/bluecore.video"$VIDEO_ADDNAME".zip" components/packages/package7/bluecore.video.zip cp -f $SQA_PATH"/AV_FW/System.map.video"$VIDEO_ADDNAME components/packages/package7/System.map.video # ACPU 1 cp -f $SQA_AUDIO_FW_PATH"/AV_FW/bluecore.audio"$AUDIO_ADDNAME".zip" components/packages/package7/bluecore.audio.zip cp -f $SQA_AUDIO_FW_PATH"/AV_FW/System.map.audio"$AUDIO_ADDNAME components/packages/package7/System.map.audio #add impdata cp -f $ANDROID_DIR/out/target/product/$ROOTFS_NAME/impdata.img components/packages/package7/ # Make image with bootcode if [ x$CUSTOMER = "xNEWSAN" ]; then cp -f $WORKSPACE/SQA_DailyBuild/6in1Board/bootcode/$NEWSAN_BOOTCODE/bootloader.tar $WORKSPACE/image_file_creator/components/packages/package7/ else cp -f $WORKSPACE/SQA_DailyBuild/bootcode/$BOOTCODE/bootloader.tar $WORKSPACE/image_file_creator/components/packages/package7/ fi make image PACKAGES=package7 install_ap=1 install_bootloader=1 CUSTOMER_ID=$CUS_ID PROJECT_NAME=$PROJECTNAME install_impdata=1 mv install.img install_USB.img mv install.img.impdata install.img.impdata_USB cp -f $WORKSPACE/image_file_creator/components/tmp/pkgfile/package7/factory.tar $Temp_file if [ x$CTS_build = "xy" ]; then # Make GSI image with bootcode echo "make gsi image with bootcode..." rm -rf $WORKSPACE/image_file_creator/components/packages/package7/vbmeta.img rm -rf $WORKSPACE/image_file_creator/components/packages/package7/system.img cp -f $WORKSPACE/GSI_Image/* $WORKSPACE/image_file_creator/components/packages/package7/ make image PACKAGES=package7 install_ap=1 install_bootloader=1 CUSTOMER_ID=$CUS_ID PROJECT_NAME=$PROJECTNAME install_impdata=1 mv install.img install_GSI.img fi make_error_exit echo "make img succeed" } function copy_file() { var_md=$(date '+%m%d') echo "make_userdebug::var_md=" $var_md rm -rf $WORKSPACE/DailyBuild_RT2841* mkdir -p $WORKSPACE/DailyBuild_RT2841_$var_md cp -f $WORKSPACE/image_file_creator/install_USB.img $WORKSPACE/DailyBuild_RT2841_$var_md/$version.img if [ x$CTS_build = "xy" ]; then cp -f $WORKSPACE/image_file_creator/install_GSI.img $WORKSPACE/DailyBuild_RT2841_$var_md/$version_GSI.img cp -f $ANDROID_DIR/signed-ota_update.zip $WORKSPACE/DailyBuild_RT2841_$var_md/signed-ota_rt2841_update.zip else cp -f $ANDROID_DIR/out/target/product/R1/*.zip $WORKSPACE/DailyBuild_RT2841_$var_md/signed-ota_rt2841_update.zip fi mv $WORKSPACE/manifest-master-$mmver.xml $WORKSPACE/DailyBuild_RT2841_$var_md/ md5sum $WORKSPACE/DailyBuild_RT2841_$var_md/* >$WORKSPACE/DailyBuild_RT2841_$var_md/MD5.TXT cp -r $WORKSPACE/DailyBuild_RT2841_$var_md /home/RT2841_2851_dailybuild/ } pre_build_debug build_android copy_file