MTK A B system说明及配置_mtk12

1.2. A/B system updates配置

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-c7sbpwY1-1607650089118)(_v_images/_1584016499_27171.png)]

1.2.1. device目录下的修改
1.2.1.1. ProjectConfig.mk
  • 路径:device/mediateksample/tb8788p1_64_bsp/ProjectConfig.mk
//把新添加的MTK_AB_OTA_UPDATER添加到AUTO_ADD_GLOBAL_DEFINE_BY_NAME属性后面
+AUTO_ADD_GLOBAL_DEFINE_BY_NAME = MTK_AB_OTA_UPDATER ........
........
+MTK_AB_OTA_UPDATER = yes

1.2.1.2. device.mk
  • 路径:device/mediateksample/tb8788p1_64_bsp/device.mk
+AB_OTA_UPDATER := true
+BOARD_USES_RECOVERY_AS_BOOT := true
+BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+BOARD_USES_SYSTEM_OTHER_ODEX := true
+TARGET_NO_RECOVERY := true
+AB_OTA_PARTITIONS := \
+boot \
+system \
+lk \
+preloader

1.2.2. kernel目录下的修改
1.2.2.1. tb8788p1_64_bsp_debug_defconfig
  • 路径:kernel-4.4/arch/arm64/configs/tb8788p1_64_bsp_debug_defconfig
@@ -164,6 +164,16 @@ CONFIG_MTK_CM32181=y
 # CONFIG_MTK_AKM09911 is not set
 # CONFIG_CUSTOM_KERNEL_GYROSCOPE is not set
 # CONFIG_MTK_BMG160 is not set
+# enable dm-verity
+CONFIG_KEYS=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_MD_LINEAR=y
+CONFIG_DM_ANDROID_VERITY=y
+CONFIG_ASYMMETRIC_KEY_TYPE=y
+CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
+CONFIG_X509_CERTIFICATE_PARSER=y
+CONFIG_SYSTEM_TRUSTED_KEYRING=y
+CONFIG_SYSTEM_TRUSTED_KEYS="certs/verity.x509.pem"
 CONFIG_MTK_HWMON=y
 CONFIG_MTK_BTIF=y
 CONFIG_MTK_MD1_SUPPORT=9
@@ -206,6 +216,7 @@ CONFIG_MTK_TINYSYS_SCP_SUPPORT=y
 CONFIG_MTK_TINYSYS_SSPM_SUPPORT=y
 CONFIG_MTK_SMI_EXT=y
 #CONFIG_MTK_VIBRATOR is not set
+CONFIG_MTK_AB_OTA_UPDATER=y
 CONFIG_USB_MTK_DUALMODE=y
 CONFIG_USB_MTK_IDDIG=y


1.2.2.2. tb8788p1_64_bsp_defconfig
  • 路径:kernel-4.4/arch/arm64/configs/tb8788p1_64_bsp_defconfig
@@ -162,6 +162,16 @@ CONFIG_MTK_CM32181=y
 # CONFIG_MTK_AKM09911 is not set
 # CONFIG_CUSTOM_KERNEL_GYROSCOPE is not set
 # CONFIG_MTK_BMG160 is not set
+# enable dm-verity
+CONFIG_KEYS=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_MD_LINEAR=y
+CONFIG_DM_ANDROID_VERITY=y
+CONFIG_ASYMMETRIC_KEY_TYPE=y
+CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y
+CONFIG_X509_CERTIFICATE_PARSER=y
+CONFIG_SYSTEM_TRUSTED_KEYRING=y
+CONFIG_SYSTEM_TRUSTED_KEYS="certs/verity.x509.pem"
 CONFIG_MTK_HWMON=y
 CONFIG_MTK_BTIF=y
 CONFIG_MTK_MD1_SUPPORT=9
@@ -204,6 +214,7 @@ CONFIG_MTK_TINYSYS_SCP_SUPPORT=y
 CONFIG_MTK_TINYSYS_SSPM_SUPPORT=y
 CONFIG_MTK_SMI_EXT=y
 #CONFIG_MTK_VIBRATOR is not set
+CONFIG_MTK_AB_OTA_UPDATER=y
 CONFIG_USB_MTK_DUALMODE=y
 CONFIG_USB_MTK_IDDIG=y
 CONFIG_MTK_FPSGO=y

1.2.3. lk目录下的修改
1.2.3.1. tb8788p1_64_bsp.mk
  • 路径:vendor/mediatek/proprietary/bootable/bootloader/lk/project/tb8788p1_64_bsp.mk
@@ -29,7 +29,7 @@ CUSTOM_LK_USB_UNIQUE_SERIAL=no
 MTK_TINYSYS_SCP_SUPPORT = yes
 MTK_PROTOCOL1_RAT_CONFIG = Lf/Lt/W/G
 MTK_GOOGLE_TRUSTY_SUPPORT = no
