[openwrt/openwrt] treewide: fix shell errors during dump stage

LEDE Commits lede-commits at lists.infradead.org
Mon Nov 13 05:11:45 PST 2023


ansuel pushed a commit to openwrt/openwrt.git, branch openwrt-22.03:
https://git.openwrt.org/3555a2930f9ccefaabe4400364e1e2b29692b5de

commit 3555a2930f9ccefaabe4400364e1e2b29692b5de
Author: Petr Štetiar <ynezz at true.cz>
AuthorDate: Thu Jun 15 16:11:27 2023 +0200

    treewide: fix shell errors during dump stage
    
    Fixes following issues:
    
     bash: -c: line 1: `echo 1686820180<LINUX_VERMAGIC> | /staging_dir/host/bin/mkhash md5 | cut -b1-8'
     bash: -c: line 1: `echo 1686820180<LINUX_VERMAGIC> | /staging_dir/host/bin/mkhash md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/''
     bash: -c: line 1: syntax error near unexpected token `|'
     bash: line 1: *1024*1024: syntax error: operand expected (error token is "*1024*1024")
     bash: line 1: (64 + ): syntax error: operand expected (error token is ")")
     expr: syntax error: missing argument after '+'
    
    Signed-off-by: Petr Štetiar <ynezz at true.cz>
    (cherry picked from commit 8fc496be860192f8bd1f16913657626014c8863f)
    [ fix merge conflicts, adapt to 22.03 ]
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 include/image.mk                       | 4 ++++
 target/linux/layerscape/image/Makefile | 3 +++
 target/linux/mediatek/image/mt7622.mk  | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/include/image.mk b/include/image.mk
index ba1bd3c03f..fec9b1ca46 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -40,8 +40,10 @@ IMG_PREFIX_VERCODE:=$(if $(CONFIG_VERSION_CODE_FILENAMES),$(call sanitize,$(VERS
 IMG_PREFIX:=$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))
 IMG_ROOTFS:=$(IMG_PREFIX)-rootfs
 IMG_COMBINED:=$(IMG_PREFIX)-combined
+ifeq ($(DUMP),)
 IMG_PART_SIGNATURE:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | cut -b1-8)
 IMG_PART_DISKGUID:=$(shell echo $(SOURCE_DATE_EPOCH)$(LINUX_VERMAGIC) | $(MKHASH) md5 | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{10})../\1-\2-\3-\4-\500/')
+endif
 
 MKFS_DEVTABLE_OPT := -D $(INCLUDE_DIR)/device_table.txt
 
@@ -172,7 +174,9 @@ define Image/pad-to
 	mv $(1).new $(1)
 endef
 
+ifeq ($(DUMP),)
 ROOTFS_PARTSIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024*1024)))
+endif
 
 define Image/pad-root-squashfs
 	$(call Image/pad-to,$(KDIR)/root.squashfs,$(if $(1),$(1),$(ROOTFS_PARTSIZE)))
diff --git a/target/linux/layerscape/image/Makefile b/target/linux/layerscape/image/Makefile
index 3c8bdea480..e6a1f242ac 100644
--- a/target/linux/layerscape/image/Makefile
+++ b/target/linux/layerscape/image/Makefile
@@ -8,8 +8,11 @@ include $(INCLUDE_DIR)/image.mk
 LS_SD_KERNELPART_SIZE = 40
 LS_SD_KERNELPART_OFFSET = 16
 LS_SD_ROOTFSPART_OFFSET = 64
+
+ifeq ($(DUMP),)
 LS_SD_IMAGE_SIZE = $(shell echo $$((($(LS_SD_ROOTFSPART_OFFSET) + \
 	$(CONFIG_TARGET_ROOTFS_PARTSIZE)))))
+endif
 
 # The limitation of flash sysupgrade.bin is 1MB dtb + 16MB kernel + 32MB rootfs
 LS_SYSUPGRADE_IMAGE_SIZE = 49m
diff --git a/target/linux/mediatek/image/mt7622.mk b/target/linux/mediatek/image/mt7622.mk
index e741c46926..b0611bd17c 100644
--- a/target/linux/mediatek/image/mt7622.mk
+++ b/target/linux/mediatek/image/mt7622.mk
@@ -97,7 +97,9 @@ define Device/bananapi_bpi-r64
 				$(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
 				   pad-to 46080k | append-image squashfs-sysupgrade.itb | check-size | gzip \
 				)
+ifeq ($(DUMP),)
   IMAGE_SIZE := $$(shell expr 45 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
+endif
   KERNEL			:= kernel-bin | gzip
   KERNEL_INITRAMFS		:= kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd | pad-to 128k
   IMAGE/sysupgrade.itb		:= append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata




More information about the lede-commits mailing list