[MTK] Android S 编译方法

文摘 Android MediaTek 2022-10-18 阅读:16304
  • 完整编译
python vendor/mediatek/proprietary/scripts/releasetools/split_build_helper.py --run full_k39tv1_64_bsp-user
  • 单独编译命令查看(user)
./vendor/mediatek/proprietary/scripts/releasetools/split_build_helper.py full_k39tv1_64_bsp-user
  • 命令如下:
source build/envsetup.sh && export OUT_DIR=out_sys && lunch sys_mssi_64_cn-user && make sys_images

source build/envsetup.sh && export OUT_DIR=out && lunch vnd_k39tv1_64_bsp-user && make vnd_images krn_images

python out_sys/target/product/mssi_64_cn/images/split_build.py --system-dir out_sys/target/product/mssi_64_cn/images --vendor-dir out/target/product/k39tv1_64_bsp/images --kernel-dir out/target/product/k39tv1_64_bsp/images --output-dir out/target/product/k39tv1_64_bsp/merged
  • 编译Full OTA包
python out_sys/target/product/mssi_64_cn/images/split_build.py --system-dir out_sys/target/product/mssi_64_cn/images --vendor-dir out/target/product/k39tv1_64_bsp/images --kernel-dir out/target/product/k39tv1_64_bsp/images --output-dir out/target/product/k39tv1_64_bsp/merged --otapackage  --targetfiles
  • 查看编译命令(userdebug)
source build/envsetup.sh && export OUT_DIR=out_sys && lunch sys_mssi_64_cn-userdebug && make sys_images

source build/envsetup.sh && export OUT_DIR=out && lunch vnd_k39tv1_64_bsp-userdebug && make vnd_images krn_images

python out_sys/target/product/mssi_64_cn/images/split_build.py --system-dir out_sys/target/product/mssi_64_cn/images --vendor-dir out/target/product/k39tv1_64_bsp/images --kernel-dir out/target/product/k39tv1_64_bsp/images --output-dir out/target/product/k39tv1_64_bsp/merged
  • 编译Full OTA包
python out_sys/target/product/mssi_64_cn/images/split_build.py --system-dir out_sys/target/product/mssi_64_cn/images --vendor-dir out/target/product/k39tv1_64_bsp/images --kernel-dir out/target/product/k39tv1_64_bsp/images --output-dir out/target/product/k39tv1_64_bsp/merged --otapackage  --targetfiles
  • 编译OTA增量包
Non-AB update:

./build/tools/releasetools/ota_from_target_files --block -i source.zip target.zip AB_delta.zip

AB update:

./build/tools/releasetools/ota_from_target_files -p out/host/linux-x86 -k device/mediatek/common/security/releasekey -i source.zip target.zip AB_delta.zip

Note: no need --block, A/B only has block-based update

if your project do not have releasekey, please delete " -k device/mediatek/common/security/releasekey" in command, that will use default key(test key)

Note:

if build failed, please execute the following three commands first:

cp out_sys/host/linux-x86/* out/host/linux-x86/ -rf

cp out_sys/soong/host/linux-x86/* out/host/linux-x86/ -rf

cp out/soong/host/linux-x86/* out/host/linux-x86/ -rf

Before build Increment OTA package, you must ensure you shell environment has done source and lunch!!!

zip is the old version target package, the version on the current platform should be the same as the source.zip version.

zip is the new version target package.
  • OTA如何升级?

1.Non-AB update

Non-AB update can only be performed in recovery mode. Full ota and increment ota methods are the same.

Recovery command update:

adb push update_data.zip /data

adb shell uncrypt /data/update_data.zip /cache/recovery/block.map

adb shell "echo \"--update_package=@/cache/recovery/block.map\" > /cache/recovery/command"

adb reboot recovery

 ADB sideload update:

adb reboot recovery

choose "Apply update form ADB" on recovery UI

adb sideload d:\update.zip

 SD card update:

adb push update.zip /storage/F205-EFBE (/storage/F205-EFBE is SD card mount dir)

adb reboot recovery

choose "Apply update form SD card" on recovery UI

go on choose the update.zip file

2.AB update

AB update can be performed in recovery mode and normal mode, full ota and increment ota methods are the same. We recommend upgrading in normal mode.

There two limitation:

Google do not support AB increment ota with ADB sideload.

Virtual AB(VAB) update in recovery mode, must ensure the super partition size must be greater than twice the sum of the subpartition(vendor/system/product...) sizes.

In recovery mode:

ADB sideload update(VAB only support full ota):

adb reboot recovery

choose "Apply update form ADB" on recovery UI

adb sideload d:\update.zip

SD card update:

adb push update.zip /storage/F205-EFBE (/storage/F205-EFBE is SD card mount dir)

adb reboot recovery

choose "Apply update form SD card" on recovery UI

go on choose the update.zip file

in normal mode:

Copy android source code: system/update_engine/scripts/update_device.py to you PC

Connect platform with PC via usb cable

python update_device.py  --file  update.zip

note:

Android Q/R

         PC need install python2.7

         update_device.py need mask line 32 and line 285

         line 32:import update_payload.payload

         line285:headers += 'USER_AGENT=Dalvik (something, something)\n'

Android S or T ......

         pc need install python version3.0

         python3 version update_device.py need mask line 39 and line 324

         line 39: import update_payload.payload

         line 324: headers += 'USER_AGENT=Dalvik (something, something)\n'

0条评论

© 2024 芯缘异码. Powered by Typecho