Loading core/Makefile +17 −1 Original line number Diff line number Diff line Loading @@ -784,8 +784,15 @@ recovery_fstab := $(TARGET_RECOVERY_FSTAB) else recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab)) endif ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) # Named '.dat' so we don't attempt to use imgdiff for patching it. RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat else # We carry a full copy of the recovery image. recovery-resource.dat is no # longer needed. RECOVERY_RESOURCE_ZIP := endif ifeq ($(recovery_resources_private),) $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE)) Loading Loading @@ -877,16 +884,18 @@ $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ $(RECOVERY_INSTALL_OTA_KEYS) $(call build-recoveryimage-target, $@) ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) $(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) $(hide) mkdir -p $(dir $@) $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrj $@ -@ endif .PHONY: recoveryimage-nodeps recoveryimage-nodeps: @echo "make $@: ignoring dependencies" $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET)) else else # ! ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) INSTALLED_RECOVERYIMAGE_TARGET := RECOVERY_RESOURCE_ZIP := endif Loading Loading @@ -994,6 +1003,7 @@ SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) # we can see how big it's going to be, and include that in the system # image size check calculation. ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch) RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p $(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \ Loading @@ -1003,6 +1013,9 @@ $(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \ @echo "Construct recovery from boot" mkdir -p $(dir $@) PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@ else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET) endif endif Loading Loading @@ -1495,6 +1508,9 @@ endif ifeq ($(SANITIZE_TARGET),address) # We need to create userdata.img with real data because the instrumented libraries are in userdata.img. $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt endif ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt endif $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt) $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \ Loading tools/releasetools/common.py +29 −11 Original line number Diff line number Diff line Loading @@ -1395,6 +1395,12 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, if info_dict is None: info_dict = OPTIONS.info_dict full_recovery_image = info_dict.get("full_recovery_image", None) == "true" if full_recovery_image: output_sink("etc/recovery.img", recovery_img.data) else: diff_program = ["imgdiff"] path = os.path.join(input_dir, "SYSTEM", "etc", "recovery-resource.dat") if os.path.exists(path): Loading @@ -1414,6 +1420,18 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, except KeyError: return if full_recovery_image: sh = """#!/system/bin/sh if ! applypatch -c %(type)s:%(device)s:%(size)d:%(sha1)s; then applypatch /system/etc/recovery.img %(type)s:%(device)s %(sha1)s %(size)d && log -t recovery "Installing new recovery image: succeeded" || log -t recovery "Installing new recovery image: failed" else log -t recovery "Recovery image already installed" fi """ % {'type': recovery_type, 'device': recovery_device, 'sha1': recovery_img.sha1, 'size': recovery_img.size} else: sh = """#!/system/bin/sh if ! applypatch -c %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then applypatch %(bonus_args)s %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s %(recovery_type)s:%(recovery_device)s %(recovery_sha1)s %(recovery_size)d %(boot_sha1)s:/system/recovery-from-boot.p && log -t recovery "Installing new recovery image: succeeded" || log -t recovery "Installing new recovery image: failed" Loading tools/releasetools/ota_from_target_files.py +6 −6 Original line number Diff line number Diff line Loading @@ -218,7 +218,8 @@ class ItemSet(object): if i.is_dir: i.children.sort(key=lambda i: i.name) # set metadata for the files generated by this script. # Set metadata for the files generated by this script. For full recovery # image at system/etc/recovery.img, it will be taken care by fs_config. i = self.ITEMS.get("system/recovery-from-boot.p", None) if i: i.uid, i.gid, i.mode, i.selabel, i.capabilities = 0, 0, 0o644, None, None Loading Loading @@ -422,11 +423,9 @@ def AppendAssertions(script, info_dict, oem_dict=None): def HasRecoveryPatch(target_files_zip): try: target_files_zip.getinfo("SYSTEM/recovery-from-boot.p") return True except KeyError: return False namelist = [name for name in target_files_zip.namelist()] return ("SYSTEM/recovery-from-boot.p" in namelist or "SYSTEM/etc/recovery.img" in namelist) def HasVendorPartition(target_files_zip): try: Loading Loading @@ -1360,6 +1359,7 @@ else common.MakeRecoveryPatch(OPTIONS.target_tmp, output_sink, target_recovery, target_boot) script.DeleteFiles(["/system/recovery-from-boot.p", "/system/etc/recovery.img", "/system/etc/install-recovery.sh"]) print "recovery image changed; including as patch from boot." else: Loading tools/releasetools/sign_target_files_apks.py +4 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, data = input_tf_zip.read(info.filename) out_info = copy.copy(info) # Replace keys if requested. if (info.filename == "META/misc_info.txt" and OPTIONS.replace_verity_private_key): ReplaceVerityPrivateKey(input_tf_zip, output_tf_zip, misc_info, Loading @@ -184,12 +185,14 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, new_data = ReplaceVerityPublicKey(output_tf_zip, OPTIONS.replace_verity_public_key[1]) write_to_temp(info.filename, info.external_attr, new_data) # Copy BOOT/, RECOVERY/, META/, ROOT/ to rebuild recovery patch. elif (info.filename.startswith("BOOT/") or info.filename.startswith("RECOVERY/") or info.filename.startswith("META/") or info.filename == "SYSTEM/etc/recovery-resource.dat"): write_to_temp(info.filename, info.external_attr, data) # Sign APKs. if info.filename.endswith(".apk"): name = os.path.basename(info.filename) key = apk_key_map[name] Loading @@ -214,6 +217,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, new_data = ReplaceCerts(data) common.ZipWriteStr(output_tf_zip, out_info, new_data) elif info.filename in ("SYSTEM/recovery-from-boot.p", "SYSTEM/etc/recovery.img", "SYSTEM/bin/install-recovery.sh"): rebuild_recovery = True elif (OPTIONS.replace_ota_keys and Loading Loading
core/Makefile +17 −1 Original line number Diff line number Diff line Loading @@ -784,8 +784,15 @@ recovery_fstab := $(TARGET_RECOVERY_FSTAB) else recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab)) endif ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) # Named '.dat' so we don't attempt to use imgdiff for patching it. RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat else # We carry a full copy of the recovery image. recovery-resource.dat is no # longer needed. RECOVERY_RESOURCE_ZIP := endif ifeq ($(recovery_resources_private),) $(info No private recovery resources for TARGET_DEVICE $(TARGET_DEVICE)) Loading Loading @@ -877,16 +884,18 @@ $(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ $(RECOVERY_INSTALL_OTA_KEYS) $(call build-recoveryimage-target, $@) ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) $(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) $(hide) mkdir -p $(dir $@) $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrj $@ -@ endif .PHONY: recoveryimage-nodeps recoveryimage-nodeps: @echo "make $@: ignoring dependencies" $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET)) else else # ! ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) INSTALLED_RECOVERYIMAGE_TARGET := RECOVERY_RESOURCE_ZIP := endif Loading Loading @@ -994,6 +1003,7 @@ SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) # we can see how big it's going to be, and include that in the system # image size check calculation. ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch) RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p $(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \ Loading @@ -1003,6 +1013,9 @@ $(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \ @echo "Construct recovery from boot" mkdir -p $(dir $@) PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@ else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET) endif endif Loading Loading @@ -1495,6 +1508,9 @@ endif ifeq ($(SANITIZE_TARGET),address) # We need to create userdata.img with real data because the instrumented libraries are in userdata.img. $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt endif ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt endif $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt) $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \ Loading
tools/releasetools/common.py +29 −11 Original line number Diff line number Diff line Loading @@ -1395,6 +1395,12 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, if info_dict is None: info_dict = OPTIONS.info_dict full_recovery_image = info_dict.get("full_recovery_image", None) == "true" if full_recovery_image: output_sink("etc/recovery.img", recovery_img.data) else: diff_program = ["imgdiff"] path = os.path.join(input_dir, "SYSTEM", "etc", "recovery-resource.dat") if os.path.exists(path): Loading @@ -1414,6 +1420,18 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, except KeyError: return if full_recovery_image: sh = """#!/system/bin/sh if ! applypatch -c %(type)s:%(device)s:%(size)d:%(sha1)s; then applypatch /system/etc/recovery.img %(type)s:%(device)s %(sha1)s %(size)d && log -t recovery "Installing new recovery image: succeeded" || log -t recovery "Installing new recovery image: failed" else log -t recovery "Recovery image already installed" fi """ % {'type': recovery_type, 'device': recovery_device, 'sha1': recovery_img.sha1, 'size': recovery_img.size} else: sh = """#!/system/bin/sh if ! applypatch -c %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then applypatch %(bonus_args)s %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s %(recovery_type)s:%(recovery_device)s %(recovery_sha1)s %(recovery_size)d %(boot_sha1)s:/system/recovery-from-boot.p && log -t recovery "Installing new recovery image: succeeded" || log -t recovery "Installing new recovery image: failed" Loading
tools/releasetools/ota_from_target_files.py +6 −6 Original line number Diff line number Diff line Loading @@ -218,7 +218,8 @@ class ItemSet(object): if i.is_dir: i.children.sort(key=lambda i: i.name) # set metadata for the files generated by this script. # Set metadata for the files generated by this script. For full recovery # image at system/etc/recovery.img, it will be taken care by fs_config. i = self.ITEMS.get("system/recovery-from-boot.p", None) if i: i.uid, i.gid, i.mode, i.selabel, i.capabilities = 0, 0, 0o644, None, None Loading Loading @@ -422,11 +423,9 @@ def AppendAssertions(script, info_dict, oem_dict=None): def HasRecoveryPatch(target_files_zip): try: target_files_zip.getinfo("SYSTEM/recovery-from-boot.p") return True except KeyError: return False namelist = [name for name in target_files_zip.namelist()] return ("SYSTEM/recovery-from-boot.p" in namelist or "SYSTEM/etc/recovery.img" in namelist) def HasVendorPartition(target_files_zip): try: Loading Loading @@ -1360,6 +1359,7 @@ else common.MakeRecoveryPatch(OPTIONS.target_tmp, output_sink, target_recovery, target_boot) script.DeleteFiles(["/system/recovery-from-boot.p", "/system/etc/recovery.img", "/system/etc/install-recovery.sh"]) print "recovery image changed; including as patch from boot." else: Loading
tools/releasetools/sign_target_files_apks.py +4 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, data = input_tf_zip.read(info.filename) out_info = copy.copy(info) # Replace keys if requested. if (info.filename == "META/misc_info.txt" and OPTIONS.replace_verity_private_key): ReplaceVerityPrivateKey(input_tf_zip, output_tf_zip, misc_info, Loading @@ -184,12 +185,14 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, new_data = ReplaceVerityPublicKey(output_tf_zip, OPTIONS.replace_verity_public_key[1]) write_to_temp(info.filename, info.external_attr, new_data) # Copy BOOT/, RECOVERY/, META/, ROOT/ to rebuild recovery patch. elif (info.filename.startswith("BOOT/") or info.filename.startswith("RECOVERY/") or info.filename.startswith("META/") or info.filename == "SYSTEM/etc/recovery-resource.dat"): write_to_temp(info.filename, info.external_attr, data) # Sign APKs. if info.filename.endswith(".apk"): name = os.path.basename(info.filename) key = apk_key_map[name] Loading @@ -214,6 +217,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, new_data = ReplaceCerts(data) common.ZipWriteStr(output_tf_zip, out_info, new_data) elif info.filename in ("SYSTEM/recovery-from-boot.p", "SYSTEM/etc/recovery.img", "SYSTEM/bin/install-recovery.sh"): rebuild_recovery = True elif (OPTIONS.replace_ota_keys and Loading