MTK android10修改Logo OTA AB分区

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

MTK android10修改Logo OTA AB分区

  • 前言
  • 一、把logo.bin改为logo.img
    • 2.修改分区以及刷机文件
  • 二、logo加载文件修改
    • 1.修改load_image.c,把加载logo分区的方式改一下,不然会找不到分区
  • 总结


前言


一、把logo.bin改为logo.img


diff --git a/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/Android.mk b/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/Android.mk
index 96d6997b1d..6314e05a9f 100644
--- a/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/Android.mk
+++ b/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/Android.mk
@@ -4,7 +4,7 @@ LK_ROOT_DIR := $(PWD)
 ifdef LK_PROJECT
     LK_DIR := $(LOCAL_PATH)
     INSTALLED_LK_TARGET := $(PRODUCT_OUT)/lk.img
-    INSTALLED_LOGO_TARGET := $(PRODUCT_OUT)/logo.bin
+    INSTALLED_LOGO_TARGET := $(PRODUCT_OUT)/logo.img
 
     SIGN_LK_TARGET := $(addsuffix -verified$(suffix $(INSTALLED_LK_TARGET)),$(basename $(INSTALLED_LK_TARGET)))
     SIGN_LOGO_TARGET := $(addsuffix -verified$(suffix $(INSTALLED_LOGO_TARGET)),$(basename $(INSTALLED_LOGO_TARGET)))
diff --git a/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/rules.mk b/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/rules.mk
index 1da0743a13..aa73675a09 100644
--- a/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/rules.mk
+++ b/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/dev/logo/rules.mk
@@ -46,7 +46,7 @@ else
 endif
 
 BOOT_LOGO_RESOURCE := $(BUILDDIR)/$(BOOT_LOGO_DIR)/$(BOOT_LOGO).raw
-LOGO_IMAGE := $(BUILDDIR)/logo.bin
+LOGO_IMAGE := $(BUILDDIR)/logo.img


diff --git a/alps/vendor/mediatek/proprietary/custom/mt8168/security/cert_config/img_list.txt b/alps/vendor/mediatek/proprietary/custom/mt8168/security/cert_config/img_list.txt
index ac3ea869d8..ccfc160754 100644
--- a/alps/vendor/mediatek/proprietary/custom/mt8168/security/cert_config/img_list.txt
+++ b/alps/vendor/mediatek/proprietary/custom/mt8168/security/cert_config/img_list.txt
@@ -1,5 +1,5 @@
 [single_bin]
-logo.bin=logo
+logo.img=logo
 boot.img=boot
 recovery.img=recovery
 md1arm7.img=md1arm7
diff --git a/alps/vendor/mediatek/proprietary/scripts/releasetools/mt_ota_preprocess.py b/alps/vendor/mediatek/proprietary/scripts/releasetools/mt_ota_preprocess.py
index ee822f9e23..6ed8d37323 100755
--- a/alps/vendor/mediatek/proprietary/scripts/releasetools/mt_ota_preprocess.py
+++ b/alps/vendor/mediatek/proprietary/scripts/releasetools/mt_ota_preprocess.py
@@ -34,7 +34,7 @@ upgrade_list_specific_sequence = {"preloader", "preloader2"}
 upgrade_list_mount_map = {"lk" : "bootloader", "lk2" : "bootloader2", "uboot" : "bootloader", "uboot2" : "bootloader2"}
 partition_map = {}
 add_to_target_list_exclude = ["vbmeta.img","dtbo.img","super.img","vbmeta_vendor.img","vbmeta_system.img"]
-extra_image_list = ["logo.bin", "preloader_SBOOT_DIS.img", "PGPT", "preloader_emmc.img", "preloader_ufs.img"]
+extra_image_list = ["logo.img", "preloader_SBOOT_DIS.img", "PGPT", "preloader_emmc.img", "preloader_ufs.img"]
 
 def addPartMap(part_map, part_name, file_name, storage_type):
   if not partition_map.has_key(file_name):
