summaryrefslogtreecommitdiff
authorXindong Xu <xindong.xu@amlogic.com>2019-08-14 05:25:31 (GMT)
committer Xindong Xu <xindong.xu@amlogic.com>2019-08-15 03:11:40 (GMT)
commit928982e5ea45d22ae915616b2f3517ee819d1a03 (patch)
treec25555bd215b9a868f76a9c03cb9a8d26415512c
parent51fd790d7ffd0f32aa0b04c49bf32daa451142f3 (diff)
downloadcommon-928982e5ea45d22ae915616b2f3517ee819d1a03.zip
common-928982e5ea45d22ae915616b2f3517ee819d1a03.tar.gz
common-928982e5ea45d22ae915616b2f3517ee819d1a03.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: locally Change-Id: I722618808bffd38ffd226eb493327afa26b0549b
Diffstat
-rw-r--r--factory.mk14
-rwxr-xr-xreleasetools.py106
2 files changed, 46 insertions, 74 deletions
diff --git a/factory.mk b/factory.mk
index b733478..3032b86 100644
--- a/factory.mk
+++ b/factory.mk
@@ -61,7 +61,12 @@ else
FILE_NAME := $(file <$(BUILD_NUMBER_FILE))
endif
-AML_TARGET := $(PRODUCT_OUT)/obj/PACKAGING/target_files_intermediates/$(TARGET_PRODUCT)-target_files-$(FILE_NAME)
+name_aml := $(TARGET_PRODUCT)
+ifeq ($(TARGET_BUILD_TYPE),debug)
+ name_aml := $(name_aml)_debug
+endif
+
+AML_TARGET := $(PRODUCT_OUT)/obj/PACKAGING/target_files_intermediates/$(name_aml)-target_files-$(FILE_NAME)
# -----------------------------------------------------------------
# odm partition image
@@ -490,6 +495,7 @@ $(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.*
@@ -557,10 +563,14 @@ endif
aml_fastboot_zip:$(INSTALLED_AML_FASTBOOT_ZIP)
$(INSTALLED_AML_FASTBOOT_ZIP): $(addprefix $(PRODUCT_OUT)/,$(FASTBOOT_IMAGES)) \
$(INSTALLED_AML_LOGO) \
- $(BUILT_ODMIMAGE_TARGET)
+ $(BUILT_ODMIMAGE_TARGET) \
+ $(TARGET_USB_BURNING_V2_DEPEND_MODULES)
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 5542597..ded42ab 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"
@@ -316,9 +256,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");