diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2016-08-02 14:28:26 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2016-08-04 17:18:38 +0200 |
commit | 8ff24803a36d0fd7e02dc558141f5a3966815da5 (patch) | |
tree | 53458360eef36d46622ad71c3b69eeb9fd1c3655 /src/ec/google | |
parent | 5690f0e6d817987bb66ab681c01447cc1b55776a (diff) | |
download | coreboot-8ff24803a36d0fd7e02dc558141f5a3966815da5.tar.xz |
chromeec: Chrome EC firmware source selection for EC and PD firmwares
In some cases, we don't want the Chrome EC firmwares (both EC and PD)
built directly by the coreboot build system or included in images at
all. This is already supported with EC_EXTERNAL_FIRMWARE but it does
implement a binary (build and include) or (neither build nor include)
policy.
Some cases require the ability to separately control whether the EC
and PD firmwares should be built and included by the coreboot build
system, only included from externally-built images or not included
at all.
This introduces config changes implementing that behaviour, renaming
options to make it clear that they are specific to the Chrome EC.
Change-Id: I44ccee715419360eb7d83863f4f134fcda14a8e4
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-on: https://review.coreboot.org/16033
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/ec/google')
-rw-r--r-- | src/ec/google/chromeec/Kconfig | 72 | ||||
-rw-r--r-- | src/ec/google/chromeec/Makefile.inc | 61 |
2 files changed, 106 insertions, 27 deletions
diff --git a/src/ec/google/chromeec/Kconfig b/src/ec/google/chromeec/Kconfig index 4d5de32929..f4ff30372c 100644 --- a/src/ec/google/chromeec/Kconfig +++ b/src/ec/google/chromeec/Kconfig @@ -74,16 +74,8 @@ config EC_GOOGLE_CHROMEEC_SPI_CHIP hex default 0 -config EC_EXTERNAL_FIRMWARE - depends on EC_GOOGLE_CHROMEEC - bool "Disable building EC firmware" - default n - help - Disable building EC firmware if it's already built externally (and - added manually.) - config EC_GOOGLE_CHROMEEC_BOARDNAME - depends on EC_GOOGLE_CHROMEEC && !EC_EXTERNAL_FIRMWARE + depends on EC_GOOGLE_CHROMEEC string "Chrome EC board name for EC" default "" help @@ -92,7 +84,7 @@ config EC_GOOGLE_CHROMEEC_BOARDNAME build the EC firmware and add it to the image. config EC_GOOGLE_CHROMEEC_PD_BOARDNAME - depends on EC_GOOGLE_CHROMEEC_PD && !EC_EXTERNAL_FIRMWARE + depends on EC_GOOGLE_CHROMEEC_PD string "Chrome EC board name for PD" default "" help @@ -106,3 +98,63 @@ config EC_GOOGLE_CHROMEEC_RTC help Enable support for the real-time clock on the Chrome OS EC. This uses the EC_CMD_RTC_GET_VALUE command to read the current time. + +choice + prompt "Chrome EC firmware source" + depends on EC_GOOGLE_CHROMEEC + default EC_GOOGLE_CHROMEEC_FIRMWARE_BUILTIN if EC_GOOGLE_CHROMEEC_BOARDNAME != "" + default EC_GOOGLE_CHROMEEC_FIRMWARE_NONE + + config EC_GOOGLE_CHROMEEC_FIRMWARE_NONE + bool "No EC firmware is included" + help + Disable building and including any EC firmware in the image. + + config EC_GOOGLE_CHROMEEC_FIRMWARE_EXTERNAL + bool "External EC firmware is included" + help + Include EC firmware binary in the image from an external source. + It is expected to be built externally. + + config EC_GOOGLE_CHROMEEC_FIRMWARE_BUILTIN + bool "Builtin EC firmware is included" + help + Build and include EC firmware binary in the image. + +endchoice + +config EC_GOOGLE_CHROMEEC_FIRMWARE_FILE + string "Chrome EC firmware path and filename" + depends on EC_GOOGLE_CHROMEEC_FIRMWARE_EXTERNAL + help + The path and filename of the EC firmware file to use. + +choice + prompt "Chrome EC firmware source for PD" + depends on EC_GOOGLE_CHROMEEC_PD + default EC_GOOGLE_CHROMEEC_PD_FIRMWARE_BUILTIN if EC_GOOGLE_CHROMEEC_PD_BOARDNAME != "" + default EC_GOOGLE_CHROMEEC_PD_FIRMWARE_NONE + + config EC_GOOGLE_CHROMEEC_PD_FIRMWARE_NONE + bool "No PD firmware is included" + help + Disable building and including any PD firmware in the image. + + config EC_GOOGLE_CHROMEEC_PD_FIRMWARE_EXTERNAL + bool "External PD firmware is included" + help + Include PD firmware binary in the image from an external source. + It is expected to be built externally. + + config EC_GOOGLE_CHROMEEC_PD_FIRMWARE_BUILTIN + bool "Builtin PD firmware is included" + help + Build and include PD firmware binary in the image. + +endchoice + +config EC_GOOGLE_CHROMEEC_PD_FIRMWARE_FILE + string "Chrome EC firmware path and filename for PD" + depends on EC_GOOGLE_CHROMEEC_PD_FIRMWARE_EXTERNAL + help + The path and filename of the PD firmware file to use. diff --git a/src/ec/google/chromeec/Makefile.inc b/src/ec/google/chromeec/Makefile.inc index 761ab7f587..66f3a887e1 100644 --- a/src/ec/google/chromeec/Makefile.inc +++ b/src/ec/google/chromeec/Makefile.inc @@ -29,34 +29,31 @@ smm-$(CONFIG_VBOOT) += vboot_storage.c romstage-$(CONFIG_VBOOT) += vboot_storage.c verstage-$(CONFIG_VBOOT) += vboot_storage.c -ifneq ($(CONFIG_EC_EXTERNAL_FIRMWARE),y) +CHROMEEC_SOURCE ?= $(top)/3rdparty/chromeec + # These are Chrome EC firmware images that a payload (such as depthcharge) can # use to update the EC. ecrw is the main embedded controller's firmware, # pdrw is for a USB PD controller. -CONFIG_EC_GOOGLE_CHROMEEC_BOARDNAME := $(call strip_quotes,$(CONFIG_EC_GOOGLE_CHROMEEC_BOARDNAME)) -CONFIG_EC_GOOGLE_CHROMEEC_PD_BOARDNAME := $(call strip_quotes,$(CONFIG_EC_GOOGLE_CHROMEEC_PD_BOARDNAME)) -cbfs-files-$(if $(CONFIG_EC_GOOGLE_CHROMEEC_BOARDNAME),y) += ecrw +ifneq ($(CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_NONE),y) + +cbfs-files-y += ecrw ecrw-file := $(obj)/mainboard/$(MAINBOARDDIR)/ecrw ecrw-name := ecrw ecrw-type := raw ecrw-compression := $(CBFS_COMPRESS_FLAG) -cbfs-files-$(if $(CONFIG_EC_GOOGLE_CHROMEEC_BOARDNAME),y) += ecrw.hash +cbfs-files-y += ecrw.hash ecrw.hash-file := $(obj)/mainboard/$(MAINBOARDDIR)/ecrw.hash ecrw.hash-name := ecrw.hash ecrw.hash-type := raw -cbfs-files-$(if $(CONFIG_EC_GOOGLE_CHROMEEC_PD_BOARDNAME),y) += pdrw -pdrw-file := $(obj)/mainboard/$(MAINBOARDDIR)/pdrw -pdrw-name := pdrw -pdrw-type := raw -pdrw-compression := $(CBFS_COMPRESS_FLAG) -cbfs-files-$(if $(CONFIG_EC_GOOGLE_CHROMEEC_PD_BOARDNAME),y) += pdrw.hash -pdrw.hash-file := $(obj)/mainboard/$(MAINBOARDDIR)/pdrw.hash -pdrw.hash-name := pdrw.hash -pdrw.hash-type := raw +ifeq ($(CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_EXTERNAL),y) +CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE := $(call strip_quotes,$(CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE)) -CHROMEEC_SOURCE ?= $(top)/3rdparty/chromeec +$(obj)/mainboard/$(MAINBOARDDIR)/ecrw: $(CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE) + cp $(CONFIG_EC_GOOGLE_CHROMEEC_FIRMWARE_FILE) $@ +else +CONFIG_EC_GOOGLE_CHROMEEC_BOARDNAME := $(call strip_quotes,$(CONFIG_EC_GOOGLE_CHROMEEC_BOARDNAME)) $(obj)/mainboard/$(MAINBOARDDIR)/ecrw: $(MAKE) -C $(CHROMEEC_SOURCE) \ @@ -66,6 +63,34 @@ $(obj)/mainboard/$(MAINBOARDDIR)/ecrw: BOARD=$(CONFIG_EC_GOOGLE_CHROMEEC_BOARDNAME) \ rw cp $(obj)/external/chromeec/$(CONFIG_EC_GOOGLE_CHROMEEC_BOARDNAME)/RW/ec.RW.flat $@ +endif + +$(obj)/mainboard/$(MAINBOARDDIR)/ecrw.hash: $(obj)/mainboard/$(MAINBOARDDIR)/ecrw + openssl dgst -sha256 -binary $< > $@ + +endif + +ifeq ($(EC_GOOGLE_CHROMEEC_PD),y) + +ifneq ($(CONFIG_EC_GOOGLE_CHROMEEC_PD_FIRMWARE_NONE),y) + +cbfs-files-y += pdrw +pdrw-file := $(obj)/mainboard/$(MAINBOARDDIR)/pdrw +pdrw-name := pdrw +pdrw-type := raw +pdrw-compression := $(CBFS_COMPRESS_FLAG) +cbfs-files-y += pdrw.hash +pdrw.hash-file := $(obj)/mainboard/$(MAINBOARDDIR)/pdrw.hash +pdrw.hash-name := pdrw.hash +pdrw.hash-type := raw + +ifeq ($(CONFIG_EC_GOOGLE_CHROMEEC_PD_FIRMWARE_EXTERNAL),y) +CONFIG_EC_GOOGLE_CHROMEEC_PD_FIRMWARE_FILE := $(call strip_quotes,$(CONFIG_EC_GOOGLE_CHROMEEC_PD_FIRMWARE_FILE)) + +$(obj)/mainboard/$(MAINBOARDDIR)/pdrw: $(CONFIG_EC_GOOGLE_CHROMEEC_PD_FIRMWARE_FILE) + cp $(CONFIG_EC_GOOGLE_CHROMEEC_PD_FIRMWARE_FILE) $@ +else +CONFIG_EC_GOOGLE_CHROMEEC_PD_BOARDNAME := $(call strip_quotes,$(CONFIG_EC_GOOGLE_CHROMEEC_PD_BOARDNAME)) $(obj)/mainboard/$(MAINBOARDDIR)/pdrw: $(MAKE) -C $(CHROMEEC_SOURCE) \ @@ -75,11 +100,13 @@ $(obj)/mainboard/$(MAINBOARDDIR)/pdrw: BOARD=$(CONFIG_EC_GOOGLE_CHROMEEC_PD_BOARDNAME) \ rw cp $(obj)/external/chromeec/$(CONFIG_EC_GOOGLE_CHROMEEC_PD_BOARDNAME)/RW/ec.RW.flat $@ +endif -$(obj)/mainboard/$(MAINBOARDDIR)/%.hash: $(obj)/mainboard/$(MAINBOARDDIR)/% +$(obj)/mainboard/$(MAINBOARDDIR)/pdrw.hash: $(obj)/mainboard/$(MAINBOARDDIR)/pdrw openssl dgst -sha256 -binary $< > $@ -.PHONY: $(obj)/mainboard/$(MAINBOARDDIR)/ecrw $(obj)/mainboard/$(MAINBOARDDIR)/pdrw +endif + endif endif |