build: add a build step for generic sysupgrade nand image
[openwrt/openwrt.git] / include / image.mk
index 73fc805bb589da9c9b9a270f3a12dc7524e193dd..8ac3593eae8308a26636b280b90e0b6483b4e4da 100644 (file)
@@ -345,6 +345,16 @@ define Build/append-rootfs
        dd if=$(word 2,$^) $(if $(1),bs=$(1) conv=sync) >> $@
 endef
 
+define Build/append-ubi
+       sh $(TOPDIR)/scripts/ubinize-image.sh \
+               $(if $(KERNEL_IN_UBI),--kernel $(word 1,$^)) \
+               $(word 2,$^) \
+               $@.tmp \
+               -p $(BLOCKSIZE) -m $(PAGESIZE) -E 5
+       cat $@.tmp >> $@
+       rm $@.tmp
+endef
+
 define Build/pad-to
        dd if=$@ of=$@.new bs=$(1) conv=sync
        mv $@.new $@
@@ -380,6 +390,14 @@ define Build/combined-image
        @mv $@.new $@
 endef
 
+define Build/sysupgrade-nand
+       sh $(TOPDIR)/scripts/sysupgrade-nand.sh \
+               --board $(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)) \
+               --kernel $(word 1,$^) \
+               --rootfs $(word 2,$^) \
+               $@
+endef
+
 define Device/Init
   PROFILES := $(PROFILE)
   DEVICE_NAME := $(1)