author | Xindong Xu <xindong.xu@amlogic.com> | 2019-08-14 02:59:43 (GMT) |
---|---|---|
committer | Xindong Xu <xindong.xu@amlogic.com> | 2019-08-14 08:32:29 (GMT) |
commit | 7c981ba4698cf902fe9397db71fca5b941889459 (patch) | |
tree | b6a839302e37330bdce5bef85c456eb46193f04b | |
parent | 6cca583ee3f4181219e86c36dbcfde471d87b0be (diff) | |
download | common-7c981ba4698cf902fe9397db71fca5b941889459.zip common-7c981ba4698cf902fe9397db71fca5b941889459.tar.gz common-7c981ba4698cf902fe9397db71fca5b941889459.tar.bz2 |
OTA: add odm/product to Incremental ota zip [1/1]
PD#OTT-5728
bug:139259746
Problem:
Incremental ota get something error
Solution:
add odm/product to Incremental ota zip
delete some useless code
Verify:
atom
Change-Id: I0fa044ec0560db90a97f178278252fb06dbfce9c
-rw-r--r-- | factory.mk | 11 | ||||
-rwxr-xr-x | releasetools.py | 106 |
2 files changed, 45 insertions, 72 deletions
@@ -8,6 +8,9 @@ BUILT_IMAGES := boot.img bootloader.img dt.img else BUILT_IMAGES := boot.img recovery.img bootloader.img dt.img endif + +VB_CHECK_IMAGES := vendor.img system.img vbmeta.img boot.img product.img recovery.img + ifeq ($(PRODUCT_BUILD_SECURE_BOOT_IMAGE_DIRECTLY),true) BUILT_IMAGES := $(addsuffix .encrypt, $(BUILT_IMAGES)) endif#ifeq ($(PRODUCT_BUILD_SECURE_BOOT_IMAGE_DIRECTLY),true) @@ -338,6 +341,11 @@ ifeq ($(NO_AMLOGIC_FACTORY_ZIP),) cp -f $(PRODUCT_OUT)/$(file) $(PRODUCT_UPGRADE_OUT)/$(file); \ ) @echo $(INSTALLED_AML_UPGRADE_PACKAGE_TARGET) + $(hide) $(foreach file,$(VB_CHECK_IMAGES), \ + rm $(PRODUCT_UPGRADE_OUT)/$(file);\ + ln -sf $(shell readlink -f $(AML_TARGET)/IMAGES/$(file)) $(PRODUCT_UPGRADE_OUT)/$(file); \ + cp -f $(AML_TARGET)/IMAGES/$(file) $(PRODUCT_OUT)/$(file); \ + ) ifeq ($(PRODUCT_BUILD_SECURE_BOOT_IMAGE_DIRECTLY),true) $(hide) rm -f $(PRODUCT_UPGRADE_OUT)/bootloader.img.encrypt.* $(hide) $(ACP) $(PRODUCT_OUT)/bootloader.img.encrypt.* $(PRODUCT_UPGRADE_OUT)/ @@ -394,6 +402,9 @@ $(INSTALLED_AML_FASTBOOT_ZIP): $(addprefix $(PRODUCT_OUT)/,$(FASTBOOT_IMAGES)) $ echo "install $@" rm -rf $(PRODUCT_OUT)/fastboot mkdir -p $(PRODUCT_OUT)/fastboot + $(hide) $(foreach file,$(VB_CHECK_IMAGES), \ + cp -f $(AML_TARGET)/IMAGES/$(file) $(PRODUCT_OUT)/$(file); \ + ) cd $(PRODUCT_OUT); cp $(FASTBOOT_IMAGES) fastboot/; ifeq ($(TARGET_PRODUCT),ampere) echo "board=p212" > $(PRODUCT_OUT)/fastboot/android-info.txt diff --git a/releasetools.py b/releasetools.py index 7effda7..8e8e204 100755 --- a/releasetools.py +++ b/releasetools.py @@ -65,11 +65,6 @@ def HasTargetImage(target_files_zip, image_path): except KeyError: return False -def BuildExt4(name, input_dir, info_dict, block_list=None): - """Build the (sparse) vendor image and return the name of a temp - file containing it.""" - return add_img_to_target_files.CreateImage(input_dir, info_dict, name, block_list=block_list) - def ZipOtherImage(which, tmpdir, output): """Returns an image object from IMAGES. @@ -91,7 +86,7 @@ def GetImage(which, tmpdir): map must already exist in tmpdir. """ - assert which in ("system", "vendor", "odm", "product") + #assert which in ("system", "vendor", "odm", "product") path = os.path.join(tmpdir, "IMAGES", which + ".img") mappath = os.path.join(tmpdir, "IMAGES", which + ".map") @@ -108,72 +103,17 @@ def GetImage(which, tmpdir): return sparse_img.SparseImage(path, mappath, clobbered_blocks) -def mycopyfile(srcfile, dstfile): - if not os.path.isfile(srcfile): - print "%s not exist!" %(srcfile) - else: - fpath,fname=os.path.split(dstfile) - if not os.path.exists(fpath): - os.makedirs(fpath) - shutil.copyfile(srcfile,dstfile) - print "copy %s -> %s" %( srcfile,dstfile) - - -def HasOdmPartition(target_files_zip): - try: - target_files_zip.getinfo("ODM/") - return True - except KeyError: - return False - -def BuildCustomerImage(info): - print "amlogic extensions:BuildCustomerImage" - if info.info_dict.get("update_user_parts") == "true" : - partsList = info.info_dict.get("user_parts_list"); - for list_i in partsList.split(' '): - tmp_tgt = GetImage(list_i, info.input_tmp, info.info_dict) - tmp_tgt.ResetFileMap() - tmp_diff = common.BlockDifference(list_i, tmp_tgt, src = None) - tmp_diff.WriteScript(info.script,info.output_zip) - -def BuildCustomerIncrementalImage(info, *par, **dictarg): - print "amlogic extensions:BuildCustomerIncrementalImage" - fun = [] - for pp in par: - fun.append(pp) - if info.info_dict.get("update_user_parts") == "true" : - partsList = info.info_dict.get("user_parts_list"); - for list_i in partsList.split(' '): - if HasTargetImage(info.source_zip, list_i.upper() + "/"): - tmp_diff = fun[0](list_i, info.source_zip, info.target_zip, info.output_zip) - recovery_mount_options = common.OPTIONS.info_dict.get("recovery_mount_options") - info.script.Mount("/"+list_i, recovery_mount_options) - so_far = tmp_diff.EmitVerification(info.script) - size = [] - if tmp_diff.patch_list: - size.append(tmp_diff.largest_source_size) - tmp_diff.RemoveUnneededFiles(info.script) - total_patch_size = 1.0 + tmp_diff.TotalPatchSize() - total_patch_size += tmp_diff.TotalPatchSize() - tmp_diff.EmitPatches(info.script, total_patch_size, 0) - tmp_items = fun[1](list_i, "META/" + list_i + "_filesystem_config.txt") - - fun[2](tmp_items, info.target_zip, None) - temp_script = info.script.MakeTemporary() - tmp_items.GetMetadata(info.target_zip) - tmp_items.Get(list_i).SetPermissions(temp_script) - fun[2](tmp_items, info.source_zip, None) - if tmp_diff and tmp_diff.verbatim_targets: - info.script.Print("Unpacking new files...") - info.script.UnpackPackageDir(list_i, "/" + list_i) - - tmp_diff.EmitRenames(info.script) - if common.OPTIONS.verify and tmp_diff: - info.script.Print("Remounting and verifying partition files...") - info.script.Unmount("/" + list_i) - info.script.Mount("/" + list_i) - tmp_diff.EmitExplicitTargetVerification(info.script) - +def AddCustomerImage(info, tmpdir): + file_list = os.listdir(tmpdir + "/IMAGES") + for file in file_list: + if os.path.splitext(file)[1] == '.map': + of = file.rfind('.') + name = file[:of] + if name not in ["system", "vendor", "odm", "product"]: + tmp_tgt = GetImage(name, OPTIONS.input_tmp) + tmp_tgt.ResetFileMap() + tmp_diff = common.BlockDifference(name, tmp_tgt) + tmp_diff.WriteScript(info.script, info.output_zip) def FullOTA_Assertions(info): print "amlogic extensions:FullOTA_Assertions" @@ -312,9 +252,31 @@ def IncrementalOTA_ImageCheck(info, name): else: SetBootloaderEnv(info.script, "upgrade_step", "2") +def IncrementalOTA_Ext4ImageCheck(info, name): + source_image = False; target_image = False; updating_image = False; + + image_path = "IMAGES/" + name + ".img" + image_name = name + ".img" + + if HasTargetImage(info.source_zip, image_path): + source_image = GetImage(name, OPTIONS.source_tmp) + + if HasTargetImage(info.target_zip, image_path): + target_image = GetImage(name, OPTIONS.target_tmp) + + if source_image: + if target_image: + updating_image = common.BlockDifference(name, target_image, source_image, + True, + version=4, + disable_imgdiff=False) + updating_image.WriteScript(info.script, info.output_zip, progress=0.1) + def IncrementalOTA_InstallEnd(info): print "amlogic extensions:IncrementalOTA_InstallEnd" + IncrementalOTA_Ext4ImageCheck(info, "odm"); + IncrementalOTA_Ext4ImageCheck(info, "product"); IncrementalOTA_ImageCheck(info, "logo"); IncrementalOTA_ImageCheck(info, "dt"); IncrementalOTA_ImageCheck(info, "recovery"); |