From 65c1162eb5ed4b670360e3f1025fe51a43c84f9d Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Mon, 2 Oct 2023 12:45:30 -0700 Subject: [PATCH] Generate incremental OTAs for 16K/4K boot option Previously, the 16K/4K boot options OTAs are full OTAs, resulting in file size of ~20MB each, and ~40M for both OTAs. To reduce the space usage, use incremental OTAs instead. Test: th Bug: 302759296 Bug: 293313353 Change-Id: I61cc84c6c13f151dd6bc5ff37dd31daa5fb31abd --- core/Makefile | 14 ++++++++++---- tools/releasetools/ota_from_raw_img.py | 6 ++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/core/Makefile b/core/Makefile index 79c8a17634..09c815ed98 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1167,13 +1167,16 @@ bootimage_16k: $(BUILT_BOOTIMAGE_16K_TARGET) .PHONY: bootimage_16k BUILT_BOOT_OTA_PACKAGE_16K := $(PRODUCT_OUT)/boot_ota_16k.zip -$(BUILT_BOOT_OTA_PACKAGE_16K): $(OTA_FROM_RAW_IMG) $(BUILT_BOOTIMAGE_16K_TARGET) $(DEFAULT_SYSTEM_DEV_CERTIFICATE).pk8 +$(BUILT_BOOT_OTA_PACKAGE_16K): $(OTA_FROM_RAW_IMG) $(BUILT_BOOTIMAGE_16K_TARGET) $(INSTALLED_BOOTIMAGE_TARGET) $(DEFAULT_SYSTEM_DEV_CERTIFICATE).pk8 $(OTA_FROM_RAW_IMG) --package_key $(DEFAULT_SYSTEM_DEV_CERTIFICATE) \ --max_timestamp `cat $(BUILD_DATETIME_FILE)` \ --path $(HOST_OUT) \ --partition_name boot \ --output $@ \ - $(BUILT_BOOTIMAGE_16K_TARGET) + $(if $(BOARD_16K_OTA_USE_INCREMENTAL),\ + $(INSTALLED_BOOTIMAGE_TARGET):$(BUILT_BOOTIMAGE_16K_TARGET),\ + $(BUILT_BOOTIMAGE_16K_TARGET)\ + ) boototapackage_16k: $(BUILT_BOOT_OTA_PACKAGE_16K) .PHONY: boototapackage_16k @@ -1503,13 +1506,16 @@ endif # my_installed_prebuilt_gki_apex not defined ifneq ($(BOARD_KERNEL_PATH_16K),) BUILT_BOOT_OTA_PACKAGE_4K := $(PRODUCT_OUT)/boot_ota_4k.zip -$(BUILT_BOOT_OTA_PACKAGE_4K): $(OTA_FROM_RAW_IMG) $(INSTALLED_BOOTIMAGE_TARGET) $(DEFAULT_SYSTEM_DEV_CERTIFICATE).pk8 +$(BUILT_BOOT_OTA_PACKAGE_4K): $(OTA_FROM_RAW_IMG) $(INSTALLED_BOOTIMAGE_TARGET) $(BUILT_BOOTIMAGE_16K_TARGET) $(DEFAULT_SYSTEM_DEV_CERTIFICATE).pk8 $(OTA_FROM_RAW_IMG) --package_key $(DEFAULT_SYSTEM_DEV_CERTIFICATE) \ --max_timestamp `cat $(BUILD_DATETIME_FILE)` \ --path $(HOST_OUT) \ --partition_name boot \ --output $@ \ - $(INSTALLED_BOOTIMAGE_TARGET) + $(if $(BOARD_16K_OTA_USE_INCREMENTAL),\ + $(BUILT_BOOTIMAGE_16K_TARGET):$(INSTALLED_BOOTIMAGE_TARGET),\ + $(INSTALLED_BOOTIMAGE_TARGET)\ + ) boototapackage_4k: $(BUILT_BOOT_OTA_PACKAGE_4K) .PHONY: boototapackage_4k diff --git a/tools/releasetools/ota_from_raw_img.py b/tools/releasetools/ota_from_raw_img.py index 0c1c05acde..c186940c25 100644 --- a/tools/releasetools/ota_from_raw_img.py +++ b/tools/releasetools/ota_from_raw_img.py @@ -68,6 +68,11 @@ def main(argv): if args.verbose: logger.setLevel(logging.INFO) logger.info(args) + old_imgs = [""] * len(args.images) + for (i, img) in enumerate(args.images): + if ":" in img: + old_imgs[i], args.images[i] = img.split(":", maxsplit=1) + if not args.partition_names: args.partition_names = [os.path.os.path.splitext(os.path.basename(path))[ 0] for path in args.images] @@ -79,6 +84,7 @@ def main(argv): cmd.append("--partition_names=" + ",".join(args.partition_names)) cmd.append("--dynamic_partition_info_file=" + dynamic_partition_info_file.name) + cmd.append("--old_partitions=" + ",".join(old_imgs)) cmd.append("--new_partitions=" + ",".join(args.images)) cmd.append("--out_file=" + unsigned_payload.name) cmd.append("--is_partial_update")