summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2020-07-21 10:18:58 -0700
committerCommit Bot <commit-bot@chromium.org>2020-07-23 22:55:56 +0000
commit38e8bc916f6efe9107607e9775fb42f871eae5e0 (patch)
treea6f87e25b03a541f2ca6a45340841b03dbff8337
parent46a8cf53e000bffdd3b201d33ccc092d73b460c8 (diff)
downloadchrome-ec-38e8bc916f6efe9107607e9775fb42f871eae5e0.tar.gz
signer: modify manifest tag field to include board name
Personalization infrastructure expects the image header tag filed to be set to the board name in ASCII. This patch modifies the chip g makefile to paste the board name into the manifest, the signer copies the value into the image header. BUG=b:161498484 TEST=verified that the manifest is updated as expected: $ diff util/signer/ec_RW-manifest-dev.json /tmp/h1.signer.F2Pu6d 33c33 < "tag": "00000000000000000000000000000000000000000000000000000000", --- > "tag": "68736c74206432630000000000000000000000000000000000000000", and observed the personalizer test harness to retrieve the expected board name from the running image. Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Change-Id: I9ecf009e21c2ab77b03c9de1ebb176197923e6e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2310850 Reviewed-by: Andrey Pronin <apronin@chromium.org> Reviewed-by: Namyoon Woo <namyoon@chromium.org>
-rw-r--r--chip/g/build.mk16
1 files changed, 16 insertions, 0 deletions
diff --git a/chip/g/build.mk b/chip/g/build.mk
index ceb68f34a6..f4d71a3df3 100644
--- a/chip/g/build.mk
+++ b/chip/g/build.mk
@@ -205,6 +205,22 @@ NODE_JSON := $(shell sed -i \
endif # CHIP_MK_INCLUDED_ONCE defined
endif # H1_DEVIDS defined
+# Modify the manifest tag field to match the board name. This is necessary for
+# perosnalization to succeed.
+#
+# Personalization infrastructure uses hslt_XXX board names with the underscore
+# replaced with a space and the part after undersore (if any), capitalized.
+# Edit the board name and express it in hex:
+HEX_NAME := $(shell printf "$(BOARD)" | /usr/bin/awk -F_ ' \
+ {if (NF == 2) \
+ { printf($$1" "toupper($$2)) } \
+ else \
+ { printf } \
+ }' | xxd -ps)
+# This many zeros in the tag field need to be replaced.
+HEX_LEN := $(shell printf $(HEX_NAME) | wc -c)
+$(shell sed -i "s/tag\": \"0\{$(HEX_LEN)\}/tag\": \"$(HEX_NAME)/" \
+ ${SIGNER_MANIFEST})
# This file is included twice by the Makefile, once to determine the CHIP info
# # and then again after defining all the CONFIG_ and HAS_TASK variables. We use