Paul Fagerburg has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35604 )
Change subject: util/mb/googl/hatch: update CRC calculation for correctness
......................................................................
util/mb/googl/hatch: update CRC calculation for correctness
The CRC result is treated as a signed value, and so in certain
situations, the calculated value for the last four digits will not
be correct. Ensure that the CRC is treated as an unsigned 32-bit
value prior to converting the last 4 decimal digits to a string.
Signed-off-by: Paul Fagerburg <pfagerburg(a)chromium.org>
Change-Id: I92f9ce1ceb7450f90b89c94e0ace6f79a9419b42
---
M util/mainboard/google/hatch/kconfig.py
1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/35604/1
diff --git a/util/mainboard/google/hatch/kconfig.py b/util/mainboard/google/hatch/kconfig.py
index ecc24ee..2a2972d 100755
--- a/util/mainboard/google/hatch/kconfig.py
+++ b/util/mainboard/google/hatch/kconfig.py
@@ -64,8 +64,9 @@
converted to all uppercase as part of this function."""
hwid = variant_name + ' test'
upperhwid = hwid.upper()
- suffix = zlib.crc32(upperhwid.encode('UTF-8')) % 10000
- gbb_hwid = upperhwid + ' ' + str(suffix).zfill(4)
+ # Force conversion to unsigned by bitwise AND with (2^32)-1
+ crc = zlib.crc32(upperhwid.encode('UTF-8')) & 0xffffffff
+ gbb_hwid = upperhwid + ' ' + str(crc % 10000).zfill(4)
return gbb_hwid
--
To view, visit https://review.coreboot.org/c/coreboot/+/35604
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I92f9ce1ceb7450f90b89c94e0ace6f79a9419b42
Gerrit-Change-Number: 35604
Gerrit-PatchSet: 1
Gerrit-Owner: Paul Fagerburg <pfagerburg(a)chromium.org>
Gerrit-MessageType: newchange
Paul Fagerburg has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35606 )
Change subject: util/mb/google/hatch: script can take optional bug parameter
......................................................................
util/mb/google/hatch: script can take optional bug parameter
When creating a new variant, adding a bug parameter after the name
of the variant will populate the BUG= field in the commit message.
If the paramter is not present, then BUG=None.
Signed-off-by: Paul Fagerburg <pfagerburg(a)chromium.org>
Change-Id: I3e08df5d80a5684c9f3675e3c0a8346240171cd3
---
M util/mainboard/google/hatch/create_coreboot_variant.sh
1 file changed, 7 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/35606/1
diff --git a/util/mainboard/google/hatch/create_coreboot_variant.sh b/util/mainboard/google/hatch/create_coreboot_variant.sh
index c6cbb49..065fb6d 100755
--- a/util/mainboard/google/hatch/create_coreboot_variant.sh
+++ b/util/mainboard/google/hatch/create_coreboot_variant.sh
@@ -13,9 +13,9 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-if [[ "$#" -ne 1 ]]; then
- echo "Usage: $0 variant_name"
- echo "e.g. $0 kohaku"
+if [[ "$#" -lt 1 ]]; then
+ echo "Usage: $0 variant_name [bug_number]"
+ echo "e.g. $0 kohaku b:140261109"
echo "Adds a new variant of Hatch to Kconfig and Kconfig.name, creates the"
echo "skeleton files for acpi, ec, and gpio, copies the makefile for"
echo "SPD sources, and sets up a basic overridetree"
@@ -32,6 +32,9 @@
VARIANT="${1,,}"
VARIANT_UPPER="${VARIANT^^}"
+# Assign BUG= text, or "None" if that parameter wasn't specified.
+BUG=${2:-None}
+
# This script and the templates live in util/mainboard/google/hatch
# We need to create files in src/mainboard/google/hatch
pushd "${BASH_SOURCE%/*}" || exit 1
@@ -69,7 +72,7 @@
# Now commit the files.
git commit -sm "${BASE}: Create ${VARIANT} variant
-BUG=none
+BUG=${BUG}
TEST=util/abuild/abuild -p none -t google/${BASE} -x -a
make sure the build includes GOOGLE_${VARIANT_UPPER}"
--
To view, visit https://review.coreboot.org/c/coreboot/+/35606
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I3e08df5d80a5684c9f3675e3c0a8346240171cd3
Gerrit-Change-Number: 35606
Gerrit-PatchSet: 1
Gerrit-Owner: Paul Fagerburg <pfagerburg(a)chromium.org>
Gerrit-MessageType: newchange
Paul Fagerburg has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35605 )
Change subject: util/mb/google/hatch: add optional bug parameter, fix style issues
......................................................................
util/mb/google/hatch: add optional bug parameter, fix style issues
Add optional bug number parameter
Use all caps for variables
Use a single exit code
Change-Id: I63aa0aa633f36b9543e809fc42fac955da5960a3
---
M util/mainboard/google/hatch/create_coreboot_variant.sh
1 file changed, 27 insertions(+), 26 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/35605/1
diff --git a/util/mainboard/google/hatch/create_coreboot_variant.sh b/util/mainboard/google/hatch/create_coreboot_variant.sh
index d4256a6..065fb6d 100755
--- a/util/mainboard/google/hatch/create_coreboot_variant.sh
+++ b/util/mainboard/google/hatch/create_coreboot_variant.sh
@@ -13,9 +13,9 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-if [[ "$#" -ne 1 ]]; then
- echo "Usage: $0 variant_name"
- echo "e.g. $0 kohaku"
+if [[ "$#" -lt 1 ]]; then
+ echo "Usage: $0 variant_name [bug_number]"
+ echo "e.g. $0 kohaku b:140261109"
echo "Adds a new variant of Hatch to Kconfig and Kconfig.name, creates the"
echo "skeleton files for acpi, ec, and gpio, copies the makefile for"
echo "SPD sources, and sets up a basic overridetree"
@@ -26,54 +26,55 @@
# you to specify the baseboard as one of the cmdline arguments.
#
# This is the name of the base board that we're cloning to make the variant.
-base="hatch"
-# This is the name of the variant that is being cloned
-# ${var,,} converts to all lowercase
-variant="${1,,}"
+BASE="hatch"
+# This is the name of the variant that is being cloned.
+# ${var,,} converts to all lowercase; ${var^^} is all uppercase.
+VARIANT="${1,,}"
+VARIANT_UPPER="${VARIANT^^}"
+
+# Assign BUG= text, or "None" if that parameter wasn't specified.
+BUG=${2:-None}
# This script and the templates live in util/mainboard/google/hatch
# We need to create files in src/mainboard/google/hatch
-pushd "${BASH_SOURCE%/*}" || exit
+pushd "${BASH_SOURCE%/*}" || exit 1
SRC=$(pwd)
-popd || exit
+popd || exit 1
pushd "${SRC}/../../../../src/mainboard/google/${base}" || {
echo "The baseboard directory for ${base} does not exist.";
- exit; }
+ exit 1; }
-# Make sure the variant doesn't already exist
-if [[ -e variants/${variant} ]]; then
- echo "variants/${variant} already exists."
+# Make sure the variant doesn't already exist.
+if [[ -e variants/${VARIANT} ]]; then
+ echo "variants/${VARIANT} already exists."
echo "Have you already created this variant?"
- popd || exit
- exit 2
+ exit 1
fi
# Start a branch. Use YMD timestamp to avoid collisions.
DATE=$(date +%Y%m%d)
-git checkout -b "create_${variant}_${DATE}"
+git checkout -b "create_${VARIANT}_${DATE}" || exit 1
-# Copy the template tree to the target
+# Copy the template tree to the target.
mkdir -p "variants/${variant}/"
cp -pr "${SRC}/template/." "variants/${variant}/"
-git add "variants/${variant}/"
+git add "variants/${VARIANT}/"
# Now add the new variant to Kconfig and Kconfig.name
# These files are in the current directory, e.g. src/mainboard/google/hatch
-"${SRC}/kconfig.py" --name "${variant}"
+"${SRC}/kconfig.py" --name "${VARIANT}"
mv Kconfig.new Kconfig
mv Kconfig.name.new Kconfig.name
git add Kconfig Kconfig.name
-# Now commit the files
-git commit -sm "${base}: Create ${variant} variant
+# Now commit the files.
+git commit -sm "${BASE}: Create ${VARIANT} variant
-BUG=none
-TEST=util/abuild/abuild -p none -t google/${base} -x -a
-make sure the build includes GOOGLE_${variant^^}"
-
-popd || exit
+BUG=${BUG}
+TEST=util/abuild/abuild -p none -t google/${BASE} -x -a
+make sure the build includes GOOGLE_${VARIANT_UPPER}"
echo "Please check all the files (git show), make any changes you want,"
echo "and then push to coreboot HEAD:refs/for/master"
--
To view, visit https://review.coreboot.org/c/coreboot/+/35605
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I63aa0aa633f36b9543e809fc42fac955da5960a3
Gerrit-Change-Number: 35605
Gerrit-PatchSet: 1
Gerrit-Owner: Paul Fagerburg <pfagerburg(a)chromium.org>
Gerrit-MessageType: newchange
Hung-Te Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35634 )
Change subject: vboot: create board-specific test-only GBB HWID if not set
......................................................................
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(a)chromium.org>
---
M src/security/vboot/Kconfig
M src/security/vboot/Makefile.inc
A src/security/vboot/gen_hwid.sh
3 files changed, 50 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/34/35634/1
diff --git a/src/security/vboot/Kconfig b/src/security/vboot/Kconfig
index 1e372d8..d6d74ca 100644
--- a/src/security/vboot/Kconfig
+++ b/src/security/vboot/Kconfig
@@ -228,7 +228,12 @@
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 3078e30..2aa9812 100644
--- a/src/security/vboot/Makefile.inc
+++ b/src/security/vboot/Makefile.inc
@@ -243,7 +243,9 @@
@printf " SETUP GBB\n"
cp $< $@.tmp
$(FUTILITY) gbb_utility -s \
- --hwid="$(CONFIG_GBB_HWID)" \
+ --hwid="$$(src/security/vboot/gen_hwid.sh \
+ "$(CONFIG_MAINBOARD_PART_NUMBER)" \
+ "$(CONFIG_GBB_HWID)")" \
--rootkey="$(CONFIG_VBOOT_ROOT_KEY)" \
--recoverykey="$(CONFIG_VBOOT_RECOVERY_KEY)" \
--flags=$(GBB_FLAGS) \
diff --git a/src/security/vboot/gen_hwid.sh b/src/security/vboot/gen_hwid.sh
new file mode 100755
index 0000000..949e67c7
--- /dev/null
+++ b/src/security/vboot/gen_hwid.sh
@@ -0,0 +1,41 @@
+#!/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.
+
+die() {
+ echo "$*" >&2
+ exit 1
+}
+
+if [ "$#" != 2 ]; then
+ die "Usage: $0 MAINBOARD_PARTNUMBER OVERRIDE_HWID"
+fi
+
+part_number="$1"
+override="$2"
+
+if [ -n "${override}" ]; then
+ echo "${override}"
+ exit
+fi
+
+# Generate a test-only Chrome OS HWID v2 string
+prefix="$(echo "${part_number}" | tr a-z A-Z) TEST"
+
+# TODO(hungte) Use rhash or crc32 if python is not available.
+# Use Python2 or python 3.
+crc="$(python -c "import zlib, sys; sys.stdout.write(\
+ ('%04u' % (zlib.crc32('${prefix}'.encode('utf8')) & 0xffffffffL))[-4:])")"
+
+echo "${prefix}" "${crc}"
--
To view, visit https://review.coreboot.org/c/coreboot/+/35634
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I0cda17a374641589291ec8dfb1d66c553f7cbf35
Gerrit-Change-Number: 35634
Gerrit-PatchSet: 1
Gerrit-Owner: Hung-Te Lin <hungte(a)chromium.org>
Gerrit-MessageType: newchange
Hung-Te Lin has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/35664 )
Change subject: util/chromeos: revise description for more utility scripts in future
......................................................................
util/chromeos: revise description for more utility scripts in future
The description.md and README.md was explicitly made for downloading or
extracting some resources, but we need to add more Chrome OS related
scripts soon; so the description should be revised.
Also changed README.md for better markdown style, for example
- Use #, ## to replace the old '-' headers
- Use code format for file names
- Use code block for example of shell execution
Change-Id: Icc3677fa318b03f4aee1b0f5fb13b2095f2afe64
Signed-off-by: Hung-Te Lin <hungte(a)chromium.org>
---
M util/chromeos/README.md
M util/chromeos/description.md
2 files changed, 16 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/64/35664/1
diff --git a/util/chromeos/README.md b/util/chromeos/README.md
index 3c3d721..e3ac34c 100644
--- a/util/chromeos/README.md
+++ b/util/chromeos/README.md
@@ -1,27 +1,28 @@
-Chrome OS binary extraction
-===========================
+# Chrome OS Scripts
-These scripts can be used to extract System Agent reference code
-and other blobs (e.g. mrc.bin, refcode, VGA option roms) from a
-Chrome OS recovery image.
+These scripts can be used to access or generate Chrome OS resources, for
+example to extract System Agent reference code and other blobs (e.g. `mrc.bin`,
+refcode, VGA option roms) from a Chrome OS recovery image.
-crosfirmware.sh
----------------
+## crosfirmware.sh
-crosfirmware.sh downloads a Chrome OS recovery image from the recovery
+`crosfirmware.sh` downloads a Chrome OS recovery image from the recovery
image server, unpacks it, extracts the firmware update shell archive,
extracts the firmware images from the shell archive.
To download all Chrome OS firmware images, run
+```
$ ./crosfirmware.sh
+```
To download, e.g. the Panther firmware image, run
+```
$ ./crosfirmware.sh panther
+```
-extract_blobs.sh
-----------------
+## extract_blobs.sh
-extract_blobs.sh extracts the blobs from a Chrome OS firmware image.
+`extract_blobs.sh` extracts the blobs from a Chrome OS firmware image.
Right now it will produce the ME firmware blob, IFD, VGA option rom,
-and mrc.bin
+and `mrc.bin`.
diff --git a/util/chromeos/description.md b/util/chromeos/description.md
index d2da577..ca3d53e 100644
--- a/util/chromeos/description.md
+++ b/util/chromeos/description.md
@@ -1,3 +1,3 @@
-These scripts can be used to extract System Agent reference code and
-other blobs (e.g. mrc.bin, refcode, VGA option roms) from a Chrome OS
-recovery image. `C`
+These scripts can be used to access Chrome OS resources, for example to
+extracting System Agent reference code and other blobs (e.g. mrc.bin, refcode,
+VGA option roms) from a Chrome OS recovery image. `C`
--
To view, visit https://review.coreboot.org/c/coreboot/+/35664
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Icc3677fa318b03f4aee1b0f5fb13b2095f2afe64
Gerrit-Change-Number: 35664
Gerrit-PatchSet: 1
Gerrit-Owner: Hung-Te Lin <hungte(a)chromium.org>
Gerrit-MessageType: newchange