coreboot-kgpe-d16/util/chromeos/gen_test_hwid.sh
Michał Żygowski e6b96dceab util/chromeos/gen_test_hwid.sh: Replace usage of hexdump
Hexdump command is not available in coreboot-sdk. Replace it with
equivalent implementation using commands that are present in the
container.

TEST=Passed "VP46XX" as prefix variable and it produced the same
crc32 result before and after the change.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Change-Id: Icad93933335b8c5ebd8fee74cc9aaed36bb56482
Reviewed-on: https://review.coreboot.org/c/coreboot/+/68133
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2022-12-17 20:45:42 +00:00

20 lines
486 B
Bash
Executable file

#!/usr/bin/env sh
#
# SPDX-License-Identifier: GPL-2.0-only
main() {
if [ "$#" != 1 ]; then
echo "Usage: $0 MAINBOARD_PARTNUMBER" >&2
exit 1
fi
# Generate a test-only ChromeOS 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 | \
od -An -vtu4 | tr -d '\n' | tail -c 4)"
echo "${prefix}" "${crc32}"
}
main "$@"