tegra-helper-scripts: use 'sparse update' of SPI flash by default

The tegraflash.py script takes a '--sparseupdate' option that causes
it to update only changed partitions in the SPI flash. Enable that
by default in the flash helper script, and add an --erase-spi option
to force full erasure of the SPI flash, in case that's needed.

Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
Matt Madison
2024-11-10 08:58:35 -08:00
committed by Matt Madison
parent cfe0220947
commit 0a367f0b53

View File

@@ -15,6 +15,8 @@ imgfile=
dataimg=
inst_args=""
extdevargs=
sparseargs=
erase_spi=
blocksize=4096
# These functions are used in odmsign.func but do not
@@ -54,7 +56,7 @@ get_value_from_PT_table() {
eval "$varname=\"$value\""
}
ARGS=$(getopt -n $(basename "$0") -l "bup,bup-type:,no-flash,sign,sdcard,spi-only,boot-only,external-device,rcm-boot,datafile:,usb-instance:,uefi-enc:" -o "u:v:s:b:B:yc:" -- "$@")
ARGS=$(getopt -n $(basename "$0") -l "bup,bup-type:,no-flash,sign,sdcard,spi-only,boot-only,external-device,rcm-boot,datafile:,usb-instance:,uefi-enc:,erase-spi" -o "u:v:s:b:B:yc:" -- "$@")
if [ $? -ne 0 ]; then
echo "Error parsing options" >&2
exit 1
@@ -93,6 +95,10 @@ while true; do
rcm_boot=1
shift
;;
--erase-spi)
erase_spi=yes
shift
;;
--external-device)
external_device=1
extdevargs="--external_device"
@@ -621,6 +627,10 @@ else
tfcmd=${flash_cmd:-"flash;reboot"}
fi
if [ $no_flash -eq 0 -a "$erase_spi" != "yes" ] && echo "$tfcmd" | grep -q "flash"; then
sparseargs="--sparseupdate"
fi
want_signing=0
if [ -n "$keyfile" ] || [ $rcm_boot -eq 1 ] || [ $no_flash -eq 1 -a $to_sign -eq 1 ]; then
want_signing=1
@@ -671,7 +681,7 @@ if [ $want_signing -eq 1 ]; then
--cfg flash.xml \
--bct_backup \
--boot_chain A \
$bctargs $ramcodeargs $extdevargs $BINSARGS"
$bctargs $ramcodeargs $extdevargs $sparseargs $BINSARGS"
FBARGS="--cmd \"$tfcmd\""
. "$here/odmsign.func"
(odmsign_ext_sign_and_flash) || exit 1
@@ -711,7 +721,7 @@ else
--cfg flash.xml \
--bct_backup \
--boot_chain A \
$bctargs $extdevargs \
$bctargs $extdevargs $sparseargs \
--bins \"$BINSARGS\""
fi