Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spacemit: shellfmt again after quoting fixes #7529

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions config/sources/families/spacemit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,30 @@ 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
}