Skip to content

Commit

Permalink
tegraXXX-helper-scripts: add TNSPEC length check
Browse files Browse the repository at this point in the history
Generate an error during BUP generation if the TNSPEC
will be longer than 63 characters, since the tools that
deal with BUPs have a hard limit on that length.

Signed-off-by: Matt Madison <[email protected]>
  • Loading branch information
madisongh committed Mar 23, 2021
1 parent b297055 commit 40701c9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,10 @@ if [ $bup_blob -ne 0 ]; then
localbootfile="boot.img"
. "$here/l4t_bup_gen.func"
spec="${BOARDID}-${FAB}-${BOARDSKU}--1-0-${MACHINE}-${BOOTDEV}"
if [ $(expr length "$spec") -ge 64 ]; then
echo "ERR: TNSPEC must be shorter than 64 characters: $spec" >&2
exit 1
fi
l4t_bup_gen "$flashcmd" "$spec" "$fuselevel" t186ref "$keyfile" "$sbk_keyfile" 0x18 || exit 1
else
eval $flashcmd || exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,10 @@ if [ $bup_blob -ne 0 ]; then
localbootfile="boot.img"
. "$here/l4t_bup_gen.func"
spec="${BOARDID}-${FAB}-${BOARDSKU}-${BOARDREV}-1-${CHIPREV}-${MACHINE}-${BOOTDEV}"
if [ $(expr length "$spec") -ge 64 ]; then
echo "ERR: TNSPEC must be shorter than 64 characters: $spec" >&2
exit 1
fi
l4t_bup_gen "$flashcmd" "$spec" "$fuselevel" t186ref "$keyfile" "$sbk_keyfile" 0x19 || exit 1
else
eval $flashcmd < /dev/null || exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ if [ $bup_blob -ne 0 ]; then
localbootfile="boot.img"
. "$here/l4t_bup_gen.func"
spec="${BOARDID}-${FAB}-${BOARDSKU}-${BOARDREV}-1-0-${MACHINE}-${BOOTDEV}"
if [ $(expr length "$spec") -ge 64 ]; then
echo "ERR: TNSPEC must be shorter than 64 characters: $spec" >&2
exit 1
fi
l4t_bup_gen "$flashcmd" "$spec" "$fuselevel" t210ref "$keyfile" "" 0x21 || exit 1
else
if [ -z "$keyfile" ]; then
Expand Down

0 comments on commit 40701c9

Please sign in to comment.