[openwrt/openwrt] image: ignore errors from mktplinkfw command

LEDE Commits lede-commits at lists.infradead.org
Wed Oct 30 06:17:58 PDT 2024


ansuel pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5ba701fe1916c32dd00a1f9dbd93ae362740ab52

commit 5ba701fe1916c32dd00a1f9dbd93ae362740ab52
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Wed Oct 30 11:21:58 2024 +0100

    image: ignore errors from mktplinkfw command
    
    Rework tplink-v2-header and tplink-v2-image Build define to ignore error
    if mktplinkfw2 errors out.
    
    This is to handle situation when the image is too big and can't be
    generated or prev check-image calls deleted the source file as it's too
    big.
    
    This aligns to the pattern used by tplink-v1-image.
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 include/image-commands.mk | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/image-commands.mk b/include/image-commands.mk
index d2974f4e01..702cbd8c98 100644
--- a/include/image-commands.mk
+++ b/include/image-commands.mk
@@ -666,23 +666,22 @@ define Build/tplink-v1-image
 endef
 
 define Build/tplink-v2-header
-	$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
+	-$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
 		-c -H $(TPLINK_HWID) -W $(TPLINK_HWREV) -L $(KERNEL_LOADADDR) \
 		-E $(if $(KERNEL_ENTRY),$(KERNEL_ENTRY),$(KERNEL_LOADADDR))  \
 		-w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
 		-T $(TPLINK_HVERSION) -V "ver. 2.0" \
-		-k $@ -o $@.new $(1)
-	@mv $@.new $@
+		-k $@ -o $@.new $(1) \
+	&& mv $@.new $@ || rm -f $@
 endef
 
 define Build/tplink-v2-image
-	$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
+	-$(STAGING_DIR_HOST)/bin/mktplinkfw2 \
 		-H $(TPLINK_HWID) -W $(TPLINK_HWREV) \
 		-w $(TPLINK_HWREVADD) -F "$(TPLINK_FLASHLAYOUT)" \
 		-T $(TPLINK_HVERSION) -V "ver. 2.0" -a 0x4 -j \
-		-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new $(1)
-	cat $@.new >> $@
-	rm -rf $@.new
+		-k $(IMAGE_KERNEL) -r $(IMAGE_ROOTFS) -o $@.new $(1) \
+	&& cat $@.new >> $@ && rm -rf $@.new || rm -f $@
 endef
 
 define Build/uImage




More information about the lede-commits mailing list