[OpenWrt-Devel] [PATCH 2/5] build: image: Add pad-to and pad-rootfs-squashfs helpers

Felix Fietkau nbd at nbd.name
Fri Mar 29 13:14:36 EDT 2019


On 2019-03-29 15:07, Petr Štetiar wrote:
> In order to share common functionality across platforms.
> 
> Signed-off-by: Petr Štetiar <ynezz at true.cz>
> ---
>  include/image-commands.mk | 3 +--
>  include/image.mk          | 9 +++++++++
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/include/image-commands.mk b/include/image-commands.mk
> index 8251a81..06c084c 100644
> --- a/include/image-commands.mk
> +++ b/include/image-commands.mk
> @@ -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
> diff --git a/include/image.mk b/include/image.mk
> index 6d9e347..8b84c8c 100644
> --- a/include/image.mk
> +++ b/include/image.mk
> @@ -180,6 +180,15 @@ ifeq ($(strip $(call kernel_patchver_ge,4.17.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
The image should only be padded if CONFIG_TARGET_IMAGES_PAD is set.
Keeping images not padded by default makes them faster to build and
faster to write to storage on upgrade.
I think it would be better to write a separate script to pad images to
partition size for qemu purposes.

- Felix

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list