MT6762 Android 8.1 打开custom分区,挂载custom分区,OTA升级custom分区
MT6762 Android 8.1 打開custom分區(qū),掛載custom分區(qū),OTA升級custom分區(qū)
- 1.打開custom分區(qū)
- 2.掛載custom分區(qū)
- 3.OTA升級custom分區(qū)
1.打開custom分區(qū)
MTK的 Android 8.1 代碼實際是支持custom分區(qū)的,只是默認是關(guān)閉的,修改 ProjectConfig.mk 的 “MTK_CIP_SUPPORT = yes” 可以打開custom分區(qū)。
打開選項之后,重新編譯系統(tǒng),會看到生成“custom.img”文件,并且out目錄下會生成“custom”目錄,如下圖:
如果需要修改custom分區(qū)的大小,修改文件:
device/mediatek/build/build/tools/ptgen/MT6765/partition_table_MT6765.xls
如圖:
具體修改哪一個表格里面的custom,根據(jù)系統(tǒng)配置而定!
2.掛載custom分區(qū)
如果需要掛載custom分區(qū),修改文件:
vendor/mediatek/proprietary/hardware/fstab/mt6765/fstab.in
在適當(dāng)?shù)奈恢?#xff0c;增加:
DEVPATH(custom) /custom ext4 FS_FLAG_DISCARD FSMGR_FLAG_CHK
如果需要修改/custom掛載點的目錄權(quán)限,可以在init.rc的適當(dāng)位置增加類似:
chown system system /custom
chmod 0775 /custom
3.OTA升級custom分區(qū)
OTA升級是沒有包含custom分區(qū)的,需要修改對應(yīng)腳本文件!
首先在 BoardConfig.mk 文件增加如下一行變量賦值,后面Makefile文件需要用到:
BOARD_CUSTOMIMAGE_FILE_SYSTEM_TYPE := ext4
然后修改源碼 build 目錄下,下列4個文件,這些修改,主要參考的是“cache”和“vendor”分區(qū)相應(yīng)功能的腳本,具體實現(xiàn),可以自己分析相關(guān)編譯腳本:
diff --git a/make/core/Makefile b/make/core/Makefile index bcb6338..81d5822 100755 --- a/make/core/Makefile +++ b/make/core/Makefile @@ -1015,6 +1015,8 @@ $(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))$(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))$(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1)) +$(if $(BOARD_CUSTOMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "custom_fs_type=$(BOARD_CUSTOMIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) +$(if $(BOARD_CUSTOMIMAGE_PARTITION_SIZE),$(hide) echo "custom_size=$(BOARD_CUSTOMIMAGE_PARTITION_SIZE)" >> $(1))$(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))$(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))$(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1)) @@ -2343,6 +2345,8 @@ ifeq ($(AB_OTA_UPDATER),true)endifendif+BUILT_OUT_CUSTOM := $(PRODUCT_OUT)/custom +# Run fs_config while creating the target files package# $1: root directory# $2: add prefix @@ -2356,6 +2360,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \$(INSTALLED_BOOTIMAGE_TARGET) \$(INSTALLED_RADIOIMAGE_TARGET) \$(INSTALLED_RECOVERYIMAGE_TARGET) \ + $(INSTALLED_CUSTOMIMAGE_TARGET) \$(FULL_SYSTEMIMAGE_DEPS) \$(INSTALLED_USERDATAIMAGE_TARGET) \$(INSTALLED_CACHEIMAGE_TARGET) \ @@ -2438,6 +2443,9 @@ endif # BOARD_USES_RECOVERY_AS_BOOT@# Contents of the system image$(hide) $(call package_files-copy-root, \$(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM) + @# Contents of the custom image + $(hide) $(call package_files-copy-root, \ + $(BUILT_OUT_CUSTOM),$(zip_root)/CUSTOM)@# Contents of the data image$(hide) $(call package_files-copy-root, \$(TARGET_OUT_DATA),$(zip_root)/DATA) @@ -2630,6 +2638,7 @@ endif # BOARD_PREBUILT_DTBOIMAGEifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE$(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txtendif + $(hide) $(call fs_config,$(zip_root)/CUSTOM,custom/) > $(zip_root)/META/costom_filesystem_config.txtifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)$(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txtendif diff --git a/make/tools/releasetools/add_img_to_target_files.py b/make/tools/releasetools/add_img_to_target_files.py index 56d990b..8d5f24d 100755 --- a/make/tools/releasetools/add_img_to_target_files.py +++ b/make/tools/releasetools/add_img_to_target_files.py @@ -174,6 +174,19 @@ def AddVendor(output_zip, prefix="IMAGES/"):block_list=block_list)return img.name+def AddCustom(output_zip, prefix="IMAGES/"): + """Turn the contents of CUSTOM into a custom image and store in it + output_zip.""" + + img = OutputFile(output_zip, OPTIONS.input_tmp, prefix, "custom.img") + if os.path.exists(img.input_name): + print("custom.img already exists in %s, no need to rebuild..." % (prefix,)) + return img.input_name + + block_list = OutputFile(output_zip, OPTIONS.input_tmp, prefix, "custom.map") + CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "custom", img, + block_list=block_list) + return img.namedef AddDtbo(output_zip, prefix="IMAGES/"):"""Adds the DTBO image. @@ -550,6 +563,9 @@ def AddImagesToTargetFiles(filename):has_vendor = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "VENDOR")) oros.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES","vendor.img"))) + has_custom = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "CUSTOM")) or + os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES", + "custom.img")))has_system_other = os.path.isdir(os.path.join(OPTIONS.input_tmp,"SYSTEM_OTHER"))@@ -637,6 +653,11 @@ def AddImagesToTargetFiles(filename):banner("vendor")partitions['vendor'] = vendor_img_path = AddVendor(output_zip)+ custom_img_path = None + if has_custom: + banner("custom") + partitions['custom'] = custom_img_path = AddCustom(output_zip) +if has_system_other:banner("system_other")AddSystemOther(output_zip) diff --git a/make/tools/releasetools/build_image.py b/make/tools/releasetools/build_image.py index ccfa35f..e17a99d 100755 --- a/make/tools/releasetools/build_image.py +++ b/make/tools/releasetools/build_image.py @@ -703,6 +703,9 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):elif mount_point == "cache":copy_prop("cache_fs_type", "fs_type")copy_prop("cache_size", "partition_size") + elif mount_point == "custom": + copy_prop("custom_fs_type", "fs_type") + copy_prop("custom_size", "partition_size")elif mount_point == "vendor":copy_prop("avb_vendor_hashtree_enable", "avb_hashtree_enable")copy_prop("avb_vendor_add_hashtree_footer_args", @@ -770,6 +773,8 @@ def main(argv):mount_point = "data"elif image_filename == "cache.img":mount_point = "cache" + elif image_filename == "custom.img": + mount_point = "custom"elif image_filename == "vendor.img":mount_point = "vendor"elif image_filename == "oem.img": diff --git a/make/tools/releasetools/ota_from_target_files.py b/make/tools/releasetools/ota_from_target_files.py index 57c4735..81b7603 100755 --- a/make/tools/releasetools/ota_from_target_files.py +++ b/make/tools/releasetools/ota_from_target_files.py @@ -274,6 +274,12 @@ def HasVendorPartition(target_files_zip):except KeyError:return False+def HasCustomPartition(target_files_zip): + try: + target_files_zip.getinfo("CUSTOM/") + return True + except KeyError: + return Falsedef GetOemProperty(name, oem_props, oem_dict, info_dict):if oem_props is not None and name in oem_props: @@ -298,7 +304,7 @@ def GetImage(which, tmpdir):map must already exist in tmpdir."""- assert which in ("system", "vendor") + assert which in ("system", "vendor", "custom")path = os.path.join(tmpdir, "IMAGES", which + ".img")mappath = os.path.join(tmpdir, "IMAGES", which + ".map") @@ -499,6 +505,13 @@ else if get_stage("%(bcb_dev)s") == "3/3" thenvendor_diff = common.BlockDifference("vendor", vendor_tgt)vendor_diff.WriteScript(script, output_zip)+ if HasCustomPartition(input_zip): + + custom_tgt = GetImage("custom", OPTIONS.input_tmp) + custom_tgt.ResetFileMap() + custom_diff = common.BlockDifference("custom", custom_tgt) + custom_diff.WriteScript(script, output_zip) +common.CheckSize(boot_img.data, "boot.img", OPTIONS.info_dict)common.ZipWriteStr(output_zip, "boot.img", boot_img.data)總結(jié)
以上是生活随笔為你收集整理的MT6762 Android 8.1 打开custom分区,挂载custom分区,OTA升级custom分区的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php curl curlopt_cus
- 下一篇: custom的短语_custom的用法总