From 69e0d61cbe305a1cd1b229ea320924d727afff48 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 11 Mar 2019 15:55:33 -0700 Subject: [PATCH] Add supernod build target. superimage-nodeps and supernod depends on images from $(ANDROID_PRODUCT_OUT) (not from target files package). It doesn't rebuild source images if they are present. A typical workflow is: m -j # change code in system m snod -j m supernod -j Test: For non retrofit, run: `m snod -j; m supernod -j` Fixes: 128321505 Change-Id: Ib8c011cadb9c0cd334234aef39f19be6a48fee62 --- core/Makefile | 29 ++++++++++++++++++++----- tools/releasetools/build_super_image.py | 3 +-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/core/Makefile b/core/Makefile index 8a73f4eedb..811282dbb7 100644 --- a/core/Makefile +++ b/core/Makefile @@ -4317,6 +4317,13 @@ ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION)) # BOARD_SUPER_PARTITION_SIZE must be defined to build super image. ifneq ($(BOARD_SUPER_PARTITION_SIZE),) +# Dump variables used by build_super_image.py. +define dump-super-image-info + $(call dump-dynamic-partitions-info,$(1)) + $(if $(filter true,$(AB_OTA_UPDATER)), \ + echo "ab_update=true" >> $(1)) +endef + ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)) INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img $(INSTALLED_SUPERIMAGE_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) @@ -4324,7 +4331,22 @@ $(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_ $(call pretty,"Target super fs image: $@") PATH=$(dir $(LPMAKE)):$$PATH \ $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@ -endif + +# supernod uses images in the $(PRODUCT_OUT) directory instead of images from target files package. +.PHONY: superimage-nodeps supernod +superimage-nodeps supernod: intermediates := $(call intermediates-dir-for,PACKAGING,superimage-nodeps) +superimage-nodeps supernod: | $(LPMAKE) $(BUILD_SUPER_IMAGE) \ + $(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)) + $(call pretty,"make $(INSTALLED_SUPERIMAGE_TARGET): ignoring dependencies") + mkdir -p $(intermediates) + rm -rf $(intermediates)/misc_info.txt + $(call dump-super-image-info,$(intermediates)/misc_info.txt) + $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \ + echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(intermediates)/misc_info.txt;) + PATH=$(dir $(LPMAKE)):$$PATH \ + $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $(INSTALLED_SUPERIMAGE_TARGET) + +endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true" $(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET)) @@ -4334,10 +4356,7 @@ $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE) $(call pretty,"Target empty super fs image: $@") mkdir -p $(intermediates) rm -rf $(intermediates)/misc_info.txt - $(call dump-dynamic-partitions-info,$(intermediates)/misc_info.txt) -ifeq ($(AB_OTA_UPDATER),true) - echo "ab_update=true" >> $(intermediates)/misc_info.txt -endif + $(call dump-super-image-info,$(intermediates)/misc_info.txt) PATH=$(dir $(LPMAKE)):$$PATH \ $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@ diff --git a/tools/releasetools/build_super_image.py b/tools/releasetools/build_super_image.py index bb0e6413af..38ea3d68e4 100755 --- a/tools/releasetools/build_super_image.py +++ b/tools/releasetools/build_super_image.py @@ -24,9 +24,8 @@ input_file: one of the following: - target files package. Same as above, but extracts the archive before building super image. - a dictionary file containing input arguments to build. Check - `dump_dynamic_partitions_info' for details. + `dump-super-image-info' for details. In addition: - - "ab_update" needs to be true for A/B devices. - If source images should be included in the output image (for super.img and super split images), a list of "*_image" should be paths of each source images.