1
0
Fork 0

flash-only-uboot.sh: verify before dd-ing

This commit is contained in:
Pratham Patel 2024-03-02 20:54:07 +05:30
parent a68fdda8ff
commit 3fac7c04cc
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
1 changed files with 13 additions and 6 deletions

View File

@ -21,14 +21,21 @@ if [[ ! -b "${DEVICE}" ]]; then
exit 3
fi
if [[ -z "${3:-}" ]]; then
FLASH_CMD="${DD_COMMON} of=${DEVICE} if=${UBOOT}"
else
FLASH_CMD="${DD_COMMON} bs=$3 seek=$4 of=${DEVICE} if=${UBOOT}"
fi
echo 'Following command will be executed, is that okay?'
echo -e "\n${FLASH_CMD}\n"
# shellcheck disable=SC2034
read -r WAIT_INFINITELY
${DD_COMMON} bs=1M count=64 of="${DEVICE}" if=/dev/urandom
sync
${DD_COMMON} bs=1M count=64 of="${DEVICE}" if=/dev/zero
sync
if [[ -n "${3:-}" ]]; then
${DD_COMMON} bs=512 seek=64 of="${DEVICE}" if="${UBOOT}"
else
${DD_COMMON} bs="$3" seek="$4" of="${DEVICE}" if="${UBOOT}"
fi
${FLASH_CMD}
sync