summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJes B. Klinke <jbk@chromium.org>2023-01-20 23:17:42 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-23 21:32:52 +0000
commit0b792be20290643e19326df758f818e337244d8e (patch)
treec81e785cd7464c0a1635dd9b4bb592587caeb845
parentf6b1cc27cd267919218dc7727bd87dbc874d5d2e (diff)
downloadchrome-ec-0b792be20290643e19326df758f818e337244d8e.tar.gz
common/build.mk: Allow shmalloc/shared_mem in RW when using DFU
CONFIG_MALLOC can ordinarily be used to control whether shmalloc.o or shared_mem.o is linked, with the latter being the automatic default is CONFIG_MALLOC is disabled in either or both of RO and RW. CONFIG_DFU_BOOTMANAGER_MAIN was introduced, allowing the RO stage to be completely replaced by a 4Kb bootloader, but it had the unintended side effect that NEITHER shmalloc.o nor shared_mem.o will be linked with the RW stage. Thic change makes it such that of of the shared memory files are linked into the RW stage, depending on the setting of CONFIG_MALLOC. BUG=b:192262089 TEST=make BOARD=hyperdebug Change-Id: Ie21ffb772447d4817632210656f9820bfad4946a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4183954 Reviewed-by: Brian Nemec <bnemec@google.com> Commit-Queue: Jes Klinke <jbk@chromium.org> Tested-by: Jes Klinke <jbk@chromium.org>
-rw-r--r--common/build.mk12
1 files changed, 11 insertions, 1 deletions
diff --git a/common/build.mk b/common/build.mk
index 222370326a..6b3e7db25c 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -225,7 +225,17 @@ common-$(CONFIG_AUDIO_CODEC_WOV)+=hotword_dsp_api.o
endif
ifneq ($(CONFIG_COMMON_RUNTIME),)
-ifneq ($(CONFIG_DFU_BOOTMANAGER_MAIN),ro)
+ifeq ($(CONFIG_DFU_BOOTMANAGER_MAIN),ro)
+# Ordinary RO is replaced with DFU bootloader stub, CONFIG_MALLOC should only affect RW.
+ifeq ($(CONFIG_MALLOC),y)
+common-rw+=shmalloc.o
+else ifeq ($(CONFIG_MALLOC),rw)
+common-rw+=shmalloc.o
+else
+common-rw+=shared_mem.o
+endif
+else
+# CONFIG_MALLOC affects both RO and RW as usual (with shared_mem in case it is disabled.)
common-$(CONFIG_MALLOC)+=shmalloc.o
common-$(call not_cfg,$(CONFIG_MALLOC))+=shared_mem.o
endif