[openwrt/openwrt] bcm4908: fix calculation of new cferam index
LEDE Commits
lede-commits at lists.infradead.org
Fri Nov 5 06:14:00 PDT 2021
rmilecki pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/4607f55439c2a03154f71ba9d366cff8f52443d2
commit 4607f55439c2a03154f71ba9d366cff8f52443d2
Author: Sungbo Eo <mans0n at gorani.run>
AuthorDate: Sun Aug 1 22:17:04 2021 +0900
bcm4908: fix calculation of new cferam index
The arithmetic expansion fails when idx becomes a two digit number.
Fix this by relying on expr command.
root at OpenWrt:/# echo $(((028 + 0) % 1000))
/bin/ash: arithmetic syntax error
root at OpenWrt:/# echo $(($(expr 028 + 0) % 1000))
28
Fixes: a6a0b252baa6 ("bcm4908: add sysupgrade support")
Signed-off-by: Sungbo Eo <mans0n at gorani.run>
(cherry picked from commit f4323538501d58298f4df73a034a51375a477cfc)
---
target/linux/bcm4908/base-files/lib/upgrade/platform.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/linux/bcm4908/base-files/lib/upgrade/platform.sh b/target/linux/bcm4908/base-files/lib/upgrade/platform.sh
index 8aca7119e4..ee43e3a713 100644
--- a/target/linux/bcm4908/base-files/lib/upgrade/platform.sh
+++ b/target/linux/bcm4908/base-files/lib/upgrade/platform.sh
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
-RAMFS_COPY_BIN="bcm4908img"
+RAMFS_COPY_BIN="bcm4908img expr"
PART_NAME=firmware
@@ -129,7 +129,7 @@ platform_calc_new_cferam() {
umount $dir
rm -fr $dir
- idx=$(((idx + inc) % 1000))
+ idx=$(($(expr $idx + $inc) % 1000))
echo $(printf "cferam.%03d" $idx)
}
More information about the lede-commits
mailing list