u-boot-fw-tools: fix script to account for more than 9 parts

When grepping for the mtd index "1" the script was also returning
partitions 10, 11, and so on.

Reported-by: Leonid Makhnovskiy <leonid.maknovskiy@digi.com>
Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2018-08-10 16:24:21 +02:00
parent f6639026d8
commit a2a8491140
1 changed files with 2 additions and 2 deletions

View File

@ -62,9 +62,9 @@ pkg_postinst_${PN}() {
# - Both copies starting at the same offset
ENV_REDUND_OFFSET="${UBOOT_ENV_OFFSET}"
# - Calculated erase block size
ERASEBLOCK="$(grep "^${MTDINDEX}" ${PARTTABLE} | awk '{printf("0x%d",$3)}')"
ERASEBLOCK="$(grep "^${MTDINDEX}:" ${PARTTABLE} | awk '{printf("0x%d",$3)}')"
# - Calculated number of blocks
MTDSIZE="$(grep "^${MTDINDEX}" ${PARTTABLE} | awk '{printf("0x%d",$2)}')"
MTDSIZE="$(grep "^${MTDINDEX}:" ${PARTTABLE} | awk '{printf("0x%d",$2)}')"
NBLOCKS="$(((MTDSIZE - UBOOT_ENV_OFFSET) / ERASEBLOCK))"
# If a range was provided, calculate the number of
# blocks in the range and use that number, unless they