summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-01-17 21:19:24 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-01-17 21:19:24 +0000
commitf5cab4828c9eb81eaaf3b0526ea4babb695e2290 (patch)
tree5de411f245c38a12d77ccaed98580e0cb96ea394 /include
parent5e8bc7088b9e290df2f1f2da8f45d4567738abbb (diff)
downloadmaster-31e0f0ae-f5cab4828c9eb81eaaf3b0526ea4babb695e2290.tar.gz
master-31e0f0ae-f5cab4828c9eb81eaaf3b0526ea4babb695e2290.tar.bz2
master-31e0f0ae-f5cab4828c9eb81eaaf3b0526ea4babb695e2290.zip
build: add image makefile helper function for pading with an offset
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 44012
Diffstat (limited to 'include')
-rw-r--r--include/image.mk11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/image.mk b/include/image.mk
index e64020132f..06feef5516 100644
--- a/include/image.mk
+++ b/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=$@ of=$@.new bs=$$newsize count=1 conv=sync
+ mv $@.new $@
+endef
+
define Build/check-size
@[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -gt "$$(stat -c%s $@)" ] || { \
echo "WARNING: Image file $@ is too big"; \