diff --git a/core/Makefile b/core/Makefile index bda0b231f..49c566702 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2557,7 +2557,12 @@ endif # BUILDING_RAMDISK_IMAGE # can only be used if the device is unlocked with verification error. ifneq ($(strip $(TARGET_NO_KERNEL)),true) -INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-test-harness.img +ifneq ($(strip $(BOARD_KERNEL_BINARIES)),) + INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-test-harness,$(BOARD_KERNEL_BINARIES)), \ + $(PRODUCT_OUT)/$(k).img) +else + INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-test-harness.img +endif # Replace ramdisk-debug.img in $(MKBOOTIMG) ARGS with ramdisk-test-harness.img to build boot-test-harness.img INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS := $(subst $(INSTALLED_DEBUG_RAMDISK_TARGET),$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET),$(INTERNAL_DEBUG_BOOTIMAGE_ARGS)) @@ -2570,17 +2575,22 @@ ifneq ($(BOARD_AVB_BOOT_KEY_PATH),) $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH) endif +# $(1): output file +define build-boot-test-harness-target + $(MKBOOTIMG) --kernel $(PRODUCT_OUT)/$(subst .img,,$(subst boot-test-harness,kernel,$(notdir $(1)))) \ + $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ + $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$@)) +endef + # Build the new boot-test-harness.img, based on boot-debug.img and ramdisk-test-harness.img. $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) $(call pretty,"Target boot test harness image: $@") - $(MKBOOTIMG) $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ - $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$@)) + $(call build-boot-test-harness-target,$@) .PHONY: bootimage_test_harness-nodeps bootimage_test_harness-nodeps: $(MKBOOTIMG) echo "make $@: ignoring dependencies" - $(MKBOOTIMG) $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) - $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET))) + $(foreach b,$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET),$(call build-boot-test-harness-target,$b)) endif # TARGET_NO_KERNEL endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true