diff options
author | Hung-Te Lin <hungte@chromium.org> | 2019-09-27 12:23:20 +0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-09-30 11:33:20 +0000 |
commit | 117453e89010069561f15117ff8279dca1f635e4 (patch) | |
tree | 5575847ad0a319d0bd30e7a5359c4d060a3eff58 | |
parent | 544bc2693a515b5fa72c767d637a9f99f998a572 (diff) | |
download | coreboot-117453e89010069561f15117ff8279dca1f635e4.tar.gz coreboot-117453e89010069561f15117ff8279dca1f635e4.tar.bz2 coreboot-117453e89010069561f15117ff8279dca1f635e4.zip |
vboot: create board-specific test-only GBB HWID if not set
The HWID in vboot GBB is an identifier for machine model. On Chrome OS,
that should be provisioned in manufacturing process (by collecting real
hardware information), and will be checked in system startup.
For bring up developers, they usually prefer to generate a test-only
string for HWID. However that format was not well documented and cause
problems. Further more, most Chromebooks are using HWID v3+ today while
the test-only HWID is usually v2. Non-Chrome OS developers may also
prefer their own format.
To simplify development process, the GBB_CONFIG now defaults to empty
string, and will be replaced by a board-specific test-only v2 HWID
automatically. Developers can still override that in mainboard Kconfig
if they prefer v3 or other arbitrary format.
BUG=b:140067412
TEST=Built 'kukui' successfully. Removed kukui GBB config and built
again, still seeing correct test HWID.
Change-Id: I0cda17a374641589291ec8dfb1d66c553f7cbf35
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35634
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
-rw-r--r-- | src/security/vboot/Kconfig | 7 | ||||
-rw-r--r-- | src/security/vboot/Makefile.inc | 5 | ||||
-rw-r--r-- | util/chromeos/README.md | 16 | ||||
-rwxr-xr-x | util/chromeos/gen_test_hwid.sh | 31 |
4 files changed, 58 insertions, 1 deletions
diff --git a/src/security/vboot/Kconfig b/src/security/vboot/Kconfig index 1e372d86ba36..d6d74cac7349 100644 --- a/src/security/vboot/Kconfig +++ b/src/security/vboot/Kconfig @@ -228,7 +228,12 @@ menu "GBB configuration" config GBB_HWID string "Hardware ID" - default "NOCONF HWID" + default "" + help + A hardware identifier for device. On Chrome OS this is used for auto + update and recovery, and will be generated when manufacturing by the + factory software, in a strictly defined format. + Leave empty to get a test-only Chrome OS HWID v2 string generated. config GBB_BMPFV_FILE string "Path to bmpfv image" diff --git a/src/security/vboot/Makefile.inc b/src/security/vboot/Makefile.inc index 3078e30e2136..abb8863c02e5 100644 --- a/src/security/vboot/Makefile.inc +++ b/src/security/vboot/Makefile.inc @@ -239,6 +239,11 @@ $(obj)/gbb.stub: $(obj)/coreboot.rom $(FUTILITY) mv $@.tmp $@ endif +# Generate a test-only HWID +ifeq ($(CONFIG_GBB_HWID),) +CONFIG_GBB_HWID := $$($(top)/util/chromeos/gen_test_hwid.sh "$(CONFIG_MAINBOARD_PART_NUMBER)") +endif + $(obj)/gbb.region: $(obj)/gbb.stub @printf " SETUP GBB\n" cp $< $@.tmp diff --git a/util/chromeos/README.md b/util/chromeos/README.md index 7a3897d8a0fe..0b9a7d74d8c5 100644 --- a/util/chromeos/README.md +++ b/util/chromeos/README.md @@ -26,3 +26,19 @@ $ ./crosfirmware.sh panther Right now it will produce the ME firmware blob, IFD, VGA option rom, and `mrc.bin`. + +## gen_test_hwid.sh + +`gen_test_hwid.sh` generates a test-only identifier in Chrome OS HWID v2 +compatible format. + +Usage: +``` +$ ./gen_test_hwid.sh BOARD_NAME +``` + +Example: +``` +$ ./gen_test_hwid.sh Kukui +KUKUI TEST 9847 +``` diff --git a/util/chromeos/gen_test_hwid.sh b/util/chromeos/gen_test_hwid.sh new file mode 100755 index 000000000000..849ff6a8c044 --- /dev/null +++ b/util/chromeos/gen_test_hwid.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# This file is part of the coreboot project. +# +# Copyright 2019 Google Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +main() { + if [ "$#" != 1 ]; then + echo "Usage: $0 MAINBOARD_PARTNUMBER" >&2 + exit 1 + fi + + # Generate a test-only Chrome OS HWID v2 string + local board="$1" + local prefix="$(echo "${board}" | tr a-z A-Z) TEST" + # gzip has second-to-last 4 bytes in CRC32. + local crc32="$(printf "${prefix}" | gzip -1 | tail -c 8 | head -c 4 | \ + hexdump -e '1/4 "%04u" ""' | tail -c 4)" + + echo "${prefix}" "${crc32}" +} +main "$@" |