File tree Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Expand file tree Collapse file tree 1 file changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -26,9 +26,10 @@ error_msg() {
2626
2727usage () {
2828 echo -e " Usage:"
29- echo -e " emmc: $0 -b <VIM1|VIM2|VIM3|VIM4> -i <path-to-image>"
29+ echo -e " emmc: $0 -b <VIM1|VIM2|VIM3|VIM4> -i <path-to-image> [-n] "
3030 echo -e " sdcard: $0 -d </dev/sdX> -i <path-to-image>"
3131 echo -e " \nOptions:"
32+ echo -e " -n Do not erase the whole flash chip (default to erase)."
3233 echo -e " -s Skip the USB connectivity check, it will be verified more reliably later during the flashing process (default to check)."
3334}
3435
5556
5657SKIP_USB_CHECK=" no"
5758
58- while getopts " d:i:b:Dhrs" flag; do
59+ # Default to erase if the option is not explicitly provided
60+ # to match the default behavior of $FLASH_TOOL and $ADNL_TOOL
61+ ERASE_ALL=" yes"
62+
63+ while getopts " d:i:b:Dhrns" flag; do
5964 case $flag in
6065 d)
6166 DEVICE=" $OPTARG "
@@ -72,6 +77,9 @@ while getopts "d:i:b:Dhrs" flag; do
7277 r)
7378 RESET_BOARD=" yes"
7479 ;;
80+ n)
81+ ERASE_ALL=" no"
82+ ;;
7583 s)
7684 SKIP_USB_CHECK=" yes"
7785 ;;
@@ -174,14 +182,25 @@ else
174182 else
175183 RESET_BOARD=
176184 fi
177- $FLASH_TOOL --img=$IMAGE --parts=all --wipe --soc=$SOC ${RESET_BOARD} ${DEBUG}
185+ if [ " $ERASE_ALL " == " yes" ]; then
186+ WIPE_OPTION=" --wipe"
187+ else
188+ WIPE_OPTION=
189+ fi
190+
191+ $FLASH_TOOL --img=$IMAGE --parts=all ${WIPE_OPTION} --soc=$SOC ${RESET_BOARD} ${DEBUG}
178192 elif [ " $BOARD " == " VIM4" ] || [ " $BOARD " == " VIM1S" ]; then
179193 if [ " $RESET_BOARD " == " yes" ]; then
180194 RESET_BOARD=" -r 1"
181195 else
182196 RESET_BOARD=
183197 fi
184- $ADNL_TOOL -p $IMAGE ${RESET_BOARD}
198+ if [ " $ERASE_ALL " == " yes" ]; then
199+ ERASE_FLASH=" -e 1"
200+ else
201+ ERASE_FLASH=" -e 0"
202+ fi
203+ $ADNL_TOOL -p $IMAGE ${RESET_BOARD} ${ERASE_FLASH}
185204 fi
186205fi
187206
You can’t perform that action at this time.
0 commit comments