Loading core/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -1454,6 +1454,7 @@ endif $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt $(hide) if test -e $(tool_extensions)/releasetools.py; then $(ACP) $(tool_extensions)/releasetools.py $(zip_root)/META/; fi $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt $(hide) $(ACP) $(SELINUX_FC) $(zip_root)/META/file_contexts $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt ifdef BOARD_FLASH_BLOCK_SIZE Loading tools/releasetools/add_img_to_target_files.py +3 −14 Original line number Diff line number Diff line Loading @@ -130,15 +130,9 @@ def CreateImage(input_dir, info_dict, what, block_list=None): if not os.path.exists(fs_config): fs_config = None fc_config = os.path.join(input_dir, "BOOT/RAMDISK/file_contexts") if not os.path.exists(fc_config): fc_config = None # Override values loaded from info_dict. if fs_config: image_props["fs_config"] = fs_config if fc_config: image_props["selinux_fc"] = fc_config if block_list: image_props["block_list"] = block_list if image_props.get("system_root_image") == "true": Loading Loading @@ -167,8 +161,7 @@ def AddUserdata(output_zip, prefix="IMAGES/"): print "userdata.img already exists in %s, no need to rebuild..." % (prefix,) return image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "data") image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "data") # We only allow yaffs to have a 0/missing partition_size. # Extfs, f2fs must have a size. Skip userdata.img if no size. if (not image_props.get("fs_type", "").startswith("yaffs") and Loading Loading @@ -214,8 +207,7 @@ def AddCache(output_zip, prefix="IMAGES/"): print "cache.img already exists in %s, no need to rebuild..." % (prefix,) return image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "cache") image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "cache") # The build system has to explicitly request for cache.img. if "fs_type" not in image_props: return Loading Loading @@ -258,10 +250,7 @@ def AddImagesToTargetFiles(filename): except KeyError: has_vendor = False OPTIONS.info_dict = common.LoadInfoDict(input_zip) if "selinux_fc" in OPTIONS.info_dict: OPTIONS.info_dict["selinux_fc"] = os.path.join( OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts") OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.input_tmp) common.ZipClose(input_zip) output_zip = zipfile.ZipFile(filename, "a", Loading tools/releasetools/common.py +18 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ def CloseInheritedPipes(): pass def LoadInfoDict(input_file): def LoadInfoDict(input_file, input_dir=None): """Read and parse the META/misc_info.txt key/value pairs from the input target files and return a dict.""" Loading Loading @@ -145,6 +145,23 @@ def LoadInfoDict(input_file): if "fstab_version" not in d: d["fstab_version"] = "1" # During building, we use the "file_contexts" in the out/ directory tree. # It is no longer available when (re)generating from target_files zip. So # when generating from target_files zip, we look for a copy under META/ # first, if not available search under BOOT/RAMDISK/. Note that we may need # a different file_contexts to build images than the one running on device, # such as when enabling system_root_image. In that case, we must have the # one for building copied to META/. if input_dir is not None: fc_config = os.path.join(input_dir, "META", "file_contexts") if not os.path.exists(fc_config): fc_config = os.path.join(input_dir, "BOOT", "RAMDISK", "file_contexts") if not os.path.exists(fc_config): fc_config = None if fc_config: d["selinux_fc"] = fc_config try: data = read_helper("META/imagesizes.txt") for line in data.split("\n"): Loading tools/releasetools/img_from_target_files.py +1 −10 Original line number Diff line number Diff line Loading @@ -95,16 +95,7 @@ def main(argv): # images, so build them. import add_img_to_target_files OPTIONS.info_dict = common.LoadInfoDict(input_zip) # If this image was originally labelled with SELinux contexts, # make sure we also apply the labels in our new image. During # building, the "file_contexts" is in the out/ directory tree, # but for repacking from target-files.zip it's in the root # directory of the ramdisk. if "selinux_fc" in OPTIONS.info_dict: OPTIONS.info_dict["selinux_fc"] = os.path.join( OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts") OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.input_tmp) boot_image = common.GetBootableImage( "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT") Loading tools/releasetools/ota_from_target_files.py +5 −13 Original line number Diff line number Diff line Loading @@ -582,6 +582,8 @@ else if get_stage("%(bcb_dev)s") == "3/3" then if HasVendorPartition(input_zip): system_progress -= 0.1 # Place a copy of file_contexts into the OTA package which will be used by # the recovery program. if "selinux_fc" in OPTIONS.info_dict: WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip) Loading Loading @@ -1538,15 +1540,7 @@ def main(argv): OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0]) OPTIONS.target_tmp = OPTIONS.input_tmp OPTIONS.info_dict = common.LoadInfoDict(input_zip) # If this image was originally labelled with SELinux contexts, make sure we # also apply the labels in our new image. During building, the "file_contexts" # is in the out/ directory tree, but for repacking from target-files.zip it's # in the root directory of the ramdisk. if "selinux_fc" in OPTIONS.info_dict: OPTIONS.info_dict["selinux_fc"] = os.path.join( OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts") OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.target_tmp) if OPTIONS.verbose: print "--- target info ---" Loading Loading @@ -1596,10 +1590,8 @@ def main(argv): OPTIONS.source_tmp, source_zip = common.UnzipTemp( OPTIONS.incremental_source) OPTIONS.target_info_dict = OPTIONS.info_dict OPTIONS.source_info_dict = common.LoadInfoDict(source_zip) if "selinux_fc" in OPTIONS.source_info_dict: OPTIONS.source_info_dict["selinux_fc"] = os.path.join( OPTIONS.source_tmp, "BOOT", "RAMDISK", "file_contexts") OPTIONS.source_info_dict = common.LoadInfoDict(source_zip, OPTIONS.source_tmp) if OPTIONS.package_key is None: OPTIONS.package_key = OPTIONS.source_info_dict.get( "default_system_dev_certificate", Loading Loading
core/Makefile +1 −0 Original line number Diff line number Diff line Loading @@ -1454,6 +1454,7 @@ endif $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt $(hide) if test -e $(tool_extensions)/releasetools.py; then $(ACP) $(tool_extensions)/releasetools.py $(zip_root)/META/; fi $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt $(hide) $(ACP) $(SELINUX_FC) $(zip_root)/META/file_contexts $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt ifdef BOARD_FLASH_BLOCK_SIZE Loading
tools/releasetools/add_img_to_target_files.py +3 −14 Original line number Diff line number Diff line Loading @@ -130,15 +130,9 @@ def CreateImage(input_dir, info_dict, what, block_list=None): if not os.path.exists(fs_config): fs_config = None fc_config = os.path.join(input_dir, "BOOT/RAMDISK/file_contexts") if not os.path.exists(fc_config): fc_config = None # Override values loaded from info_dict. if fs_config: image_props["fs_config"] = fs_config if fc_config: image_props["selinux_fc"] = fc_config if block_list: image_props["block_list"] = block_list if image_props.get("system_root_image") == "true": Loading Loading @@ -167,8 +161,7 @@ def AddUserdata(output_zip, prefix="IMAGES/"): print "userdata.img already exists in %s, no need to rebuild..." % (prefix,) return image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "data") image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "data") # We only allow yaffs to have a 0/missing partition_size. # Extfs, f2fs must have a size. Skip userdata.img if no size. if (not image_props.get("fs_type", "").startswith("yaffs") and Loading Loading @@ -214,8 +207,7 @@ def AddCache(output_zip, prefix="IMAGES/"): print "cache.img already exists in %s, no need to rebuild..." % (prefix,) return image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "cache") image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, "cache") # The build system has to explicitly request for cache.img. if "fs_type" not in image_props: return Loading Loading @@ -258,10 +250,7 @@ def AddImagesToTargetFiles(filename): except KeyError: has_vendor = False OPTIONS.info_dict = common.LoadInfoDict(input_zip) if "selinux_fc" in OPTIONS.info_dict: OPTIONS.info_dict["selinux_fc"] = os.path.join( OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts") OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.input_tmp) common.ZipClose(input_zip) output_zip = zipfile.ZipFile(filename, "a", Loading
tools/releasetools/common.py +18 −1 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ def CloseInheritedPipes(): pass def LoadInfoDict(input_file): def LoadInfoDict(input_file, input_dir=None): """Read and parse the META/misc_info.txt key/value pairs from the input target files and return a dict.""" Loading Loading @@ -145,6 +145,23 @@ def LoadInfoDict(input_file): if "fstab_version" not in d: d["fstab_version"] = "1" # During building, we use the "file_contexts" in the out/ directory tree. # It is no longer available when (re)generating from target_files zip. So # when generating from target_files zip, we look for a copy under META/ # first, if not available search under BOOT/RAMDISK/. Note that we may need # a different file_contexts to build images than the one running on device, # such as when enabling system_root_image. In that case, we must have the # one for building copied to META/. if input_dir is not None: fc_config = os.path.join(input_dir, "META", "file_contexts") if not os.path.exists(fc_config): fc_config = os.path.join(input_dir, "BOOT", "RAMDISK", "file_contexts") if not os.path.exists(fc_config): fc_config = None if fc_config: d["selinux_fc"] = fc_config try: data = read_helper("META/imagesizes.txt") for line in data.split("\n"): Loading
tools/releasetools/img_from_target_files.py +1 −10 Original line number Diff line number Diff line Loading @@ -95,16 +95,7 @@ def main(argv): # images, so build them. import add_img_to_target_files OPTIONS.info_dict = common.LoadInfoDict(input_zip) # If this image was originally labelled with SELinux contexts, # make sure we also apply the labels in our new image. During # building, the "file_contexts" is in the out/ directory tree, # but for repacking from target-files.zip it's in the root # directory of the ramdisk. if "selinux_fc" in OPTIONS.info_dict: OPTIONS.info_dict["selinux_fc"] = os.path.join( OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts") OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.input_tmp) boot_image = common.GetBootableImage( "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT") Loading
tools/releasetools/ota_from_target_files.py +5 −13 Original line number Diff line number Diff line Loading @@ -582,6 +582,8 @@ else if get_stage("%(bcb_dev)s") == "3/3" then if HasVendorPartition(input_zip): system_progress -= 0.1 # Place a copy of file_contexts into the OTA package which will be used by # the recovery program. if "selinux_fc" in OPTIONS.info_dict: WritePolicyConfig(OPTIONS.info_dict["selinux_fc"], output_zip) Loading Loading @@ -1538,15 +1540,7 @@ def main(argv): OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0]) OPTIONS.target_tmp = OPTIONS.input_tmp OPTIONS.info_dict = common.LoadInfoDict(input_zip) # If this image was originally labelled with SELinux contexts, make sure we # also apply the labels in our new image. During building, the "file_contexts" # is in the out/ directory tree, but for repacking from target-files.zip it's # in the root directory of the ramdisk. if "selinux_fc" in OPTIONS.info_dict: OPTIONS.info_dict["selinux_fc"] = os.path.join( OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts") OPTIONS.info_dict = common.LoadInfoDict(input_zip, OPTIONS.target_tmp) if OPTIONS.verbose: print "--- target info ---" Loading Loading @@ -1596,10 +1590,8 @@ def main(argv): OPTIONS.source_tmp, source_zip = common.UnzipTemp( OPTIONS.incremental_source) OPTIONS.target_info_dict = OPTIONS.info_dict OPTIONS.source_info_dict = common.LoadInfoDict(source_zip) if "selinux_fc" in OPTIONS.source_info_dict: OPTIONS.source_info_dict["selinux_fc"] = os.path.join( OPTIONS.source_tmp, "BOOT", "RAMDISK", "file_contexts") OPTIONS.source_info_dict = common.LoadInfoDict(source_zip, OPTIONS.source_tmp) if OPTIONS.package_key is None: OPTIONS.package_key = OPTIONS.source_info_dict.get( "default_system_dev_certificate", Loading