[PATCH 7/8] tegra: sysupgrade: use get_image_dd wrapper
Adrian Schmutzler
mail at adrianschmutzler.de
Wed Nov 25 12:44:21 EST 2020
Hi,
> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
> On Behalf Of Tomasz Maciej Nowak
> Sent: Mittwoch, 25. November 2020 17:34
> To: openwrt-devel at lists.openwrt.org
> Subject: [PATCH 7/8] tegra: sysupgrade: use get_image_dd wrapper
>
> This function eliminates false-positive erros emited by dd. Also remove check
> for number of arguments, as that's not needed anymore.
>
> Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
> ---
> .../linux/tegra/base-files/lib/upgrade/platform.sh | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/target/linux/tegra/base-files/lib/upgrade/platform.sh
> b/target/linux/tegra/base-files/lib/upgrade/platform.sh
> index 5c729de1a4b5..715d1c1b8046 100644
> --- a/target/linux/tegra/base-files/lib/upgrade/platform.sh
> +++ b/target/linux/tegra/base-files/lib/upgrade/platform.sh
> @@ -3,8 +3,6 @@ REQUIRE_IMAGE_METADATA=1
> platform_check_image() {
> local diskdev partdev diff
>
> - [ "$#" -gt 1 ] && return 1
> -
I will merge this patch without the argument number change for now.
Please submit that one separately if the rest is in master.
Best
Adrian
> export_bootdevice && export_partdevice diskdev 0 || {
> v "Unable to determine upgrade device"
> return 1
> @@ -13,7 +11,7 @@ platform_check_image() {
> get_partitions "/dev/$diskdev" bootdisk
>
> #extract the boot sector from the image
> - get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b
> 2>/dev/null
> + get_image_dd "$1" of=/tmp/image.bs count=1 bs=512b
>
> get_partitions /tmp/image.bs image
>
> @@ -53,7 +51,7 @@ platform_do_upgrade() {
> get_partitions "/dev/$diskdev" bootdisk
>
> #extract the boot sector from the image
> - get_image "$@" | dd of=/tmp/image.bs count=1 bs=512b
> + get_image_dd "$1" of=/tmp/image.bs count=1 bs=512b
>
> get_partitions /tmp/image.bs image
>
> @@ -64,7 +62,7 @@ platform_do_upgrade() {
> fi
>
> if [ -n "$diff" ]; then
> - get_image "$@" | dd of="/dev/$diskdev" bs=4096
> conv=fsync
> + get_image_dd "$1" of="/dev/$diskdev" bs=4096 conv=fsync
>
> # Separate removal and addtion is necessary; otherwise,
> partition 1
> # will be missing if it overlaps with the old partition 2 @@ -
> 75,12 +73,12 @@ platform_do_upgrade() {
> fi
>
> #write uboot image
> - get_image "$@" | dd of="$diskdev" bs=512 skip=1 seek=1
> count=4097 conv=fsync,notrunc
> + get_image_dd "$1" of="$diskdev" bs=512 skip=1 seek=1 count=4097
> +conv=fsync,notrunc
> #iterate over each partition from the image and write it to the boot
> disk
> while read part start size; do
> if export_partdevice partdev $part; then
> v "Writing image to /dev/$partdev..."
> - get_image "$@" | dd of="/dev/$partdev" ibs="512"
> obs=1M skip="$start" count="$size" conv=fsync
> + get_image_dd "$1" of="/dev/$partdev" ibs="512"
> obs=1M skip="$start"
> +count="$size" conv=fsync
> else
> v "Unable to find partition $part device, skipped."
> fi
> @@ -88,5 +86,5 @@ platform_do_upgrade() {
>
> #copy partition uuid
> v "Writing new UUID to /dev/$diskdev..."
> - get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4
> seek=440 conv=fsync
> + get_image_dd "$1" of="/dev/$diskdev" bs=1 skip=440 count=4
> seek=440
> +conv=fsync
> }
> --
> 2.29.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20201125/31a87e0a/attachment.sig>
More information about the openwrt-devel
mailing list