tegra-helper-scripts: add board ID and SKU checks to flash helper

Have the helper script cross-check the build-time board ID and SKU
settings, if available, against the actuals read from the CVM EEPROM,
and error out, rather than flashing the wrong boot firmware.

Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
Matt Madison
2024-11-09 08:17:24 -08:00
committed by Matt Madison
parent c7fc26f983
commit 3e0d4933d6

View File

@@ -318,6 +318,10 @@ if [ -n "$BOARDID" ]; then
else
boardid=$($here/chkbdinfo -i ${cvm_bin} | tr -d '[:space:]')
BOARDID="$boardid"
if [ -n "$CHECK_BOARDID" -a "$BOARDID" -ne "$CHECK_BOARDID" ]; then
echo "ERR: actual board ID $BOARDID does not match expected board ID $CHECK_BOARDID" >&2
exit 1;
fi
fi
if [ "$CHIPID" = "0x23" -a -z "$CHIP_SKU" ]; then
@@ -336,6 +340,10 @@ if [ -n "$BOARDSKU" ]; then
elif [ -n "$have_boardinfo" ]; then
board_sku=$($here/chkbdinfo -k ${cvm_bin} | tr -d '[:space:]' | tr [a-z] [A-Z])
BOARDSKU="$board_sku"
if [ -n "$CHECK_BOARDSKU" -a "$BOARDSKU" -ne "$CHECK_BOARDSKU" ]; then
echo "ERR: actual board SKU $BOARDSKU does not match expected board SKU $CHECK_BOARDSKU" >&2
exit 1;
fi
fi
if [ -n "$BOARDREV" ]; then
board_revision="$BOARDREV"