Loading tools/releasetools/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ python_defaults { "add_img_to_target_files.py", ], libs: [ "ota_metadata_proto", "releasetools_apex_utils", "releasetools_build_image", "releasetools_build_super_image", "releasetools_common", Loading tools/releasetools/add_img_to_target_files.py +24 −4 Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ import common import rangelib import sparse_img import verity_utils import ota_metadata_pb2 from apex_utils import GetApexInfoFromTargetFiles if sys.hexversion < 0x02070000: print("Python 2.7 or newer is required.", file=sys.stderr) Loading Loading @@ -94,13 +97,13 @@ class OutputFile(object): name: The name of the output file, regardless of the final destination. """ def __init__(self, output_zip, input_dir, prefix, name): def __init__(self, output_zip, input_dir, *args): # We write the intermediate output file under the given input_dir, even if # the final destination is a zip archive. self.name = os.path.join(input_dir, prefix, name) self.name = os.path.join(input_dir, *args) self._output_zip = output_zip if self._output_zip: self._zip_name = os.path.join(prefix, name) self._zip_name = os.path.join(*args) def Write(self): if self._output_zip: Loading Loading @@ -179,7 +182,6 @@ def AddSystem(output_zip, recovery_img=None, boot_img=None): block_list = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "system.map") CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "system", img, block_list=block_list) return img.name Loading Loading @@ -754,6 +756,22 @@ def HasPartition(partition_name): os.path.join(OPTIONS.input_tmp, "IMAGES", "{}.img".format(partition_name)))) def AddApexInfo(output_zip): apex_infos = GetApexInfoFromTargetFiles(OPTIONS.input_tmp) apex_metadata_proto = ota_metadata_pb2.ApexMetadata() apex_metadata_proto.apex_info.extend(apex_infos) apex_info_bytes = apex_metadata_proto.SerializeToString() output_file = os.path.join(OPTIONS.input_tmp, "META", "apex_info.pb") with open(output_file, "wb") as ofile: ofile.write(apex_info_bytes) if output_zip: arc_name = "META/apex_info.pb" if arc_name in output_zip.namelist(): OPTIONS.replace_updated_files_list.append(arc_name) else: common.ZipWrite(output_zip, output_file, arc_name) def AddImagesToTargetFiles(filename): """Creates and adds images (boot/recovery/system/...) to a target_files.zip. Loading Loading @@ -914,6 +932,8 @@ def AddImagesToTargetFiles(filename): banner("system_other") AddSystemOther(output_zip) AddApexInfo(output_zip) if not OPTIONS.is_signing: banner("userdata") AddUserdata(output_zip) Loading tools/releasetools/ota_metadata.proto +8 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ // If you change this file, // Please update ota_metadata_pb2.py by executing // protoc ota_metadata.proto --python_out $ANDROID_BUILD_TOP/build/tools/releasetools // protoc ota_metadata.proto --python_out // $ANDROID_BUILD_TOP/build/tools/releasetools syntax = "proto3"; Loading Loading @@ -72,6 +72,12 @@ message ApexInfo { int64 decompressed_size = 4; } // Just a container to hold repeated apex_info, so that we can easily serialize // a list of apex_info to string. message ApexMetadata { repeated ApexInfo apex_info = 1; } // The metadata of an OTA package. It contains the information of the package // and prerequisite to install the update correctly. message OtaMetadata { Loading tools/releasetools/ota_metadata_pb2.py +153 −33 File changed.Preview size limit exceeded, changes collapsed. Show changes tools/releasetools/sign_target_files_apks.py +4 −0 Original line number Diff line number Diff line Loading @@ -626,6 +626,10 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, elif filename in ["META/care_map.pb", "META/care_map.txt"]: pass # Skip apex_info.pb because we sign/modify apexes elif filename == "META/apex_info.pb": pass # Updates system_other.avbpubkey in /product/etc/. elif filename in ( "PRODUCT/etc/security/avb/system_other.avbpubkey", Loading Loading
tools/releasetools/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ python_defaults { "add_img_to_target_files.py", ], libs: [ "ota_metadata_proto", "releasetools_apex_utils", "releasetools_build_image", "releasetools_build_super_image", "releasetools_common", Loading
tools/releasetools/add_img_to_target_files.py +24 −4 Original line number Diff line number Diff line Loading @@ -62,6 +62,9 @@ import common import rangelib import sparse_img import verity_utils import ota_metadata_pb2 from apex_utils import GetApexInfoFromTargetFiles if sys.hexversion < 0x02070000: print("Python 2.7 or newer is required.", file=sys.stderr) Loading Loading @@ -94,13 +97,13 @@ class OutputFile(object): name: The name of the output file, regardless of the final destination. """ def __init__(self, output_zip, input_dir, prefix, name): def __init__(self, output_zip, input_dir, *args): # We write the intermediate output file under the given input_dir, even if # the final destination is a zip archive. self.name = os.path.join(input_dir, prefix, name) self.name = os.path.join(input_dir, *args) self._output_zip = output_zip if self._output_zip: self._zip_name = os.path.join(prefix, name) self._zip_name = os.path.join(*args) def Write(self): if self._output_zip: Loading Loading @@ -179,7 +182,6 @@ def AddSystem(output_zip, recovery_img=None, boot_img=None): block_list = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "system.map") CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "system", img, block_list=block_list) return img.name Loading Loading @@ -754,6 +756,22 @@ def HasPartition(partition_name): os.path.join(OPTIONS.input_tmp, "IMAGES", "{}.img".format(partition_name)))) def AddApexInfo(output_zip): apex_infos = GetApexInfoFromTargetFiles(OPTIONS.input_tmp) apex_metadata_proto = ota_metadata_pb2.ApexMetadata() apex_metadata_proto.apex_info.extend(apex_infos) apex_info_bytes = apex_metadata_proto.SerializeToString() output_file = os.path.join(OPTIONS.input_tmp, "META", "apex_info.pb") with open(output_file, "wb") as ofile: ofile.write(apex_info_bytes) if output_zip: arc_name = "META/apex_info.pb" if arc_name in output_zip.namelist(): OPTIONS.replace_updated_files_list.append(arc_name) else: common.ZipWrite(output_zip, output_file, arc_name) def AddImagesToTargetFiles(filename): """Creates and adds images (boot/recovery/system/...) to a target_files.zip. Loading Loading @@ -914,6 +932,8 @@ def AddImagesToTargetFiles(filename): banner("system_other") AddSystemOther(output_zip) AddApexInfo(output_zip) if not OPTIONS.is_signing: banner("userdata") AddUserdata(output_zip) Loading
tools/releasetools/ota_metadata.proto +8 −2 Original line number Diff line number Diff line Loading @@ -16,8 +16,8 @@ // If you change this file, // Please update ota_metadata_pb2.py by executing // protoc ota_metadata.proto --python_out $ANDROID_BUILD_TOP/build/tools/releasetools // protoc ota_metadata.proto --python_out // $ANDROID_BUILD_TOP/build/tools/releasetools syntax = "proto3"; Loading Loading @@ -72,6 +72,12 @@ message ApexInfo { int64 decompressed_size = 4; } // Just a container to hold repeated apex_info, so that we can easily serialize // a list of apex_info to string. message ApexMetadata { repeated ApexInfo apex_info = 1; } // The metadata of an OTA package. It contains the information of the package // and prerequisite to install the update correctly. message OtaMetadata { Loading
tools/releasetools/ota_metadata_pb2.py +153 −33 File changed.Preview size limit exceeded, changes collapsed. Show changes
tools/releasetools/sign_target_files_apks.py +4 −0 Original line number Diff line number Diff line Loading @@ -626,6 +626,10 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, elif filename in ["META/care_map.pb", "META/care_map.txt"]: pass # Skip apex_info.pb because we sign/modify apexes elif filename == "META/apex_info.pb": pass # Updates system_other.avbpubkey in /product/etc/. elif filename in ( "PRODUCT/etc/security/avb/system_other.avbpubkey", Loading