build: image: add pad-to and pad-rootfs-squashfs helpers
authorPetr Štetiar <ynezz@true.cz>
Thu, 28 Mar 2019 14:21:18 +0000 (14:21 +0000)
committerPetr Štetiar <ynezz@true.cz>
Tue, 25 Jun 2019 14:12:22 +0000 (14:12 +0000)
For better reusability.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
include/image-commands.mk
include/image.mk

index 8251a814000d2507676ccf51075860e86f64da18..06c084c48b0eeb54c15a69569dc84beaa8da8ff8 100644 (file)
@@ -230,8 +230,7 @@ define Build/append-uboot
 endef
 
 define Build/pad-to
-       dd if=$@ of=$@.new bs=$(1) conv=sync
-       mv $@.new $@
+       $(call Image/pad-to,$@,$(1))
 endef
 
 define Build/pad-extra
index 530a2b1335a83bb31f8de0b796c37ca67a21f2cb..3680be2155d361b898b78df62547eb457caa5457 100644 (file)
@@ -178,6 +178,15 @@ ifeq ($(strip $(call kernel_patchver_ge,4.18.0)),1)
        -Wno-unique_unit_address
 endif
 
+define Image/pad-to
+       dd if=$(1) of=$(1).new bs=$(2) conv=sync
+       mv $(1).new $(1)
+endef
+
+define Image/pad-root-squashfs
+       $(call Image/pad-to,$(KDIR)/root.squashfs,$(if $(1),$(1),$(CONFIG_TARGET_ROOTFS_PARTSIZE)M))
+endef
+
 # $(1) source dts file
 # $(2) target dtb file
 # $(3) extra CPP flags