1 #!/bin/bash 2 MY_ANDROID_DIR=$(pwd) 3 MY_BUILD_BOARD="polaris-g739_wifi_hd" 4 GMS_DEVICE=V_TAB_7_LITE_II 5 GMS_PRODUCT=V_TAB_7_LITE_II 6 IS_CLEAN_ANDROID= 7 8 function exports_env() 9 { 10 source build/envsetup.sh 11 lunch V_TAB_7_LITE_II-user 12 } 13 14 function gms_clean() 15 { 16 rm -rf out/dist/ 17 make installclean 18 } 19 20 function gms_build_firm() 21 { 22 23 make -j12 24 pack $MY_BUILD_BOARD 25 get_uboot $MY_BUILD_BOARD 26 make -j8 dist 27 } 28 29 function gms_signed() 30 { 31 ./build/tools/releasetools/sign_target_files_apks -d device/softwinner/V_TAB_7_LITE_II/security out/dist/V_TAB_7_LITE_II-target_files-$(date +%Y%m%d).zip out/dist/signed-target-files.zip 32 34 expect -c" 35 set timeout 1200; 36 37 spawn ./build/tools/releasetools/sign_target_files_apks -d device/softwinner/V_TAB_7_LITE_II/security -e cn.wps.moffice_eng.apk,com.vestel.smartcenter.apk,com.estrongs.android.pop.apk,VideoTest.apk,DragonFire.apk,DragonPhone.apk,SoftWinnerService.apk,SoftWinnerService.apk,com.mxtech.videoplayer.ad.apk=device/softwinner/V_TAB_7_LITE_II/security/releasekey out/dist/V_TAB_7_LITE_II-target_files-$(date +%Y%m%d).zip out/dist/signed-target-files.zip 38 39 expect { 40 \"*password*\" {send \"brn\r\"; exp_continue} 41 \"*password*\" {send \"brn\r\"; exp_continue} 42 \"*password*\" {send \"brn\r\"; exp_continue} 43 \"*password*\" {send \"brn\r\"; } 44 };" 45 46 47 } 48 function gms_makeimg() 49 { 50 ./build/tools/releasetools/img_from_target_files out/dist/signed-target-files.zip out/dist/signed-img.zip 51 rm -rf out/dist/signed-img/ 52 mkdir -p out/dist/signed-img 53 unzip out/dist/signed-img.zip -d out/dist/signed-img 54 cp out/dist/signed-img/*.img $OUT/ 55 pack -s $MY_BUILD_BOARD 56 } 57 function gms_auto_sign() 58 { 59 local UNSIGNED_APK=`./build/tools/releasetools/sign_target_files_apks -d device/softwinner/$GMS_DEVICE/security out/dist/$GMS_PRODUCT-target_files-$(date +%Y%m%d).zip out/dist/signed-target-files.zip | grep \.apk$ | awk ‘{printf "%s,",$0}‘ | sed -e ‘s/ //g‘ | sed -e ‘s/,$//g‘` 60 echo $UNSIGNED_APK 61 expect -c "" sign_apk $GMS_DEVICE $GMS_PRODUCT $UNSIGNED_APK 62 } 63 function gms_ota() 64 { 65 ./build/tools/releasetools/ota_from_target_files out/dist/signed-target-files.zip out/dist/signed-ota.zip 66 BUILD_OTA_INC= 67 ls *.zip >/dev/null 2>&1 68 if [ $? -eq 0 ] ;then 69 BUILD_OTA_INC="true" 70 mv *.zip old-signed-target-files.zip 71 if [ $? -eq 0 ] ;then 72 echo "发现GMS-OTA基础包,修改名称为old-signed-target-files.zip,编译差分包!!" 73 else 74 echo "android目录下已经有.zip的压缩包,请确认删除后编译" 75 fi 76 fi 77 if [ "$BUILD_OTA_INC" = "true" ]; then 78 echo -e "\033[31m============== BUILD_OTA_INC=$BUILD_OTA_INC ============== \033[0m" 79 ./build/tools/releasetools/ota_from_target_files -i old-signed-target-files.zip out/dist/signed-target-files.zip out/dist/signed-ota-inc-`date +%Y%m%d`.zip 80 fi 81 } 82 83 while getopts b:c OPTION 84 do 85 case $OPTION in 86 c) IS_CLEAN_ANDROID=1 87 ;; 88 b) MY_BUILD_BOARD=$OPTARG 89 ;; 90 m) MY_PASSWORD=$OPTARG 91 ;; 92 esac 93 done 94 95 exports_env 96 gms_clean 97 gms_build_firm 98 gms_auto_sign 99 gms_makeimg 100 gms_ota
时间: 2024-10-29 13:36:09