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) \
$(UBINIZE_OPTS)
cat $@.tmp >> $@
rm $@.tmp
+ $(if $(and $(IMAGE_SIZE),$(NAND_SIZE)),\
+ $(call Build/check-size,$(UBI_NAND_SIZE_LIMIT)))
+endef
+
+define Build/ubinize-image
+ sh $(TOPDIR)/scripts/ubinize-image.sh \
+ $(if $(UBOOTENV_IN_UBI),--uboot-env) \
+ $(foreach part,$(UBINIZE_PARTS),--part $(part)) \
+ --part $(word 1,$(1))="$(BIN_DIR)/$(DEVICE_IMG_PREFIX)-$(word 2,$(1))" \
+ $@.tmp \
+ -p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \
+ $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \
+ $(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \
+ $(UBINIZE_OPTS)
+ cat $@.tmp >> $@
+ rm $@.tmp
endef
define Build/ubinize-kernel
endef
define Build/linksys-image
- $(TOPDIR)/scripts/linksys-image.sh \
+ let \
+ size="$$(stat -c%s $@)" \
+ pad="$(call exp_units,$(PAGESIZE))" \
+ offset="256" \
+ pad="(pad - ((size + offset) % pad)) % pad"; \
+ dd if=/dev/zero bs=$$pad count=1 | tr '\000' '\377' >> $@
+ printf ".LINKSYS.01000409%-15s%08X%-8s%-16s" \
"$(call param_get_default,type,$(1),$(DEVICE_NAME))" \
- $@ $@.new
- mv $@.new $@
+ "$$(cksum $@ | cut -d ' ' -f1)" \
+ "0" "K0000000F0246434" >> $@
+ dd if=/dev/zero bs=192 count=1 >> $@
endef
define Build/lzma