From dc65233ded51803c54b72bdb137ef0685f2e43a8 Mon Sep 17 00:00:00 2001 From: Yicheng Li Date: Tue, 3 Dec 2019 15:27:16 -0800 Subject: chip/host: Avoid concurrent recipes of libcryptoc.a CONFIG_DCRYPTO compiles and links thirdparty/libcryptoc for cr50. CONFIG_LIBCRYPTOC does similar things for other boards that configures it, including host. This resulted in cr50_fuzz having concurrent recipes for libcryptoc, as it has both configs. This change separates CONFIG_DCRYPTO from the responsibility of building and linking libcryptoc. Libcryptoc is now solely handles by CONFIG_LIBCRYPTOC. BRANCH=none BUG=b:144811298 TEST=make -j buildall > /dev/null Observed no more "warning: overriding recipe for target 'build/host/cr50_fuzz/cryptoc/libcryptoc.a' " Change-Id: I2186cbead773629456da254df5f82b96e9646fc2 Signed-off-by: Yicheng Li Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1949554 Reviewed-by: Vadim Bendebury (cherry picked from commit a018043265ecb3466863ff9020ab25d552105c61) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1956404 Tested-by: Vadim Bendebury Commit-Queue: Vadim Bendebury --- chip/g/build.mk | 16 ---------------- chip/g/config_chip.h | 3 +++ chip/host/build.mk | 12 ------------ common/build.mk | 1 + 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/chip/g/build.mk b/chip/g/build.mk index 2cbfc3b857..a46a6e8c55 100644 --- a/chip/g/build.mk +++ b/chip/g/build.mk @@ -9,12 +9,10 @@ CFLAGS_CPU+=-march=armv7-m -mcpu=cortex-m3 ifeq ($(CONFIG_DCRYPTO),y) INCLUDE_ROOT := $(abspath ./include) -CRYPTOCLIB := $(realpath ../../third_party/cryptoc) CPPFLAGS += -I$(abspath .) CPPFLAGS += -I$(abspath ./builtin) CPPFLAGS += -I$(abspath ./chip/$(CHIP)) CPPFLAGS += -I$(INCLUDE_ROOT) -CPPFLAGS += -I$(CRYPTOCLIB)/include endif # Required chip modules @@ -230,18 +228,4 @@ ifneq ($(CHIP_MK_INCLUDED_ONCE),) $(out)/RW/ec.RW_B.flat: $(out)/RW/ec.RW.flat $(out)/RW/ec.RW.flat $(out)/RW/ec.RW_B.flat: SIGNER_EXTRAS = $(RW_SIGNER_EXTRAS) -ifeq ($(CONFIG_DCRYPTO),y) - -CRYPTOC_OBJS = $(shell find $(out)/cryptoc -name '*.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 # end CONFIG_DCRYPTO - endif # CHIP_MK_INCLUDED_ONCE is nonempty diff --git a/chip/g/config_chip.h b/chip/g/config_chip.h index f7ef934c0d..7c60567dfc 100644 --- a/chip/g/config_chip.h +++ b/chip/g/config_chip.h @@ -159,4 +159,7 @@ #define CONFIG_FLASH_LOG_BASE \ (CONFIG_PROGRAM_MEMORY_BASE + CHIP_RO_B_MEM_OFF + CONFIG_RO_SIZE - \ CONFIG_FLASH_LOG_SPACE) + +/* Use software crypto (libcryptoc). */ +#define CONFIG_LIBCRYPTOC #endif /* __CROS_EC_CONFIG_CHIP_H */ diff --git a/chip/host/build.mk b/chip/host/build.mk index 12b10dba16..f57fe85502 100644 --- a/chip/host/build.mk +++ b/chip/host/build.mk @@ -28,15 +28,3 @@ chip-$(CONFIG_DCRYPTO)+= dcrypto/sha256.o # Object files that can be shared with the Cr50 dcrypto implementation chip-$(CONFIG_DCRYPTO)+= ../g/dcrypto/hmac.o - -ifeq ($(CONFIG_DCRYPTO),y) -CRYPTOCLIB := $(realpath ../../third_party/cryptoc) - -# Force the external build each time, so it can look for changed sources. -.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) - -CPPFLAGS += -I$(CRYPTOCLIB)/include -endif # end CONFIG_DCRYPTO diff --git a/common/build.mk b/common/build.mk index 7ee4e102a4..4aa8dc3abd 100644 --- a/common/build.mk +++ b/common/build.mk @@ -250,6 +250,7 @@ $(out)/rma_key_from_blob.h: board/$(BOARD)/$(BLOB_FILE) util/bin2h.sh endif +# Build and link against libcryptoc. ifeq ($(CONFIG_LIBCRYPTOC),y) CRYPTOCLIB := $(realpath ../../third_party/cryptoc) ifneq ($(BOARD),host) -- cgit v1.2.1