summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYicheng Li <yichengli@chromium.org>2019-08-01 13:16:23 -0700
committerCommit Bot <commit-bot@chromium.org>2019-08-17 00:42:42 +0000
commitdf805d082e0272060d2761bfb065b8421a8eabd9 (patch)
treed77032197fbc178efd3f16ca9cdc5000977293ef
parent46fe2ab0e39bf5da7165e4d65a688d6afe273613 (diff)
downloadchrome-ec-stabilize-kernelnext-broadwell-12434.B.tar.gz
common: Prepare always_memset()stabilize-kernelnext-broadwell-12434.B
Add a config for using always_memset() from third_party/cryptoc BRANCH=nocturne BUG=chromium:968809,chromium:989594,b:130238794 TEST=make -j buildall Change-Id: I22c83512eb1b8bdc8dac1b26315d25b65831513c Signed-off-by: Yicheng Li <yichengli@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1731543 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r--board/hatch_fp/board.h2
-rw-r--r--board/nocturne_fp/board.h2
-rw-r--r--common/build.mk16
-rw-r--r--include/config.h6
4 files changed, 26 insertions, 0 deletions
diff --git a/board/hatch_fp/board.h b/board/hatch_fp/board.h
index c8b8bc726e..d51f57a7fb 100644
--- a/board/hatch_fp/board.h
+++ b/board/hatch_fp/board.h
@@ -165,6 +165,8 @@
#define CONFIG_RNG
+#define CONFIG_ALWAYS_MEMSET
+
#define CONFIG_CMD_FLASH
#define CONFIG_CMD_SPI_XFER
diff --git a/board/nocturne_fp/board.h b/board/nocturne_fp/board.h
index 82fa7805b7..4b0a3a5426 100644
--- a/board/nocturne_fp/board.h
+++ b/board/nocturne_fp/board.h
@@ -150,6 +150,8 @@
#define CONFIG_RNG
+#define CONFIG_ALWAYS_MEMSET
+
#define CONFIG_CMD_FLASH
#define CONFIG_CMD_SPI_XFER
diff --git a/common/build.mk b/common/build.mk
index ba8432b252..63e5d052dc 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -240,6 +240,22 @@ $(out)/rma_key_from_blob.h: board/$(BOARD)/$(BLOB_FILE) util/bin2h.sh
endif
+ifeq ($(CONFIG_ALWAYS_MEMSET),y)
+CRYPTOCLIB := $(realpath ../../third_party/cryptoc)
+CPPFLAGS += -I$(abspath ./builtin)
+CPPFLAGS += -I$(CRYPTOCLIB)/include
+
+CRYPTOC_OBJS = $(shell find $(out)/cryptoc -name 'util.o')
+$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: LDFLAGS_EXTRA += $(CRYPTOC_OBJS)
+$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: cryptoc_objs
+
+# Force the external build each time, so it can look for changed sources.
+.PHONY: cryptoc_objs
+cryptoc_objs:
+ $(MAKE) obj=$(realpath $(out))/cryptoc SUPPORT_UNALIGNED=1 \
+ CONFIG_UPTO_SHA512=$(CONFIG_UPTO_SHA512) -C $(CRYPTOCLIB) objs
+endif
+
include $(_common_dir)fpsensor/build.mk
include $(_common_dir)usbc/build.mk
diff --git a/include/config.h b/include/config.h
index 867b3a5dca..832f1a740a 100644
--- a/include/config.h
+++ b/include/config.h
@@ -299,6 +299,12 @@
/* Define which ALS sensor is used for dimming the lightbar when dark */
#undef CONFIG_ALS_LIGHTBAR_DIMMING
+/*
+ * Support always_memset() defined in third_party/cryptoc, which will not be
+ * optimized out by compiler.
+ */
+#undef CONFIG_ALWAYS_MEMSET
+
/* Support AP hang detection host command and state machine */
#undef CONFIG_AP_HANG_DETECT