uboot-envtools: Fix format of autogenerated sectors
authorSven Eckelmann <sven@narfation.org>
Thu, 29 Sep 2022 10:10:32 +0000 (12:10 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 5 Nov 2022 21:45:46 +0000 (22:45 +0100)
The sector number must be stored in hex. Otherwise, the number (like 16)
will be parsed as hex and any write to the partition will end up with an
error like:

  MTD erase error on /dev/mtd5: Invalid argument

Fixes: 9adfeccd8415 ("uboot-envtools: Add support for IPQ806x AP148 and DB149")
Fixes: 54b275c8ed3a ("ipq40xx: add target")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@fungible.com>
(cherry picked from commit 8d3e932b65b59ab7231cb5440866eb975bd150ea)

package/boot/uboot-envtools/files/ipq40xx
package/boot/uboot-envtools/files/ipq806x

index 9a71a622f7bada02b897e0c3f492c17b6ad6114c..59ad9631689b79673550cf69cdd85ada86b00f8b 100644 (file)
@@ -26,6 +26,7 @@ ubootenv_mtdinfo () {
        fi
 
        sectors=$(( $ubootenv_size / $mtd_erase ))
+       sectors=$(printf "0x%x" $sectors )
        echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
 }
 
index a8285d145270d75ae75c8e857eb4ddf1ca37791b..77dfefbcd8196bf2a6edd55fb6936c60890cf70d 100644 (file)
@@ -26,6 +26,7 @@ ubootenv_mtdinfo () {
        fi
 
        sectors=$(( $ubootenv_size / $mtd_erase ))
+       sectors=$(printf "0x%x" $sectors )
        echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors
 }