Merge "Adding boot-test-harness.img"
am: 818df7b0d0
Change-Id: I550d6e5eebe84f9e1971ef23a21c40d22de0d0b8
This commit is contained in:
commit
68130ccb4a
5 changed files with 111 additions and 20 deletions
116
core/Makefile
116
core/Makefile
|
@ -2154,6 +2154,7 @@ ifneq ($(BOARD_NAND_SPARE_SIZE),)
|
||||||
$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
|
$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# the debug ramdisk, which is the original ramdisk plus additional
|
# the debug ramdisk, which is the original ramdisk plus additional
|
||||||
# files: force_debuggable, adb_debug.prop and userdebug sepolicy.
|
# files: force_debuggable, adb_debug.prop and userdebug sepolicy.
|
||||||
|
@ -2250,40 +2251,115 @@ endif
|
||||||
# Using a test key to sign boot-debug.img to continue booting with the mismatched
|
# Using a test key to sign boot-debug.img to continue booting with the mismatched
|
||||||
# public key, if the device is unlocked.
|
# public key, if the device is unlocked.
|
||||||
ifneq ($(BOARD_AVB_BOOT_KEY_PATH),)
|
ifneq ($(BOARD_AVB_BOOT_KEY_PATH),)
|
||||||
BOARD_AVB_DEBUG_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
|
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH)
|
||||||
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS := \
|
|
||||||
--algorithm SHA256_RSA2048 --key $(BOARD_AVB_DEBUG_BOOT_KEY_PATH)
|
|
||||||
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_DEBUG_BOOT_KEY_PATH)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
BOARD_AVB_BOOT_TEST_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
|
||||||
|
INTERNAL_AVB_BOOT_TEST_SIGNING_ARGS := --algorithm SHA256_RSA2048 --key $(BOARD_AVB_BOOT_TEST_KEY_PATH)
|
||||||
|
# $(1): the bootimage to sign
|
||||||
|
define test-key-sign-bootimage
|
||||||
|
$(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
|
||||||
|
$(AVBTOOL) add_hash_footer \
|
||||||
|
--image $(1) \
|
||||||
|
--partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
|
||||||
|
--partition_name boot $(INTERNAL_AVB_BOOT_TEST_SIGNING_ARGS) \
|
||||||
|
$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
|
||||||
|
$(call assert-max-image-size,$(1),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
|
||||||
|
endef
|
||||||
|
|
||||||
# Depends on original boot.img and ramdisk-debug.img, to build the new boot-debug.img
|
# Depends on original boot.img and ramdisk-debug.img, to build the new boot-debug.img
|
||||||
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
||||||
$(call pretty,"Target boot debug image: $@")
|
$(call pretty,"Target boot debug image: $@")
|
||||||
$(MKBOOTIMG) $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
|
$(MKBOOTIMG) $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
|
||||||
$(if $(BOARD_AVB_BOOT_KEY_PATH),\
|
$(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$@))
|
||||||
$(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))); \
|
|
||||||
$(AVBTOOL) add_hash_footer \
|
|
||||||
--image $@ \
|
|
||||||
--partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
|
|
||||||
--partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS) \
|
|
||||||
$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS), \
|
|
||||||
$(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
|
|
||||||
|
|
||||||
.PHONY: bootimage_debug-nodeps
|
.PHONY: bootimage_debug-nodeps
|
||||||
bootimage_debug-nodeps: $(MKBOOTIMG)
|
bootimage_debug-nodeps: $(MKBOOTIMG)
|
||||||
echo "make $@: ignoring dependencies"
|
echo "make $@: ignoring dependencies"
|
||||||
$(MKBOOTIMG) $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_DEBUG_BOOTIMAGE_TARGET)
|
$(MKBOOTIMG) $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_DEBUG_BOOTIMAGE_TARGET)
|
||||||
$(if $(BOARD_AVB_BOOT_KEY_PATH),\
|
$(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET)))
|
||||||
$(call assert-max-image-size,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))); \
|
|
||||||
$(AVBTOOL) add_hash_footer \
|
|
||||||
--image $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
|
|
||||||
--partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
|
|
||||||
--partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS) \
|
|
||||||
$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS), \
|
|
||||||
$(call assert-max-image-size,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
|
|
||||||
|
|
||||||
endif # TARGET_NO_KERNEL
|
endif # TARGET_NO_KERNEL
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
# The test harness ramdisk, which is based off debug_ramdisk, plus a
|
||||||
|
# few additional test-harness-specific properties in adb_debug.prop.
|
||||||
|
|
||||||
|
ifdef BUILDING_RAMDISK_IMAGE
|
||||||
|
BUILT_TEST_HARNESS_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-test-harness.img
|
||||||
|
INSTALLED_TEST_HARNESS_RAMDISK_TARGET := $(BUILT_TEST_HARNESS_RAMDISK_TARGET)
|
||||||
|
|
||||||
|
# rsync the content from ramdisk-debug.img to ramdisk-test-harness.img, then
|
||||||
|
# appends a few test harness specific properties into the adb_debug.prop.
|
||||||
|
TEST_HARNESS_RAMDISK_SYNC_DIR := $(PRODUCT_OUT)/debug_ramdisk
|
||||||
|
TEST_HARNESS_RAMDISK_ROOT_DIR := $(PRODUCT_OUT)/test_harness_ramdisk
|
||||||
|
|
||||||
|
# The following TARGET_TEST_HARNESS_RAMDISK_OUT will be $(PRODUCT_OUT)/test_harness_ramdisk/first_stage_ramdisk,
|
||||||
|
# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/test_harness_ramdisk.
|
||||||
|
TEST_HARNESS_PROP_TARGET := $(TARGET_TEST_HARNESS_RAMDISK_OUT)/adb_debug.prop
|
||||||
|
ADDITIONAL_TEST_HARNESS_PROPERTIES := ro.audio.silent=1
|
||||||
|
ADDITIONAL_TEST_HARNESS_PROPERTIES += ro.test_harness=1
|
||||||
|
|
||||||
|
# $(1): a list of key=value pairs for additional property assignments
|
||||||
|
# $(2): the target .prop file to append the properties from $(1)
|
||||||
|
define append-test-harness-props
|
||||||
|
echo "#" >> $(2); \
|
||||||
|
echo "# ADDITIONAL TEST HARNESS_PROPERTIES" >> $(2); \
|
||||||
|
echo "#" >> $(2);
|
||||||
|
$(foreach line,$(1), echo "$(line)" >> $(2);)
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
||||||
|
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_TEST_HARNESS_RAMDISK_FILES) | $(MINIGZIP)
|
||||||
|
$(call pretty,"Target test harness ram disk: $@")
|
||||||
|
rsync -a $(TEST_HARNESS_RAMDISK_SYNC_DIR)/ $(TEST_HARNESS_RAMDISK_ROOT_DIR)
|
||||||
|
$(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
|
||||||
|
$(MKBOOTFS) -d $(TARGET_OUT) $(TEST_HARNESS_RAMDISK_ROOT_DIR) | $(MINIGZIP) > $@
|
||||||
|
|
||||||
|
.PHONY: ramdisk_test_harness-nodeps
|
||||||
|
ramdisk_test_harness-nodeps: $(MKBOOTFS) | $(MINIGZIP)
|
||||||
|
echo "make $@: ignoring dependencies"
|
||||||
|
rsync -a $(TEST_HARNESS_RAMDISK_SYNC_DIR)/ $(TEST_HARNESS_RAMDISK_ROOT_DIR)
|
||||||
|
$(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
|
||||||
|
$(MKBOOTFS) -d $(TARGET_OUT) $(TEST_HARNESS_RAMDISK_ROOT_DIR) | $(MINIGZIP) > $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
|
||||||
|
|
||||||
|
endif # BUILDING_RAMDISK_IMAGE
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------
|
||||||
|
# the boot-test-harness.img, which is the kernel plus ramdisk-test-harness.img
|
||||||
|
#
|
||||||
|
# Note: it's intentional to skip signing for boot-test-harness.img, because it
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# 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))
|
||||||
|
|
||||||
|
# If boot.img is chained but boot-test-harness.img is not signed, libavb in bootloader
|
||||||
|
# will fail to find valid AVB metadata from the end of /boot, thus stop booting.
|
||||||
|
# Using a test key to sign boot-test-harness.img to continue booting with the mismatched
|
||||||
|
# public key, if the device is unlocked.
|
||||||
|
ifneq ($(BOARD_AVB_BOOT_KEY_PATH),)
|
||||||
|
$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# 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,$@))
|
||||||
|
|
||||||
|
.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)))
|
||||||
|
|
||||||
|
endif # TARGET_NO_KERNEL
|
||||||
|
endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# system image
|
# system image
|
||||||
#
|
#
|
||||||
|
|
|
@ -263,6 +263,7 @@ endif
|
||||||
# Now we can substitute with the real value of TARGET_COPY_OUT_DEBUG_RAMDISK
|
# Now we can substitute with the real value of TARGET_COPY_OUT_DEBUG_RAMDISK
|
||||||
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||||
TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk/first_stage_ramdisk
|
TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk/first_stage_ramdisk
|
||||||
|
TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk/first_stage_ramdisk
|
||||||
endif
|
endif
|
||||||
|
|
||||||
###########################################
|
###########################################
|
||||||
|
|
|
@ -1171,8 +1171,10 @@ dont_bother_goals := out \
|
||||||
systemotherimage-nodeps \
|
systemotherimage-nodeps \
|
||||||
ramdisk-nodeps \
|
ramdisk-nodeps \
|
||||||
ramdisk_debug-nodeps \
|
ramdisk_debug-nodeps \
|
||||||
|
ramdisk_test_harness-nodeps \
|
||||||
bootimage-nodeps \
|
bootimage-nodeps \
|
||||||
bootimage_debug-nodeps \
|
bootimage_debug-nodeps \
|
||||||
|
bootimage_test_harness-nodeps \
|
||||||
recoveryimage-nodeps \
|
recoveryimage-nodeps \
|
||||||
vbmetaimage-nodeps \
|
vbmetaimage-nodeps \
|
||||||
product-graph dump-products
|
product-graph dump-products
|
||||||
|
|
|
@ -228,6 +228,7 @@ TARGET_COPY_OUT_ASAN := $(TARGET_COPY_OUT_DATA)/asan
|
||||||
TARGET_COPY_OUT_OEM := oem
|
TARGET_COPY_OUT_OEM := oem
|
||||||
TARGET_COPY_OUT_RAMDISK := ramdisk
|
TARGET_COPY_OUT_RAMDISK := ramdisk
|
||||||
TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk
|
TARGET_COPY_OUT_DEBUG_RAMDISK := debug_ramdisk
|
||||||
|
TARGET_COPY_OUT_TEST_HARNESS_RAMDISK := test_harness_ramdisk
|
||||||
TARGET_COPY_OUT_ROOT := root
|
TARGET_COPY_OUT_ROOT := root
|
||||||
TARGET_COPY_OUT_RECOVERY := recovery
|
TARGET_COPY_OUT_RECOVERY := recovery
|
||||||
# The directory used for optional partitions depend on the BoardConfig, so
|
# The directory used for optional partitions depend on the BoardConfig, so
|
||||||
|
@ -825,6 +826,7 @@ TARGET_OUT_COVERAGE := $(PRODUCT_OUT)/coverage
|
||||||
TARGET_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RAMDISK)
|
TARGET_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RAMDISK)
|
||||||
TARGET_RAMDISK_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
|
TARGET_RAMDISK_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)
|
||||||
TARGET_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DEBUG_RAMDISK)
|
TARGET_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DEBUG_RAMDISK)
|
||||||
|
TARGET_TEST_HARNESS_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_TEST_HARNESS_RAMDISK)
|
||||||
|
|
||||||
TARGET_VENDOR_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_RAMDISK)
|
TARGET_VENDOR_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_RAMDISK)
|
||||||
|
|
||||||
|
|
10
core/main.mk
10
core/main.mk
|
@ -1490,6 +1490,9 @@ ramdisk: $(INSTALLED_RAMDISK_TARGET)
|
||||||
.PHONY: ramdisk_debug
|
.PHONY: ramdisk_debug
|
||||||
ramdisk_debug: $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
ramdisk_debug: $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
||||||
|
|
||||||
|
.PHONY: ramdisk_test_harness
|
||||||
|
ramdisk_test_harness: $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
|
||||||
|
|
||||||
.PHONY: userdataimage
|
.PHONY: userdataimage
|
||||||
userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
|
userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
|
||||||
|
|
||||||
|
@ -1530,6 +1533,9 @@ bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
|
||||||
.PHONY: bootimage_debug
|
.PHONY: bootimage_debug
|
||||||
bootimage_debug: $(INSTALLED_DEBUG_BOOTIMAGE_TARGET)
|
bootimage_debug: $(INSTALLED_DEBUG_BOOTIMAGE_TARGET)
|
||||||
|
|
||||||
|
.PHONY: bootimage_test_harness
|
||||||
|
bootimage_test_harness: $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET)
|
||||||
|
|
||||||
.PHONY: vbmetaimage
|
.PHONY: vbmetaimage
|
||||||
vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET)
|
vbmetaimage: $(INSTALLED_VBMETAIMAGE_TARGET)
|
||||||
|
|
||||||
|
@ -1697,6 +1703,10 @@ else # TARGET_BUILD_APPS
|
||||||
$(INSTALLED_DEBUG_RAMDISK_TARGET) \
|
$(INSTALLED_DEBUG_RAMDISK_TARGET) \
|
||||||
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
|
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
|
||||||
)
|
)
|
||||||
|
$(call dist-for-goals, bootimage_test_harness, \
|
||||||
|
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) \
|
||||||
|
$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) \
|
||||||
|
)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(EMMA_INSTRUMENT),true)
|
ifeq ($(EMMA_INSTRUMENT),true)
|
||||||
|
|
Loading…
Reference in a new issue