Dedup build rules of ramdisk-(debug|test-harness).img
Adjust code location, factor out common code, eliminate dead code. Bug: 201753847 Test: Presubmit; change is noop Change-Id: If929bcf92bc03305058d2d8179c8dba351961c8e
This commit is contained in:
parent
870ea163c2
commit
6c51a43bcc
1 changed files with 35 additions and 62 deletions
|
@ -2285,70 +2285,59 @@ $(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is depr
|
|||
endif
|
||||
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Build debug ramdisk and debug boot image.
|
||||
ifneq ($(BUILDING_DEBUG_BOOT_IMAGE)$(BUILDING_DEBUG_VENDOR_BOOT_IMAGE),)
|
||||
|
||||
# ramdisk-debug.img will merge the content from either ramdisk.img or
|
||||
# ramdisk-recovery.img, depending on whether BOARD_USES_RECOVERY_AS_BOOT
|
||||
# is set or not.
|
||||
# INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DEP would ensure INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR is created.
|
||||
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||
INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR := $(TARGET_RECOVERY_ROOT_OUT)
|
||||
INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DEP := $(recovery_ramdisk)
|
||||
else # BOARD_USES_RECOVERY_AS_BOOT == true
|
||||
INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR := $(TARGET_RAMDISK_OUT)
|
||||
INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DEP := $(INSTALLED_RAMDISK_TARGET)
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT != true
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# the debug ramdisk, which is the original ramdisk plus additional
|
||||
# files: force_debuggable, adb_debug.prop and userdebug sepolicy.
|
||||
# When /force_debuggable is present, /init will load userdebug sepolicy
|
||||
# and property files to allow adb root, if the device is unlocked.
|
||||
ifneq ($(BUILDING_DEBUG_BOOT_IMAGE)$(BUILDING_DEBUG_VENDOR_BOOT_IMAGE),)
|
||||
|
||||
BUILT_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-debug.img
|
||||
INSTALLED_DEBUG_RAMDISK_TARGET := $(BUILT_DEBUG_RAMDISK_TARGET)
|
||||
INSTALLED_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-debug.img
|
||||
|
||||
INTERNAL_DEBUG_RAMDISK_FILES := $(filter $(TARGET_DEBUG_RAMDISK_OUT)/%, \
|
||||
$(ALL_GENERATED_SOURCES) \
|
||||
$(ALL_DEFAULT_INSTALLED_MODULES))
|
||||
|
||||
# INSTALLED_FILES_FILE_DEBUG_RAMDISK would ensure TARGET_DEBUG_RAMDISK_OUT is created.
|
||||
INSTALLED_FILES_FILE_DEBUG_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk-debug.txt
|
||||
INSTALLED_FILES_JSON_DEBUG_RAMDISK := $(INSTALLED_FILES_FILE_DEBUG_RAMDISK:.txt=.json)
|
||||
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_DEBUG_RAMDISK)
|
||||
|
||||
# ramdisk-debug.img will merge the content from either ramdisk.img or
|
||||
# ramdisk-recovery.img, depending on whether BOARD_USES_RECOVERY_AS_BOOT
|
||||
# is set or not.
|
||||
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): PRIVATE_ADDITIONAL_DIR := $(TARGET_RECOVERY_ROOT_OUT)
|
||||
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): $(recovery_ramdisk)
|
||||
else
|
||||
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): PRIVATE_ADDITIONAL_DIR := $(TARGET_RAMDISK_OUT)
|
||||
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): $(INSTALLED_RAMDISK_TARGET)
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT
|
||||
|
||||
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DEP)
|
||||
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INTERNAL_DEBUG_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL)
|
||||
@echo Installed file list: $@
|
||||
mkdir -p $(dir $@)
|
||||
rm -f $@
|
||||
$(FILESLIST) $(TARGET_DEBUG_RAMDISK_OUT) $(PRIVATE_ADDITIONAL_DIR) > $(@:.txt=.json)
|
||||
$(FILESLIST) $(TARGET_DEBUG_RAMDISK_OUT) $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR) > $(@:.txt=.json)
|
||||
$(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
|
||||
|
||||
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||
$(INSTALLED_DEBUG_RAMDISK_TARGET): PRIVATE_ADDITIONAL_DIR := $(TARGET_RECOVERY_ROOT_OUT)
|
||||
$(INSTALLED_DEBUG_RAMDISK_TARGET): $(recovery_ramdisk)
|
||||
else
|
||||
$(INSTALLED_DEBUG_RAMDISK_TARGET): PRIVATE_ADDITIONAL_DIR := $(TARGET_RAMDISK_OUT)
|
||||
$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_RAMDISK_TARGET)
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT
|
||||
|
||||
$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_FILES_FILE_DEBUG_RAMDISK)
|
||||
$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DEP)
|
||||
$(INSTALLED_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_DEBUG_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
|
||||
$(call pretty,"Target debug ramdisk: $@")
|
||||
mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
|
||||
touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
|
||||
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_DEBUG_RAMDISK_OUT) $(PRIVATE_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $@
|
||||
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_DEBUG_RAMDISK_OUT) $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $@
|
||||
|
||||
.PHONY: ramdisk_debug-nodeps
|
||||
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||
ramdisk_debug-nodeps: PRIVATE_ADDITIONAL_DIR := $(TARGET_RECOVERY_ROOT_OUT)
|
||||
else
|
||||
ramdisk_debug-nodeps: PRIVATE_ADDITIONAL_DIR := $(TARGET_RAMDISK_OUT)
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT
|
||||
ramdisk_debug-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
|
||||
echo "make $@: ignoring dependencies"
|
||||
mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
|
||||
mkdir -p $(TARGET_DEBUG_RAMDISK_OUT) $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR)
|
||||
touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
|
||||
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_DEBUG_RAMDISK_OUT) $(PRIVATE_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
||||
|
||||
endif # BUILDING_DEBUG_BOOT_IMAGE || BUILDING_DEBUG_VENDOR_BOOT_IMAGE
|
||||
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_DEBUG_RAMDISK_OUT) $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# the boot-debug.img, which is the kernel plus ramdisk-debug.img
|
||||
|
@ -2365,10 +2354,11 @@ else
|
|||
endif
|
||||
|
||||
# Replace ramdisk.img in $(MKBOOTIMG) ARGS with ramdisk-debug.img to build boot-debug.img
|
||||
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
||||
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||
INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(recovery_ramdisk),$(INSTALLED_DEBUG_RAMDISK_TARGET), $(INTERNAL_RECOVERYIMAGE_ARGS))
|
||||
INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DEP),$(INSTALLED_DEBUG_RAMDISK_TARGET),$(INTERNAL_RECOVERYIMAGE_ARGS))
|
||||
else
|
||||
INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(INSTALLED_RAMDISK_TARGET),$(INSTALLED_DEBUG_RAMDISK_TARGET), $(INTERNAL_BOOTIMAGE_ARGS))
|
||||
INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DEP),$(INSTALLED_DEBUG_RAMDISK_TARGET),$(INTERNAL_BOOTIMAGE_ARGS))
|
||||
endif
|
||||
|
||||
# If boot.img is chained but boot-debug.img is not signed, libavb in bootloader
|
||||
|
@ -2402,7 +2392,7 @@ define build-debug-bootimage-target
|
|||
endef
|
||||
|
||||
# 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) $(BOARD_GKI_SIGNING_KEY_PATH) $(AVBTOOL)
|
||||
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_BOOTIMAGE_TARGET) $(BOARD_GKI_SIGNING_KEY_PATH) $(AVBTOOL)
|
||||
$(call pretty,"Target boot debug image: $@")
|
||||
$(call build-debug-bootimage-target, $@)
|
||||
|
||||
|
@ -2492,10 +2482,7 @@ endif # BUILDING_DEBUG_VENDOR_BOOT_IMAGE
|
|||
# -----------------------------------------------------------------
|
||||
# The test harness ramdisk, which is based off debug_ramdisk, plus a
|
||||
# few additional test-harness-specific properties in adb_debug.prop.
|
||||
ifneq ($(BUILDING_DEBUG_BOOT_IMAGE)$(BUILDING_DEBUG_VENDOR_BOOT_IMAGE),)
|
||||
|
||||
BUILT_TEST_HARNESS_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-test-harness.img
|
||||
INSTALLED_TEST_HARNESS_RAMDISK_TARGET := $(BUILT_TEST_HARNESS_RAMDISK_TARGET)
|
||||
INSTALLED_TEST_HARNESS_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-test-harness.img
|
||||
|
||||
# Appends a few test harness specific properties into the adb_debug.prop.
|
||||
TEST_HARNESS_PROP_TARGET := $(TARGET_TEST_HARNESS_RAMDISK_OUT)/adb_debug.prop
|
||||
|
@ -2515,38 +2502,22 @@ INTERNAL_TEST_HARNESS_RAMDISK_FILES := $(filter $(TARGET_TEST_HARNESS_RAMDISK_OU
|
|||
$(ALL_GENERATED_SOURCES) \
|
||||
$(ALL_DEFAULT_INSTALLED_MODULES))
|
||||
|
||||
# ramdisk-test-harness.img will merge the content from either ramdisk.img or
|
||||
# ramdisk-recovery.img, depending on whether BOARD_USES_RECOVERY_AS_BOOT is set
|
||||
# or not.
|
||||
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): PRIVATE_ADDITIONAL_DIR := $(TARGET_RECOVERY_ROOT_OUT)
|
||||
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(recovery_ramdisk)
|
||||
else
|
||||
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): PRIVATE_ADDITIONAL_DIR := $(TARGET_RAMDISK_OUT)
|
||||
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(INSTALLED_RAMDISK_TARGET)
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT
|
||||
|
||||
# The test harness ramdisk will rsync the files from the debug ramdisk, then appends some props.
|
||||
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(INSTALLED_DEBUG_RAMDISK_TARGET)
|
||||
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DEP)
|
||||
$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_TEST_HARNESS_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
|
||||
$(call pretty,"Target test harness ramdisk: $@")
|
||||
rsync --chmod=u+w -a $(TARGET_DEBUG_RAMDISK_OUT)/ $(TARGET_TEST_HARNESS_RAMDISK_OUT)
|
||||
$(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
|
||||
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_TEST_HARNESS_RAMDISK_OUT) $(PRIVATE_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $@
|
||||
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_TEST_HARNESS_RAMDISK_OUT) $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $@
|
||||
|
||||
.PHONY: ramdisk_test_harness-nodeps
|
||||
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
|
||||
ramdisk_test_harness-nodeps: PRIVATE_ADDITIONAL_DIR := $(TARGET_RECOVERY_ROOT_OUT)
|
||||
else
|
||||
ramdisk_test_harness-nodeps: PRIVATE_ADDITIONAL_DIR := $(TARGET_RAMDISK_OUT)
|
||||
endif # BOARD_USES_RECOVERY_AS_BOOT
|
||||
ramdisk_test_harness-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
|
||||
echo "make $@: ignoring dependencies"
|
||||
rsync --chmod=u+w -a $(TARGET_DEBUG_RAMDISK_OUT)/ $(TARGET_TEST_HARNESS_RAMDISK_OUT)
|
||||
$(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
|
||||
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_TEST_HARNESS_RAMDISK_OUT) $(PRIVATE_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
|
||||
|
||||
endif # BUILDING_DEBUG_BOOT_IMAGE || BUILDING_DEBUG_VENDOR_BOOT_IMAGE
|
||||
mkdir -p $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR)
|
||||
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_TEST_HARNESS_RAMDISK_OUT) $(INTERNAL_DEBUG_RAMDISK_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# the boot-test-harness.img, which is the kernel plus ramdisk-test-harness.img
|
||||
|
@ -2639,6 +2610,8 @@ $(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET): $(INTERNAL_VENDOR_RAMDISK_FRA
|
|||
|
||||
endif # BUILDING_DEBUG_VENDOR_BOOT_IMAGE
|
||||
|
||||
endif # BUILDING_DEBUG_BOOT_IMAGE || BUILDING_DEBUG_VENDOR_BOOT_IMAGE
|
||||
|
||||
|
||||
# Creates a compatibility symlink between two partitions, e.g. /system/vendor to /vendor
|
||||
# $1: from location (e.g $(TARGET_OUT)/vendor)
|
||||
|
|
Loading…
Reference in a new issue