treewide: fix shell errors during dump stage
authorPetr Štetiar <ynezz@true.cz>
Thu, 15 Jun 2023 14:11:27 +0000 (16:11 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Mon, 13 Nov 2023 13:01:25 +0000 (14:01 +0100)
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@true.cz>
include/image.mk
target/linux/layerscape/image/Makefile
target/linux/mediatek/image/filogic.mk
target/linux/mediatek/image/mt7622.mk
target/linux/mediatek/image/mt7623.mk

index 9736e4e1642ed404d729c6932751127be6d09e0c..4ebff2e9ae0424b54ccf47657b6626def5ed13d7 100644 (file)
@@ -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
 
@@ -167,7 +169,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)))
index dfbda85b3651bfe3e3973875ad818d1e07ad5e09..f2ac9b6f0482ad792548bee8a7adfd7bbc2626bb 100644 (file)
@@ -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
index 4ce9b7f2ba1433b863bdbf51f78c2af125c7b8e0..0ef3e945756895dd17bf784c0059e31943626a98 100644 (file)
@@ -192,7 +192,9 @@ define Device/bananapi_bpi-r3
                                   pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\
                                ) \
                                  gzip
+ifeq ($(DUMP),)
   IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
+endif
   KERNEL                       := kernel-bin | gzip
   KERNEL_INITRAMFS := kernel-bin | lzma | \
        fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
index 85776ef6d95c3a177e9d9222889331f4459c5a76..e362e7428bd6004aff0bf6eb909233452e5f03fd 100644 (file)
@@ -107,7 +107,9 @@ define Device/bananapi_bpi-r64
                                   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
index 5828c4d763d937929f75f0d07f1674e3750db7a2..2c4402da6619491e870a509c4a1166d9f07ebd6e 100644 (file)
@@ -96,7 +96,9 @@ define Device/bananapi_bpi-r2
   KERNEL := kernel-bin | gzip
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb
   KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb with-initrd
+ifeq ($(DUMP),)
   IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
+endif
   IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb external-static-with-rootfs | append-metadata
   ARTIFACT/preloader.bin := mt7623-mbr emmc |\
                            pad-to 2k | append-preloader $$(UBOOT_TARGET)
@@ -130,7 +132,9 @@ define Device/unielec_u7623-02
   UBOOT_TARGET := mt7623a_unielec_u7623
   UBOOT_IMAGE := u-boot-mtk.bin
   UBOOT_PATH := $(STAGING_DIR_IMAGE)/$$(UBOOT_TARGET)-$$(UBOOT_IMAGE)
+ifeq ($(DUMP),)
   IMAGE_SIZE := $$(shell expr 48 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
+endif
   IMAGES := sysupgrade.itb
   KERNEL := kernel-bin | gzip
   KERNEL_INITRAMFS_SUFFIX := -recovery.itb