coreboot-kgpe-d16/util/chromeos/gen_test_hwid.sh
Martin Roth 0ad5fbd48d util: Update all shebangs to use /usr/bin/env
Instead of hardcoding paths to the executables, use the version in the
path.  This allows the scripts to work on more systems, and allows the
binary version to be changed more easily if needed.

Signed-off-by: Martin Roth <martin@coreboot.org>
Change-Id: Ifcc56aa21092cd3866eacb6a02d198110ec6051d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48904
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2021-01-25 08:57:40 +00:00

20 lines
488 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 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 "$@"