diff --git a/config/sources/families/spacemit.conf b/config/sources/families/spacemit.conf index 0d67fd252f28..d1318549a5ee 100644 --- a/config/sources/families/spacemit.conf +++ b/config/sources/families/spacemit.conf @@ -76,31 +76,32 @@ write_uboot_platform() { declare -A d d=( - [${1}/bootinfo_emmc.bin]="0:$(du -b ${1}/bootinfo_emmc.bin | awk '{print $1}')" - [${1}/FSBL.bin]="512:$(du -b ${1}/FSBL.bin | awk '{print $1}')" + ["${1}/bootinfo_emmc.bin"]="0:$(du -b "${1}/bootinfo_emmc.bin" | awk '{print $1}')" + ["${1}/FSBL.bin"]="512:$(du -b "${1}/FSBL.bin" | awk '{print $1}')" ) if [ -b ${2}boot0 ]; then device=${2}boot0 - echo 0 > /sys/block/$(basename ${device})/force_ro + echo 0 > "/sys/block/$(basename "${device}")/force_ro" sync fi for f in "${!d[@]}" do + # @TODO: "if $(...)" works by accident, should be "if ..." instead if $(dd if=${device} bs=1 skip="${d[$f]%:*}" count="${d[$f]#*:}" \ conv=notrunc status=noxfer 2>/dev/null | cmp --quiet "${f}") then echo "Skip $(basename $f), it is equal to the existing one" else echo "# Write =: $(basename $f) to ${device}" - dd if=$f of=${device} bs=1 seek="${d[$f]%:*}" conv=notrunc status=noxfer + dd "if=$f" "of=${device}" bs=1 seek="${d[$f]%:*}" conv=notrunc status=noxfer sync fi done - dd if=$1/fw_dynamic.itb of=${2} bs=512 seek=1280 conv=notrunc + dd "if=$1/fw_dynamic.itb" "of=${2}" bs=512 seek=1280 conv=notrunc sync - dd if=$1/u-boot.itb of=${2} bs=512 seek=2048 conv=notrunc + dd "if=$1/u-boot.itb of=${2}" bs=512 seek=2048 conv=notrunc sync }