diff options
author | Yicheng Li <yichengli@chromium.org> | 2019-08-21 17:18:06 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-08-23 18:52:49 +0000 |
commit | 5ce0aa26c41ea0d6f0c22deaa2233ca4552797f0 (patch) | |
tree | 881e92111fc417bf2b0d1267155c76311959fbae /common/build.mk | |
parent | a06dc0b52c6415eabc3a5d46357894bbe6416a17 (diff) | |
download | chrome-ec-5ce0aa26c41ea0d6f0c22deaa2233ca4552797f0.tar.gz |
common: Add CONFIG_LIBCRYPTOC to enable third_party/cryptoc
Boards that have CONFIG_LIBCRYPTOC will be able to use functions in
third_party/cryptoc. Functions in third_party/cryptoc that are not
called will not be linked because of linker optimization. This can be
verified by checking the "smap" file in the build directory for a
given target (e.g. build/nocturne_fp/RW/ec.RW.smap), which contains a
list of all symbols in the target. Configure CONFIG_LIBCRYPTOC in
nocturne_fp and hatch_fp. This config replaces CONFIG_ALWAYS_MEMSET.
BRANCH=nocturne
BUG=chromium:968809,chromium:989594,b:130238794
TEST=make -j buildall
Change-Id: Ia40da9fb429f9d03623bc92e25f6670e5cdbd983
Signed-off-by: Yicheng Li <yichengli@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1764835
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'common/build.mk')
-rw-r--r-- | common/build.mk | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/common/build.mk b/common/build.mk index 87534a175b..a5af9a3a5e 100644 --- a/common/build.mk +++ b/common/build.mk @@ -241,20 +241,26 @@ $(out)/rma_key_from_blob.h: board/$(BOARD)/$(BLOB_FILE) util/bin2h.sh endif -ifeq ($(CONFIG_ALWAYS_MEMSET),y) +ifeq ($(CONFIG_LIBCRYPTOC),y) CRYPTOCLIB := $(realpath ../../third_party/cryptoc) +ifneq ($(BOARD),host) CPPFLAGS += -I$(abspath ./builtin) +endif 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 +CRYPTOC_LDFLAGS := -L$(out)/cryptoc -lcryptoc # Force the external build each time, so it can look for changed sources. -.PHONY: cryptoc_objs -cryptoc_objs: +.PHONY: $(out)/cryptoc/libcryptoc.a +$(out)/cryptoc/libcryptoc.a: $(MAKE) obj=$(realpath $(out))/cryptoc SUPPORT_UNALIGNED=1 \ - CONFIG_UPTO_SHA512=$(CONFIG_UPTO_SHA512) -C $(CRYPTOCLIB) objs + CONFIG_UPTO_SHA512=$(CONFIG_UPTO_SHA512) -C $(CRYPTOCLIB) + +# Link RW against cryptoc. +$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS) +$(out)/RW/ec.RW.elf $(out)/RW/ec.RW_B.elf: $(out)/cryptoc/libcryptoc.a +# Host test executables (including fuzz tests). +$(out)/$(PROJECT).exe: LDFLAGS_EXTRA += $(CRYPTOC_LDFLAGS) +$(out)/$(PROJECT).exe: $(out)/cryptoc/libcryptoc.a endif include $(_common_dir)fpsensor/build.mk |