summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2018-01-25 10:24:57 +0100
committerchrome-bot <chrome-bot@chromium.org>2018-01-26 13:25:49 -0800
commit17014655511d0b2b254d5f1f58e3e0f471694a41 (patch)
tree6ed54b8b804d5069c42d77e1fd2636f905c54bb0
parent9b7b5460d2ccfdf6cc28ea8115a6bd6be2496141 (diff)
downloadchrome-ec-17014655511d0b2b254d5f1f58e3e0f471694a41.tar.gz
Make CONFIG_MALLOC partition-specific
Allow to have CONFIG_MALLOC defined for one partition and not the other. The typical use-case is asymetric firmware whose small RO is typically just an updater/verifier (and RW signature verification currently doesn't like malloc as the memory initialization is done too late). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:72360575 TEST=make buildall Change-Id: I67cc04cd11385d4c05556ea41ef674cb7a232e65 Reviewed-on: https://chromium-review.googlesource.com/885820 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--Makefile8
-rw-r--r--common/build.mk7
2 files changed, 11 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index feb72fcfed..0df7553f22 100644
--- a/Makefile
+++ b/Makefile
@@ -47,6 +47,14 @@ include Makefile.toolchain
.PHONY: all
all:
+# Returns the opposite of a configuration variable
+# y ->
+# ro -> rw
+# rw -> ro
+# -> y
+# usage: common-$(call not_cfg,$(CONFIG_FOO))+=bar.o
+not_cfg = $(subst ro rw,y,$(filter-out $(1:y=ro rw),ro rw))
+
# The board makefile sets $CHIP and the chip makefile sets $CORE.
# Include those now, since they must be defined for _flag_cfg below.
include $(BDIR)/build.mk
diff --git a/common/build.mk b/common/build.mk
index 7b70378541..1adbaafb92 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -134,10 +134,9 @@ common-$(HAS_TASK_LIGHTBAR)+=lb_common.o lightbar.o
common-$(HAS_TASK_MOTIONSENSE)+=motion_sense.o
common-$(HAS_TASK_TPM)+=tpm_registers.o
-ifeq ($(CONFIG_MALLOC),y)
-common-$(CONFIG_COMMON_RUNTIME)+=shmalloc.o
-else
-common-$(CONFIG_COMMON_RUNTIME)+=shared_mem.o
+ifneq ($(CONFIG_COMMON_RUNTIME),)
+common-$(CONFIG_MALLOC)+=shmalloc.o
+common-$(call not_cfg,$(CONFIG_MALLOC))+=shared_mem.o
endif
ifeq ($(CTS_MODULE),)