Browse Source

build: add image makefile helper function for pading with an offset

Signed-off-by: Felix Fietkau <[email protected]>

SVN-Revision: 44012
Felix Fietkau 11 years ago
parent
commit
f5cab4828c
1 changed files with 11 additions and 0 deletions
  1. 11 0
      include/image.mk

+ 11 - 0
include/image.mk

@@ -307,6 +307,17 @@ define Build/pad-rootfs
 	$(call prepare_generic_squashfs,$@)
 endef
 
+define Build/pad-offset
+	let \
+		size="$$(stat -c%s $@)" \
+		pad="$(word 1, $(1))" \
+		offset="$(word 2, $(1))" \
+		pad="(pad - ((size + offset) % pad)) % pad" \
+		newsize='size + pad'; \
+		dd if=$@ [email protected] bs=$$newsize count=1 conv=sync
+	mv [email protected] $@
+endef
+
 define Build/check-size
 	@[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -gt "$$(stat -c%s $@)" ] || { \
 		echo "WARNING: Image file $@ is too big"; \