diff --git a/alps/vendor/mediatek/proprietary/scripts/sign-image/SignTool.pl b/alps/vendor/mediatek/proprietary/scripts/sign-image/SignTool.pl
index 228c7d4be4..c3b65b387b 100755
--- a/alps/vendor/mediatek/proprietary/scripts/sign-image/SignTool.pl
+++ b/alps/vendor/mediatek/proprietary/scripts/sign-image/SignTool.pl
@@ -83,7 +83,7 @@ my $command_2048 = "vendor/mediatek/proprietary/scripts/sign-image/SignTool_2048
 ##########################################################
 # File Check
 ##########################################################
-my @imgs_need_sign_raw = ("lk.img", "logo.bin", "secro.img", "odmdtbo.img", "dtbo.img");
+my @imgs_need_sign_raw = ("lk.img", "logo.img", "secro.img", "odmdtbo.img", "dtbo.img");
 my @imgs_need_sign = ("system.img", "system_other.img", "userdata.img", "efuse.img", "vendor.img", "odm.img", "vbmeta.img");
 
 if ($board_avb_enable ne "true") {

2.修改分区以及刷机文件

diff --git a/alps/device/mediatek/mt8168/sepolicy/basic/file_contexts b/alps/device/mediatek/mt8168/sepolicy/basic/file_contexts
index 79452f378e..4a3fc90070 100644
--- a/alps/device/mediatek/mt8168/sepolicy/basic/file_contexts
+++ b/alps/device/mediatek/mt8168/sepolicy/basic/file_contexts
@@ -11,7 +11,7 @@
 /dev/block/platform/soc/[0-9]+\.mmc/by-name/boot  u:object_r:boot_block_device:s0
 /dev/block/platform/soc/[0-9]+\.mmc/by-name/recovery  u:object_r:recovery_block_device:s0
 /dev/block/platform/soc/[0-9]+\.mmc/by-name/para u:object_r:para_block_device:s0
-/dev/block/platform/soc/[0-9]+\.mmc/by-name/logo  u:object_r:logo_block_device:s0
+/dev/block/platform/soc/[0-9]+\.mmc/by-name/logo(_[ab])?  u:object_r:logo_block_device:s0
 /dev/block/platform/soc/[0-9]+\.mmc/by-name/expdb u:object_r:expdb_block_device:s0
 /dev/block/platform/soc/[0-9]+\.mmc/by-name/frp u:object_r:frp_block_device:s0
 /dev/block/platform/soc/[0-9]+\.mmc/by-name/tee1 u:object_r:tee_block_device:s0
diff --git a/alps/device/mediateksample/aiot8365p3_64_bsp_1024/partition/partition_ab_dynamic.xml b/alps/device/mediateksample/aiot8365p3_64_bsp_1024/partition/partition_ab_dynamic.xml
index 47ae11e2f3..9cb977492e 100755
--- a/alps/device/mediateksample/aiot8365p3_64_bsp_1024/partition/partition_ab_dynamic.xml
+++ b/alps/device/mediateksample/aiot8365p3_64_bsp_1024/partition/partition_ab_dynamic.xml
@@ -25,7 +25,8 @@
        
        <!-- <entry type="{0FC63DAF-8483-4772-8E79-3D69D8477DE4}" size="65536" name="recovery"/> -->
        <entry type="{0FC63DAF-8483-4772-8E79-3D69D8477DE4}" size="1024" name="para"/>
-       <entry type="{0FC63DAF-8483-4772-8E79-3D69D8477DE4}" size="16384" name="logo"/>
+       <entry type="{0FC63DAF-8483-4772-8E79-3D69D8477DE4}" size="16384" name="logo_a"/>
+       <entry type="{0FC63DAF-8483-4772-8E79-3D69D8477DE4}" size="16384" name="logo_b"/>
        
        <entry type="{0FC63DAF-8483-4772-8E79-3D69D8477DE4}" size="16384" name="dtbo_a"/>
        <entry type="{0FC63DAF-8483-4772-8E79-3D69D8477DE4}" size="16384" name="dtbo_b"/>
diff --git a/alps/device/mediateksample/aiot8365p3_64_bsp_1024/partition/scatter.json b/alps/device/mediateksample/aiot8365p3_64_bsp_1024/partition/scatter.json
index cf04a1fcd6..78faeac4f9 100755
--- a/alps/device/mediateksample/aiot8365p3_64_bsp_1024/partition/scatter.json
+++ b/alps/device/mediateksample/aiot8365p3_64_bsp_1024/partition/scatter.json
@@ -203,6 +203,14 @@
     "logo": {
         "file_name": "logo.bin",
         "type": "NORMAL_ROM"
+    },
+       "logo_a": {
+        "file_name": "logo.img",
+        "type": "NORMAL_ROM"
+    },
+       "logo_b": {
+        "file_name": "logo.img",
+        "type": "NORMAL_ROM"
     },
     "DTBO": {
         "file_name": "dtbo.img",

二、logo加载文件修改

1.修改load_image.c,把加载logo分区的方式改一下,不然会找不到分区

diff --git a/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/mt8168/load_image.c b/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/mt8168/load_image.c
index 351189b2e7..5b4e389f56 100644
--- a/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/mt8168/load_image.c
+++ b/alps/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/mt8168/load_image.c

@@ -251,21 +251,27 @@ static int mboot_common_load_part_info(part_dev_t *dev, char *part_name,
                                       part_hdr_t *part_hdr)
 {
        long len;
-       part_t *part;
-
+       //part_t *part;
+       u64 part_size;
+dprintf(CRITICAL, "mt_part_get_device start get dev");
        dev = mt_part_get_device();
+       
        if (!dev)
                return -ENODEV;
-
-       part = mt_part_get_partition(part_name);
-       if (part == NULL)
-               return -1;
-
+dprintf(CRITICAL, "mt_part_get_device start get dev success");
+       //part = mt_part_get_partition(part_name);
+       //if (part == NULL)
+       //      return -1;
+       if(partition_exists(part_name) == PART_NOT_EXIST)
+               return -ENOENT;
+       part_size = partition_get_size_by_name(part_name);
+dprintf(CRITICAL, "mt_part_get_device start get dev success");
 
        //***************
        //* read partition header
        //*
        len = partition_read(part_name, 0, (uchar *)part_hdr, sizeof(part_hdr_t));
+       dprintf(CRITICAL, "mboot_common_load_part_info partition_read len== %d\n", len);
        if (len < 0) {
                dprintf(CRITICAL, "[%s] %s partition read error. LINE: %d\n", MODULE_NAME,
                        part_name, __LINE__);
@@ -301,7 +307,8 @@ static int mboot_common_load_part_info(part_dev_t *dev, char *part_name,
        //***************
        //* check partition data size
        //*
-       if (part_hdr->info.dsize > part->nr_sects * dev->blkdev->blksz) {
+       //if (part_hdr->info.dsize > part->nr_sects * dev->blkdev->blksz) {
+       if(part_hdr->info.dsize > part_size){
                dprintf(CRITICAL, "[%s] %s partition size error\n", MODULE_NAME, part_name);
                return -1;
        }
@@ -324,21 +331,24 @@ int mboot_common_load_part(char *part_name, unsigned long addr)
        part_t *part;
        part_dev_t *dev;
        part_hdr_t *part_hdr;
-
+dprintf(CRITICAL, "mt_part_get_device start get dev start");
        dev = mt_part_get_device();
        if (!dev)
                return -ENODEV;
-
-       part = mt_part_get_partition(part_name);
-       if (!part)
+dprintf(CRITICAL, "mt_part_get_device start get dev success");
+       //part = mt_part_get_partition(part_name);
+       dprintf(CRITICAL, "mt_part_get_partition end = %d",part);
+       //if (!part)
+       if(partition_exists(part_name) == PART_NOT_EXIST)       
                return -ENOENT;
-
+dprintf(CRITICAL, "mt_part_get_device start get part success");
        part_hdr = (part_hdr_t *)malloc(sizeof(part_hdr_t));
 
        if (!part_hdr)
                return -ENOMEM;
-

总结

一般来说,MTK是不支持OTA升级logo的,也就是第一幕和第二幕的logo是OTA不了的, 这样改了之后logo.img就会加入OTA升级包中,ota升级就会替换

你可能感兴趣的:(android,java)