From 38e8bc916f6efe9107607e9775fb42f871eae5e0 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Tue, 21 Jul 2020 10:18:58 -0700 Subject: 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 Change-Id: I9ecf009e21c2ab77b03c9de1ebb176197923e6e1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2310850 Reviewed-by: Andrey Pronin Reviewed-by: Namyoon Woo --- chip/g/build.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 -- cgit v1.2.1