Merge "Replace product variable stashing with .KATI_READONLY"
This commit is contained in:
commit
157ad04cfc
4 changed files with 21 additions and 45 deletions
|
@ -522,12 +522,10 @@ endif
|
|||
|
||||
INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
|
||||
|
||||
BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
|
||||
ifdef BOARD_KERNEL_BASE
|
||||
INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
|
||||
endif
|
||||
|
||||
BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
|
||||
ifdef BOARD_KERNEL_PAGESIZE
|
||||
INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
|
||||
endif
|
||||
|
@ -539,9 +537,9 @@ VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCTS.$(INTERNAL_PRODUCT).
|
|||
endif
|
||||
endif
|
||||
|
||||
BOARD_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
|
||||
ifdef BOARD_KERNEL_CMDLINE
|
||||
INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
|
||||
INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
|
||||
ifdef INTERNAL_KERNEL_CMDLINE
|
||||
INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
|
||||
endif
|
||||
|
||||
INTERNAL_MKBOOTIMG_VERSION_ARGS := \
|
||||
|
@ -632,6 +630,7 @@ endif # TARGET_BOOTIMAGE_USE_EXT2
|
|||
endif # BOARD_USES_RECOVERY_AS_BOOT
|
||||
|
||||
else # TARGET_NO_KERNEL
|
||||
INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
|
||||
# HACK: The top-level targets depend on the bootimage. Not all targets
|
||||
# can produce a bootimage, though, and emulator targets need the ramdisk
|
||||
# instead. Fake it out by calling the ramdisk the bootimage.
|
||||
|
@ -977,13 +976,12 @@ INTERNAL_RECOVERYIMAGE_ARGS := \
|
|||
--ramdisk $(recovery_ramdisk)
|
||||
|
||||
# Assumes this has already been stripped
|
||||
ifdef BOARD_KERNEL_CMDLINE
|
||||
INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(BOARD_KERNEL_CMDLINE)"
|
||||
ifdef INTERNAL_KERNEL_CMDLINE
|
||||
INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
|
||||
endif
|
||||
ifdef BOARD_KERNEL_BASE
|
||||
INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
|
||||
endif
|
||||
BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
|
||||
ifdef BOARD_KERNEL_PAGESIZE
|
||||
INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
|
||||
endif
|
||||
|
@ -1346,7 +1344,7 @@ define build-boottarball-target
|
|||
$(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
|
||||
$(hide) mkdir -p $(PRODUCT_OUT)/boot
|
||||
$(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
|
||||
$(hide) echo $(BOARD_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
|
||||
$(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
|
||||
$(hide) $(MKTARBALL) $(FS_GET_STATS) \
|
||||
$(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
|
||||
$(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
|
||||
|
@ -1812,8 +1810,8 @@ ifdef INSTALLED_2NDBOOTLOADER_TARGET
|
|||
$(hide) $(ACP) \
|
||||
$(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
|
||||
endif
|
||||
ifdef BOARD_KERNEL_CMDLINE
|
||||
$(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
|
||||
ifdef INTERNAL_KERNEL_CMDLINE
|
||||
$(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
|
||||
endif
|
||||
ifdef BOARD_KERNEL_BASE
|
||||
$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
|
||||
|
@ -1841,8 +1839,8 @@ ifdef INSTALLED_2NDBOOTLOADER_TARGET
|
|||
$(hide) $(ACP) \
|
||||
$(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
|
||||
endif
|
||||
ifdef BOARD_KERNEL_CMDLINE
|
||||
$(hide) echo "$(BOARD_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
|
||||
ifdef INTERNAL_KERNEL_CMDLINE
|
||||
$(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
|
||||
endif
|
||||
ifdef BOARD_KERNEL_BASE
|
||||
$(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
|
||||
|
|
|
@ -216,6 +216,9 @@ ifeq ($(TARGET_CPU_ABI),)
|
|||
endif
|
||||
TARGET_CPU_ABI2 := $(strip $(TARGET_CPU_ABI2))
|
||||
|
||||
BOARD_KERNEL_BASE := $(strip $(BOARD_KERNEL_BASE))
|
||||
BOARD_KERNEL_PAGESIZE := $(strip $(BOARD_KERNEL_PAGESIZE))
|
||||
|
||||
# Commands to generate .toc file common to ELF .so files.
|
||||
define _gen_toc_command_for_elf
|
||||
$(hide) ($($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)READELF) -d $(1) | grep SONAME || echo "No SONAME for $1") > $(2)
|
||||
|
|
13
core/main.mk
13
core/main.mk
|
@ -504,12 +504,9 @@ endif
|
|||
|
||||
FULL_BUILD := true
|
||||
|
||||
# Before we go and include all of the module makefiles, stash away
|
||||
# the PRODUCT_* values so that later we can verify they are not modified.
|
||||
stash_product_vars:=true
|
||||
ifeq ($(stash_product_vars),true)
|
||||
$(call stash-product-vars, __STASHED)
|
||||
endif
|
||||
# Before we go and include all of the module makefiles, mark the PRODUCT_*
|
||||
# values readonly so that they won't be modified.
|
||||
$(call readonly-product-vars)
|
||||
|
||||
ifneq ($(ONE_SHOT_MAKEFILE),)
|
||||
# We've probably been invoked by the "mm" shell function
|
||||
|
@ -574,10 +571,6 @@ endif # ONE_SHOT_MAKEFILE
|
|||
# Now with all Android.mks loaded we can do post cleaning steps.
|
||||
include $(BUILD_SYSTEM)/post_clean.mk
|
||||
|
||||
ifeq ($(stash_product_vars),true)
|
||||
$(call assert-product-vars, __STASHED)
|
||||
endif
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# All module makefiles have been included at this point.
|
||||
# -------------------------------------------------------------------
|
||||
|
|
|
@ -296,33 +296,15 @@ _product_stash_var_list += \
|
|||
GLOBAL_CLANG_CFLAGS_NO_OVERRIDE \
|
||||
|
||||
#
|
||||
# Stash values of the variables in _product_stash_var_list.
|
||||
# $(1): Renamed prefix
|
||||
# Mark the variables in _product_stash_var_list as readonly
|
||||
#
|
||||
define stash-product-vars
|
||||
define readonly-product-vars
|
||||
$(foreach v,$(_product_stash_var_list), \
|
||||
$(eval $(strip $(1))_rot26_$(v):=$$($$(v))) \
|
||||
$(eval $(v) ?=) \
|
||||
$(eval .KATI_READONLY := $(v)) \
|
||||
)
|
||||
endef
|
||||
|
||||
#
|
||||
# Assert that the the variable stashed by stash-product-vars remains untouched.
|
||||
# $(1): The prefix as supplied to stash-product-vars
|
||||
#
|
||||
define assert-product-vars
|
||||
$(strip \
|
||||
$(eval changed_variables:=)
|
||||
$(foreach v,$(_product_stash_var_list), \
|
||||
$(if $(call streq,$($(v)),$($(strip $(1))_rot26_$(v))),, \
|
||||
$(eval $(warning $(v) has been modified: $($(v)))) \
|
||||
$(eval $(warning previous value: $($(strip $(1))_$(call rot13,$(v))))) \
|
||||
$(eval changed_variables := $(changed_variables) $(v))) \
|
||||
) \
|
||||
$(if $(changed_variables),\
|
||||
$(eval $(error The following variables have been changed: $(changed_variables))),)
|
||||
)
|
||||
endef
|
||||
|
||||
define add-to-product-copy-files-if-exists
|
||||
$(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
|
||||
endef
|
||||
|
|
Loading…
Reference in a new issue