Loading core/Makefile +6 −5 Original line number Diff line number Diff line Loading @@ -1924,7 +1924,8 @@ endif ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \ $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO))) # Named '.dat' so we don't attempt to use imgdiff for patching it. RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat RECOVERY_RESOURCE_ZIP := $(TARGET_OUT_VENDOR)/etc/recovery-resource.dat ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_RESOURCE_ZIP) else RECOVERY_RESOURCE_ZIP := endif Loading Loading @@ -2294,8 +2295,7 @@ PDK_FUSION_SYSIMG_FILES := \ INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \ $(ALL_GENERATED_SOURCES) \ $(ALL_DEFAULT_INSTALLED_MODULES) \ $(PDK_FUSION_SYSIMG_FILES) \ $(RECOVERY_RESOURCE_ZIP)) \ $(PDK_FUSION_SYSIMG_FILES)) \ $(PDK_FUSION_SYMLINK_STAMP)) FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS) Loading Loading @@ -3893,6 +3893,9 @@ endif ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) $(hide) echo "full_recovery_image=true" >> $@ endif ifdef BOARD_USES_VENDORIMAGE $(hide) echo "board_uses_vendorimage=true" >> $@ endif ifeq ($(BOARD_AVB_ENABLE),true) $(hide) echo "avb_enable=true" >> $@ $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $@ Loading Loading @@ -4299,10 +4302,8 @@ ifneq ($(PRODUCT_ODM_BASE_FS_PATH),) $(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH)) endif ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) ifdef BUILDING_SYSTEM_IMAGE $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \ $(MAKE_RECOVERY_PATCH) $(zip_root) $(zip_root) endif # BUILDING_SYSTEM_IMAGE endif ifeq ($(AB_OTA_UPDATER),true) @# When using the A/B updater, include the updater config files in the zip. Loading target/product/base_system.mk +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ PRODUCT_PACKAGES += \ android.test.mock \ android.test.runner \ apexd \ applypatch \ appops \ app_process \ appwidget \ Loading target/product/base_vendor.mk +5 −0 Original line number Diff line number Diff line Loading @@ -75,3 +75,8 @@ PRODUCT_PACKAGES += \ # VINTF data for vendor image PRODUCT_PACKAGES += \ device_compatibility_matrix.xml \ # Packages to update the recovery partition, which will be installed on # /vendor. TODO(b/141648565): Don't install these unless they're needed. PRODUCT_PACKAGES += \ applypatch tools/releasetools/add_img_to_target_files.py +30 −5 Original line number Diff line number Diff line Loading @@ -165,9 +165,12 @@ def AddSystem(output_zip, recovery_img=None, boot_img=None): else: common.ZipWrite(output_zip, output_file, arc_name) if (OPTIONS.rebuild_recovery and recovery_img is not None and boot_img is not None): logger.info("Building new recovery patch") board_uses_vendorimage = OPTIONS.info_dict.get( "board_uses_vendorimage") == "true" if (OPTIONS.rebuild_recovery and not board_uses_vendorimage and recovery_img is not None and boot_img is not None): logger.info("Building new recovery patch on system at system/vendor") common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, recovery_img, boot_img, info_dict=OPTIONS.info_dict) Loading @@ -190,7 +193,7 @@ def AddSystemOther(output_zip): CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "system_other", img) def AddVendor(output_zip): def AddVendor(output_zip, recovery_img=None, boot_img=None): """Turn the contents of VENDOR into a vendor image and store in it output_zip.""" Loading @@ -199,6 +202,27 @@ def AddVendor(output_zip): logger.info("vendor.img already exists; no need to rebuild...") return img.name def output_sink(fn, data): ofile = open(os.path.join(OPTIONS.input_tmp, "VENDOR", fn), "w") ofile.write(data) ofile.close() if output_zip: arc_name = "VENDOR/" + fn if arc_name in output_zip.namelist(): OPTIONS.replace_updated_files_list.append(arc_name) else: common.ZipWrite(output_zip, ofile.name, arc_name) board_uses_vendorimage = OPTIONS.info_dict.get( "board_uses_vendorimage") == "true" if (OPTIONS.rebuild_recovery and board_uses_vendorimage and recovery_img is not None and boot_img is not None): logger.info("Building new recovery patch on vendor") common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, recovery_img, boot_img, info_dict=OPTIONS.info_dict) block_list = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "vendor.map") CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "vendor", img, block_list=block_list) Loading Loading @@ -781,7 +805,8 @@ def AddImagesToTargetFiles(filename): if has_vendor: banner("vendor") partitions['vendor'] = AddVendor(output_zip) partitions['vendor'] = AddVendor( output_zip, recovery_img=recovery_image, boot_img=boot_image) if has_product: banner("product") Loading tools/releasetools/common.py +28 −10 Original line number Diff line number Diff line Loading @@ -2535,13 +2535,25 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, info_dict = OPTIONS.info_dict full_recovery_image = info_dict.get("full_recovery_image") == "true" board_uses_vendorimage = info_dict.get("board_uses_vendorimage") == "true" if board_uses_vendorimage: # In this case, the output sink is rooted at VENDOR recovery_img_path = "etc/recovery.img" recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat" sh_dir = "bin" else: # In this case the output sink is rooted at SYSTEM recovery_img_path = "vendor/etc/recovery.img" recovery_resource_dat_path = "SYSTEM/vendor/etc/recovery-resource.dat" sh_dir = "vendor/bin" if full_recovery_image: output_sink("etc/recovery.img", recovery_img.data) output_sink(recovery_img_path, recovery_img.data) else: system_root_image = info_dict.get("system_root_image") == "true" path = os.path.join(input_dir, "SYSTEM", "etc", "recovery-resource.dat") path = os.path.join(input_dir, recovery_resource_dat_path) # With system-root-image, boot and recovery images will have mismatching # entries (only recovery has the ramdisk entry) (Bug: 72731506). Use bsdiff # to handle such a case. Loading @@ -2554,7 +2566,7 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, if os.path.exists(path): diff_program.append("-b") diff_program.append(path) bonus_args = "--bonus /system/etc/recovery-resource.dat" bonus_args = "--bonus /vendor/etc/recovery-resource.dat" else: bonus_args = "" Loading @@ -2571,10 +2583,16 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, return if full_recovery_image: sh = """#!/system/bin/sh # Note that we use /vendor to refer to the recovery resources. This will # work for a separate vendor partition mounted at /vendor or a # /system/vendor subdirectory on the system partition, for which init will # create a symlink from /vendor to /system/vendor. sh = """#!/vendor/bin/sh if ! applypatch --check %(type)s:%(device)s:%(size)d:%(sha1)s; then applypatch \\ --flash /system/etc/recovery.img \\ --flash /vendor/etc/recovery.img \\ --target %(type)s:%(device)s:%(size)d:%(sha1)s && \\ log -t recovery "Installing new recovery image: succeeded" || \\ log -t recovery "Installing new recovery image: failed" Loading @@ -2586,10 +2604,10 @@ fi 'sha1': recovery_img.sha1, 'size': recovery_img.size} else: sh = """#!/system/bin/sh sh = """#!/vendor/bin/sh if ! applypatch --check %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then applypatch %(bonus_args)s \\ --patch /system/recovery-from-boot.p \\ --patch /vendor/recovery-from-boot.p \\ --source %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s \\ --target %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s && \\ log -t recovery "Installing new recovery image: succeeded" || \\ Loading @@ -2607,9 +2625,9 @@ fi 'recovery_device': recovery_device, 'bonus_args': bonus_args} # The install script location moved from /system/etc to /system/bin # in the L release. sh_location = "bin/install-recovery.sh" # The install script location moved from /system/etc to /system/bin in the L # release. In the R release it is in VENDOR/bin or SYSTEM/vendor/bin. sh_location = os.path.join(sh_dir, "install-recovery.sh") logger.info("putting script in %s", sh_location) Loading Loading
core/Makefile +6 −5 Original line number Diff line number Diff line Loading @@ -1924,7 +1924,8 @@ endif ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \ $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO))) # Named '.dat' so we don't attempt to use imgdiff for patching it. RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat RECOVERY_RESOURCE_ZIP := $(TARGET_OUT_VENDOR)/etc/recovery-resource.dat ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_RESOURCE_ZIP) else RECOVERY_RESOURCE_ZIP := endif Loading Loading @@ -2294,8 +2295,7 @@ PDK_FUSION_SYSIMG_FILES := \ INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \ $(ALL_GENERATED_SOURCES) \ $(ALL_DEFAULT_INSTALLED_MODULES) \ $(PDK_FUSION_SYSIMG_FILES) \ $(RECOVERY_RESOURCE_ZIP)) \ $(PDK_FUSION_SYSIMG_FILES)) \ $(PDK_FUSION_SYMLINK_STAMP)) FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS) Loading Loading @@ -3893,6 +3893,9 @@ endif ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) $(hide) echo "full_recovery_image=true" >> $@ endif ifdef BOARD_USES_VENDORIMAGE $(hide) echo "board_uses_vendorimage=true" >> $@ endif ifeq ($(BOARD_AVB_ENABLE),true) $(hide) echo "avb_enable=true" >> $@ $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $@ Loading Loading @@ -4299,10 +4302,8 @@ ifneq ($(PRODUCT_ODM_BASE_FS_PATH),) $(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH)) endif ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) ifdef BUILDING_SYSTEM_IMAGE $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \ $(MAKE_RECOVERY_PATCH) $(zip_root) $(zip_root) endif # BUILDING_SYSTEM_IMAGE endif ifeq ($(AB_OTA_UPDATER),true) @# When using the A/B updater, include the updater config files in the zip. Loading
target/product/base_system.mk +0 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ PRODUCT_PACKAGES += \ android.test.mock \ android.test.runner \ apexd \ applypatch \ appops \ app_process \ appwidget \ Loading
target/product/base_vendor.mk +5 −0 Original line number Diff line number Diff line Loading @@ -75,3 +75,8 @@ PRODUCT_PACKAGES += \ # VINTF data for vendor image PRODUCT_PACKAGES += \ device_compatibility_matrix.xml \ # Packages to update the recovery partition, which will be installed on # /vendor. TODO(b/141648565): Don't install these unless they're needed. PRODUCT_PACKAGES += \ applypatch
tools/releasetools/add_img_to_target_files.py +30 −5 Original line number Diff line number Diff line Loading @@ -165,9 +165,12 @@ def AddSystem(output_zip, recovery_img=None, boot_img=None): else: common.ZipWrite(output_zip, output_file, arc_name) if (OPTIONS.rebuild_recovery and recovery_img is not None and boot_img is not None): logger.info("Building new recovery patch") board_uses_vendorimage = OPTIONS.info_dict.get( "board_uses_vendorimage") == "true" if (OPTIONS.rebuild_recovery and not board_uses_vendorimage and recovery_img is not None and boot_img is not None): logger.info("Building new recovery patch on system at system/vendor") common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, recovery_img, boot_img, info_dict=OPTIONS.info_dict) Loading @@ -190,7 +193,7 @@ def AddSystemOther(output_zip): CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "system_other", img) def AddVendor(output_zip): def AddVendor(output_zip, recovery_img=None, boot_img=None): """Turn the contents of VENDOR into a vendor image and store in it output_zip.""" Loading @@ -199,6 +202,27 @@ def AddVendor(output_zip): logger.info("vendor.img already exists; no need to rebuild...") return img.name def output_sink(fn, data): ofile = open(os.path.join(OPTIONS.input_tmp, "VENDOR", fn), "w") ofile.write(data) ofile.close() if output_zip: arc_name = "VENDOR/" + fn if arc_name in output_zip.namelist(): OPTIONS.replace_updated_files_list.append(arc_name) else: common.ZipWrite(output_zip, ofile.name, arc_name) board_uses_vendorimage = OPTIONS.info_dict.get( "board_uses_vendorimage") == "true" if (OPTIONS.rebuild_recovery and board_uses_vendorimage and recovery_img is not None and boot_img is not None): logger.info("Building new recovery patch on vendor") common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, recovery_img, boot_img, info_dict=OPTIONS.info_dict) block_list = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "vendor.map") CreateImage(OPTIONS.input_tmp, OPTIONS.info_dict, "vendor", img, block_list=block_list) Loading Loading @@ -781,7 +805,8 @@ def AddImagesToTargetFiles(filename): if has_vendor: banner("vendor") partitions['vendor'] = AddVendor(output_zip) partitions['vendor'] = AddVendor( output_zip, recovery_img=recovery_image, boot_img=boot_image) if has_product: banner("product") Loading
tools/releasetools/common.py +28 −10 Original line number Diff line number Diff line Loading @@ -2535,13 +2535,25 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, info_dict = OPTIONS.info_dict full_recovery_image = info_dict.get("full_recovery_image") == "true" board_uses_vendorimage = info_dict.get("board_uses_vendorimage") == "true" if board_uses_vendorimage: # In this case, the output sink is rooted at VENDOR recovery_img_path = "etc/recovery.img" recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat" sh_dir = "bin" else: # In this case the output sink is rooted at SYSTEM recovery_img_path = "vendor/etc/recovery.img" recovery_resource_dat_path = "SYSTEM/vendor/etc/recovery-resource.dat" sh_dir = "vendor/bin" if full_recovery_image: output_sink("etc/recovery.img", recovery_img.data) output_sink(recovery_img_path, recovery_img.data) else: system_root_image = info_dict.get("system_root_image") == "true" path = os.path.join(input_dir, "SYSTEM", "etc", "recovery-resource.dat") path = os.path.join(input_dir, recovery_resource_dat_path) # With system-root-image, boot and recovery images will have mismatching # entries (only recovery has the ramdisk entry) (Bug: 72731506). Use bsdiff # to handle such a case. Loading @@ -2554,7 +2566,7 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, if os.path.exists(path): diff_program.append("-b") diff_program.append(path) bonus_args = "--bonus /system/etc/recovery-resource.dat" bonus_args = "--bonus /vendor/etc/recovery-resource.dat" else: bonus_args = "" Loading @@ -2571,10 +2583,16 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, return if full_recovery_image: sh = """#!/system/bin/sh # Note that we use /vendor to refer to the recovery resources. This will # work for a separate vendor partition mounted at /vendor or a # /system/vendor subdirectory on the system partition, for which init will # create a symlink from /vendor to /system/vendor. sh = """#!/vendor/bin/sh if ! applypatch --check %(type)s:%(device)s:%(size)d:%(sha1)s; then applypatch \\ --flash /system/etc/recovery.img \\ --flash /vendor/etc/recovery.img \\ --target %(type)s:%(device)s:%(size)d:%(sha1)s && \\ log -t recovery "Installing new recovery image: succeeded" || \\ log -t recovery "Installing new recovery image: failed" Loading @@ -2586,10 +2604,10 @@ fi 'sha1': recovery_img.sha1, 'size': recovery_img.size} else: sh = """#!/system/bin/sh sh = """#!/vendor/bin/sh if ! applypatch --check %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then applypatch %(bonus_args)s \\ --patch /system/recovery-from-boot.p \\ --patch /vendor/recovery-from-boot.p \\ --source %(boot_type)s:%(boot_device)s:%(boot_size)d:%(boot_sha1)s \\ --target %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s && \\ log -t recovery "Installing new recovery image: succeeded" || \\ Loading @@ -2607,9 +2625,9 @@ fi 'recovery_device': recovery_device, 'bonus_args': bonus_args} # The install script location moved from /system/etc to /system/bin # in the L release. sh_location = "bin/install-recovery.sh" # The install script location moved from /system/etc to /system/bin in the L # release. In the R release it is in VENDOR/bin or SYSTEM/vendor/bin. sh_location = os.path.join(sh_dir, "install-recovery.sh") logger.info("putting script in %s", sh_location) Loading