Signed-off-by: lizhao <lizhao104@huawei.com>
This commit is contained in:
lizhao 2023-05-13 07:09:17 +00:00
parent b93e2c402b
commit a907f03a7d
4 changed files with 30 additions and 15 deletions

View File

@ -617,7 +617,7 @@ def increment_image_processing(
"src image path: %s, tgt image path: %s" %
(each_src_image_path, each_tgt_image_path),
UPDATE_LOGGER.INFO_LOG)
OPTIONS_MANAGER.incremental_img_name_list.remove(each_img)
OPTIONS_MANAGER.incremental_img_list.remove(each_img)
first_block_check_cmd = verse_script.first_block_check(each_img)
abort_cmd = verse_script.abort(each_img)
cmd = 'if ({first_block_check_cmd} != 0)' '{{\n {abort_cmd}}}\n'.format(

View File

@ -200,6 +200,7 @@ class PatchProcess:
transfer_content = self.get_transfer_content(
max_stashed_blocks, total_blocks_count, transfer_content)
transfer_list_file_obj.write(transfer_content.encode())
OPTIONS_MANAGER.max_stash_size += max_stashed_blocks * 4096
@staticmethod
def get_transfer_content(max_stashed_blocks, total_blocks_count,

View File

@ -377,6 +377,32 @@ def create_build_tools_zip():
return file_obj
def do_zip_update_package():
zip_file = zipfile.ZipFile(OPTIONS_MANAGER.update_package_file_path,
'w', zipfile.ZIP_DEFLATED, allowZip64=True)
# add update.bin to update package
zip_file.write(OPTIONS_MANAGER.update_bin_obj.name, "update.bin")
# add build_tools.zip to update package
zip_file.write(OPTIONS_MANAGER.build_tools_zip_obj.name, BUILD_TOOLS_FILE_NAME)
zip_file.write(OPTIONS_MANAGER.version_mbn_file_path, "version_list")
zip_file.write(OPTIONS_MANAGER.board_list_file_path, "board_list")
if OPTIONS_MANAGER.max_stash_size != 0:
max_stash_file_obj = tempfile.NamedTemporaryFile(mode="w+")
max_stash_file_obj.write(str(OPTIONS_MANAGER.max_stash_size))
max_stash_file_obj.flush()
zip_file.write(max_stash_file_obj.name, "all_max_stash")
for package_patch_zip in OPTIONS_MANAGER.incremental_block_file_obj_dict.values():
package_patch_zip.package_block_patch(zip_file)
for partition, patch_obj in OPTIONS_MANAGER.incremental_image_file_obj_dict.items():
zip_file.write(patch_obj.name, "%s.patch.dat" % partition)
zip_file.close()
def create_hsd_for_build_tools(zip_file, files_to_sign):
"""
generate hash signed data for build_tools.zip
@ -444,20 +470,7 @@ def build_update_package(no_zip, update_package, prelude_script,
return False
OPTIONS_MANAGER.build_tools_zip_obj = build_tools_zip_obj
zip_file = zipfile.ZipFile(update_package_path, 'w', zipfile.ZIP_DEFLATED, allowZip64=True)
# add update.bin to update package
zip_file.write(OPTIONS_MANAGER.update_bin_obj.name, "update.bin")
# add build_tools.zip to update package
zip_file.write(OPTIONS_MANAGER.build_tools_zip_obj.name, BUILD_TOOLS_FILE_NAME)
zip_file.write(OPTIONS_MANAGER.version_mbn_file_path, "version_list")
zip_file.write(OPTIONS_MANAGER.board_list_file_path, "board_list")
for package_patch_zip in OPTIONS_MANAGER.incremental_block_file_obj_dict.values():
package_patch_zip.package_block_patch(zip_file)
for partition, patch_obj in OPTIONS_MANAGER.incremental_image_file_obj_dict.items():
zip_file.write(patch_obj.name, "%s.patch.dat" % partition)
zip_file.close()
do_zip_update_package()
signed_package = os.path.join(
update_package, "%s.zip" % update_file_name)

View File

@ -182,6 +182,7 @@ class OptionsManager:
self.incremental_image_file_obj_dict = {}
self.incremental_block_file_obj_dict = {}
self.incremental_temp_file_obj_list = []
self.max_stash_size = 0
self.src_image = None
self.tgt_image = None