diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-01-17 21:19:24 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-01-17 21:19:24 +0000 |
commit | 0742781ec891a90cc1f57488b0a85c517cd82465 (patch) | |
tree | 9e0d5b76d4a13d3e51ae35fd8aaa636af9e292ea | |
parent | 5108a4488fd6295315056425bcf3bf9d90329704 (diff) | |
download | upstream-0742781ec891a90cc1f57488b0a85c517cd82465.tar.gz upstream-0742781ec891a90cc1f57488b0a85c517cd82465.tar.bz2 upstream-0742781ec891a90cc1f57488b0a85c517cd82465.zip |
build: add image makefile helper function for pading with an offset
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44012 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r-- | include/image.mk | 11 |
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"; \ |