build system: add manual board id support

This patch adds manual board id support to coreboot and
selects manual board ids vs automatic (ie strap based)
where appropriate in the mainboards.

CQ-DEPEND=CL:262935
BRANCH=none
BUG=chrome-os-partner:37593
TEST=emerge-urara coreboot, see no board_id file
     emerge-buranku coreboot, see board_id file

Change-Id: Ia04e5498a01f35c5418698ecaf3197f56415e789
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 3bdb1fa092005be24de9fc68998053982648da85
Original-Change-Id: I4f0820233a485bf92598a739b81be2076d4e6ae7
Original-Signed-off-by: Stefan Reinauer <reinauer@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/262745
Original-Reviewed-by: Vadim Bendebury <vbendeb@google.com>
Reviewed-on: http://review.coreboot.org/9905
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/Makefile.inc b/Makefile.inc
index 9ef29d6..9851461 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -621,6 +621,13 @@
 		$(CBFSTOOL_PRE_OPTS)
 	mv $@.tmp $@
 
+cbfs-files-$(CONFIG_BOARD_ID_MANUAL) += board_id
+board_id-file := $(obj)/board_id
+board_id-type := raw
+
+$(obj)/board_id:
+	printf "$(CONFIG_BOARD_ID_STRING)" > $@
+
 JENKINS_PAYLOAD=none
 what-jenkins-does:
 	util/abuild/abuild -B -J $(if $(JENKINS_NOCCACHE),,-y) -c 4 -z -p $(JENKINS_PAYLOAD)
diff --git a/src/Kconfig b/src/Kconfig
index 11811f8..8c55837 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -268,6 +268,39 @@
 	  is a suitable file for further processing.
 	  The bootblock will not be modified.
 
+config GENERIC_GPIO_LIB
+	bool
+	default n
+	help
+	  If enabled, compile the generic GPIO library. A "generic" GPIO
+	  implies configurability usually found on SoCs, particularly the
+	  ability to control internal pull resistors.
+
+config BOARD_ID_AUTO
+	bool
+	default n
+	help
+	  Mainboards that can read a board ID from the hardware straps
+	  (ie. GPIO) select this configuration option.
+
+config BOARD_ID_MANUAL
+	bool "Add board ID file to CBFS"
+	default n
+	depends on !BOARD_ID_AUTO
+	help
+	  If you want to maintain a board ID, but the hardware does not
+	  have straps to automatically determine the ID, you can say Y
+	  here and add a file named 'board_id' to CBFS. If you don't know
+	  what this is about, say N.
+
+config BOARD_ID_STRING
+	string "Board ID"
+	default "(none)"
+	depends on BOARD_ID_MANUAL
+	help
+	  This string is placed in the 'board_id' CBFS file for indicating
+	  board type.
+
 config RAM_CODE_SUPPORT
 	bool "Discover RAM configuration code and store it in coreboot table"
 	default n
@@ -1141,22 +1174,6 @@
 	  If enabled, the code coverage hooks in coreboot will output some
 	  information about the coverage data that is dumped.
 
-config GENERIC_GPIO_LIB
-	bool "Build generic GPIO library"
-	default n
-	help
-	  If enabled, compile the generic GPIO library. A "generic" GPIO
-	  implies configurability usually found on SoCs, particularly the
-	  ability to control internal pull resistors.
-
-config BOARD_ID_SUPPORT
-	bool "Discover board ID and store it in coreboot table"
-	default n
-	help
-	  If enabled, coreboot discovers the board id of the hardware it is
-	  running on and reports it through the coreboot table to the rest of
-	  the system.
-
 endmenu
 
 # These probably belong somewhere else, but they are needed somewhere.
diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c
index b62f452..8319c03 100644
--- a/src/lib/coreboot_table.c
+++ b/src/lib/coreboot_table.c
@@ -218,7 +218,7 @@
 
 static void lb_board_id(struct lb_header *header)
 {
-#if CONFIG_BOARD_ID_SUPPORT
+#if CONFIG_BOARD_ID_AUTO || CONFIG_BOARD_ID_MANUAL
 	struct lb_board_id  *bid;
 
 	bid = (struct lb_board_id *)lb_new_record(header);