summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx/image
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-02-13 21:19:00 +0000
committerJo-Philipp Wich <jow@openwrt.org>2014-02-13 21:19:00 +0000
commitb1d7ebae09622252906f7a7da1af2e3f30f6cf0e (patch)
treeced391f212ed867497ec93c69008f66dd6ffefdc /target/linux/ar71xx/image
parentaf63cdf87ad76177fb7180e5fb57ec6f949fbb98 (diff)
downloadmtk-20170518-b1d7ebae09622252906f7a7da1af2e3f30f6cf0e.zip
mtk-20170518-b1d7ebae09622252906f7a7da1af2e3f30f6cf0e.tar.gz
mtk-20170518-b1d7ebae09622252906f7a7da1af2e3f30f6cf0e.tar.bz2
ar71xx: fix mtdpartsize macro in image Makefile (#14961)
The mtdpartsize macro triggers shell errors on various Linux distributions when the partname argument $(1) does not appear within the partmap $(2). Change the sed pattern to only emit anything if a successful substitution occured and only evaluate the arithmetic expression if something was printed by the sed program. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org> SVN-Revision: 39583
Diffstat (limited to 'target/linux/ar71xx/image')
-rw-r--r--target/linux/ar71xx/image/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 1f181f4..9076f22 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -36,7 +36,7 @@ $(if $(1),board=$(1) )$(if $(2),console=$(2)$(COMMA)$(3))
endef
define mtdpartsize
-$(shell echo $$((`echo '$(2)' | sed -e 's/.*[:$(COMMA)]\([0-9]*\)k[@]*[0-9a-zx]*($(1)).*/\1/'` * 1024)))
+$(shell sz=`echo '$(2)' | sed -ne 's/.*[:$(COMMA)]\([0-9]*\)k[@]*[0-9a-zx]*($(1)).*/\1/p'`; [ -n "$$sz" ] && echo $$(($$sz * 1024)))
endef
SINGLE_PROFILES:=