uboot-envtools: mediatek_filogic: update bpi-r3
[openwrt/staging/jow.git] / include / image-commands.mk
index 7d9f93fed741053d72574cc02124d849ab65c4b3..41a5e1198a95a098aef1ff6931f37ee917d721dc 100644 (file)
@@ -133,6 +133,8 @@ define Build/append-md5sum-ascii-salted
        rm $@.salted
 endef
 
+UBI_NAND_SIZE_LIMIT = $(IMAGE_SIZE) - ($(NAND_SIZE)*20/1024 + 4*$(BLOCKSIZE))
+
 define Build/append-ubi
        sh $(TOPDIR)/scripts/ubinize-image.sh \
                $(if $(UBOOTENV_IN_UBI),--uboot-env) \
@@ -146,6 +148,8 @@ define Build/append-ubi
                $(UBINIZE_OPTS)
        cat $@.tmp >> $@
        rm $@.tmp
+       $(if $(and $(IMAGE_SIZE),$(NAND_SIZE)),\
+               $(call Build/check-size,$(UBI_NAND_SIZE_LIMIT)))
 endef
 
 define Build/ubinize-kernel