-MTK_AB_OTA_UPDATER = no
+MTK_AB_OTA_UPDATER = yes
 DEFINES += MTK_MT6370_PMU
 DEVELOP_STAGE = SB
 MTK_TINYSYS_SSPM_SUPPORT = yes

1.2.3. preloader目录下的修改
1.2.3.1. tb8788p1_64_bsp.mk
  • 路径:vendor/mediatek/proprietary/bootable/bootloader/preloader/custom/tb8788p1_64_bsp/tb8788p1_64_bsp.mk
@@ -7,6 +7,7 @@ MTK_SEC_BOOT=ATTR_SBOOT_ONLY_ENABLE_ON_SCHIP
 MTK_SEC_MODEM_AUTH=no
 MTK_SEC_SECRO_AC_SUPPORT=yes
 # Platform
+MTK_AB_OTA_UPDATER=yes
 MTK_MT6336_SUPPORT=yes
 MTK_FAN5405_SUPPORT=no
 MTK_EMMC_SUPPORT=yes
@@ -32,4 +33,4 @@ MTK_LP4_DDR3200=yes
 MTK_LP4_DRAM_SUPPORT=yes
 MTK_TEE_SUPPORT = yes
 TRUSTKERNEL_TEE_SUPPORT = yes
 //在export后面将新添加的MTK_AB_OTA_UPDATER加进去
-export MTK_PLATFORM MTK_MT6336_SUPPORT MTK_TEE_SUPPORT TRUSTKERNEL_TEE_SUPPORT MTK_FAN5405_SUPPORT.......
+export MTK_AB_OTA_UPDATER MTK_PLATFORM MTK_MT6336_SUPPORT MTK_TEE_SUPPORT TRUSTKERNEL_TEE_SUPPORT MTK_FAN5405_SUPPORT........

1.3. 升级测试

1.3.1. 升级相关文件介绍

固件编译成功后,在out/target/product/tb8788p1_64_bsp/目录中会有一个整包(full_tb8788p1_64_bsp-ota-122110.zip),在out/target/product/tb8788p1_64_bsp/obj/PACKAGING/target_files_intermediates/目录下有一个素材包(full_tb8788p1_64_bsp-target_files-122110.zip)

通过素材包也可以生成对应的整包

./build/tools/releasetools/ota_from_target_files out/...../target_files_intermediates/full_tb8788p1_64_bsp-target_files-122110.zip full-ota.zip

  • 不管是整包或者差分包,解压出来后的文件结构都是一样的
    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-HGLCFKrO-1607650089126)(_v_images/_1584067859_13188.png)]
  • payload.bin:系统要更新的数据文件
  • payload_properties.txt:包含了升级内容的一些属性信息(升级时会使用到payload_properties.txt里面的信息)
  • update_engine_client:A/B系统在debug模式下会包含升级应用update_engine_client,就是通过该程序来进行OTA的升级
1.3.2. 升级步骤
  • 整包升级
    a、解压整包
    b、将解压出来的payload.bin放到可被http访问到的地方
    c、查看复制解压出来的payload_properties.txt文件中的内容
    d、保持机器网络畅通
    e、adb shell进入机器,运行如下命令进行升级:
./update_engine_client --payload=http://q70ckeg5o.bkt.clouddn.com/payload.bin --update --headers="FILE_HASH=VjdsTa+l+zUN52gFo2jrX1TSVpR9raCdpdAW2HYjb4E=
FILE_SIZE=39103135
METADATA_HASH=c9OrO8Gr4Y4uF1JShFUcvo1not07ai3ZoFmiVjd4UiU=
METADATA_SIZE=197761
"

  • 差分包升级
    a、编译出两个素材包(V1.zip,V2.zip)
    b、生成差分包:./build/tools/releasetools/ota_from_target_files -i V1.zip V2.zip ota_test.zip
    c、将生成的差分包ota_test.zip解压出来
    d、将解压出来的payload.bin放到可被http访问到的地方
    e、查看复制解压出来的payload_properties.txt文件中的内容
    f、保持机器网络畅通
    g、adb shell进入机器,运行命令进行升级(命令与整包升级的命令相同)
1.3.3. 升级注意事项:

a–payload=http://q70ckeg5o.bkt.clouddn.com/payload.bin //后面的链接为你们放置的payload.bin的链接地址
b–header=" ",双引号的内容为解压对应的OTA包后的payload_properties.txt文件中的内容
c、因为–headers=参数最终是按行进行拆分提取的,所以四个参数要分别写到一行上,不然可能导致命令无法正常执行
d、运行命令后可执行logcat -s update_engine:v查看升级进度

1.4. 踩过的坑

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值