From d1625e9655707720d80d3114b7a01139b71b73fe Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sat, 30 Nov 2024 09:00:12 +0100 Subject: [PATCH 1/3] spacemit: revert shellfmt that messed up - revert spacemit.conf changes from 2f63a9cd987a32a3e87ae6026f116025aec0b2a8 --- config/sources/families/spacemit.conf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config/sources/families/spacemit.conf b/config/sources/families/spacemit.conf index d4fda34cfc96..0d67fd252f28 100644 --- a/config/sources/families/spacemit.conf +++ b/config/sources/families/spacemit.conf @@ -76,8 +76,8 @@ 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 @@ -86,9 +86,11 @@ write_uboot_platform() { sync fi - for f in "${!d[@]}"; do + for f in "${!d[@]}" + do if $(dd if=${device} bs=1 skip="${d[$f]%:*}" count="${d[$f]#*:}" \ - conv=notrunc status=noxfer 2> /dev/null | cmp --quiet "${f}"); then + 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}" From 3016a664fb32809eff0806c189831fa1d8d0d8b3 Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sat, 30 Nov 2024 09:04:38 +0100 Subject: [PATCH 2/3] spacemit: apply quoting to fix more glaring problems - add a TODO for the original author of a "if $(...)" statement which I can't understand; it's still wrong --- config/sources/families/spacemit.conf | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 } From 934c66a175a09dbf54ad140064a294388bc200dd Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sat, 30 Nov 2024 09:05:52 +0100 Subject: [PATCH 3/3] spacemit: shellfmt again after quoting fixes - problematic `if $(...)` remains; just indent changed --- config/sources/families/spacemit.conf | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/config/sources/families/spacemit.conf b/config/sources/families/spacemit.conf index d1318549a5ee..f5771f83ab1a 100644 --- a/config/sources/families/spacemit.conf +++ b/config/sources/families/spacemit.conf @@ -76,8 +76,8 @@ 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 @@ -86,12 +86,10 @@ write_uboot_platform() { sync fi - for f in "${!d[@]}" - do + 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 + 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}"