tools/tar: Update to 1.31
[openwrt/openwrt.git] / include / image-commands.mk
index 3cc5dc2..56bad53 100644 (file)
@@ -49,25 +49,29 @@ define Build/eva-image
        mv $@.new $@
 endef
 
        mv $@.new $@
 endef
 
-define Build/make-ras
-       let \
-               newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
-               $(TOPDIR)/scripts/make-ras.sh \
-                       --board $(RAS_BOARD) \
-                       --version $(RAS_VERSION) \
-                       --kernel $(call param_get_default,kernel,$(1),$(IMAGE_KERNEL)) \
-                       --rootfs $@ \
-                       --rootfssize $$newsize \
-                       $@.new
-       @mv $@.new $@
+define Build/seama
+       $(STAGING_DIR_HOST)/bin/seama -i $@ \
+               -m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware"
+       mv $@.seama $@
 endef
 
 endef
 
-define Build/mkbuffaloimg
-       $(STAGING_DIR_HOST)/bin/mkbuffaloimg -B $(BOARDNAME) \
-               -R $$(($(subst k, * 1024,$(ROOTFS_SIZE)))) \
-               -K $$(($(subst k, * 1024,$(KERNEL_SIZE)))) \
-               -i $@ -o $@.new
-       mv $@.new $@
+define Build/seama-seal
+       $(STAGING_DIR_HOST)/bin/seama -i $@ -s $@.seama \
+               -m "signature=$(SEAMA_SIGNATURE)"
+       mv $@.seama $@
+endef
+
+define Build/zyxel-ras-image
+       let \
+               newsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
+               $(STAGING_DIR_HOST)/bin/mkrasimage \
+                       -b $(RAS_BOARD) \
+                       -v $(RAS_VERSION) \
+                       -r $@ \
+                       -s $$newsize \
+                       -o $@.new \
+                       $(if $(findstring separate-kernel,$(word 1,$(1))),-k $(IMAGE_KERNEL)) \
+               && mv $@.new $@
 endef
 
 define Build/netgear-chk
 endef
 
 define Build/netgear-chk
@@ -98,6 +102,10 @@ define Build/append-squashfs-fakeroot-be
        cat $@.fakesquashfs >> $@
 endef
 
        cat $@.fakesquashfs >> $@
 endef
 
+define Build/append-string
+       echo -n $(1) >> $@
+endef
+
 # append a fake/empty uImage header, to fool bootloaders rootfs integrity check
 # for example
 define Build/append-uImage-fakehdr
 # append a fake/empty uImage header, to fool bootloaders rootfs integrity check
 # for example
 define Build/append-uImage-fakehdr
@@ -123,16 +131,6 @@ define Build/tplink-safeloader
                $(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv $@.new $@ || rm -f $@
 endef
 
                $(if $(findstring sysupgrade,$(word 1,$(1))),-S) && mv $@.new $@ || rm -f $@
 endef
 
-define Build/mksercommfw
-       -$(STAGING_DIR_HOST)/bin/mksercommfw \
-               $@ \
-               $(KERNEL_OFFSET) \
-               $(HWID) \
-               $(HWVER) \
-               $(SWVER)
-endef
-
-
 define Build/append-dtb
        cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
 endef
 define Build/append-dtb
        cat $(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb >> $@
 endef
@@ -170,6 +168,16 @@ define Build/gzip
        @mv $@.new $@
 endef
 
        @mv $@.new $@
 endef
 
+define Build/zip
+       mkdir $@.tmp
+       mv $@ $@.tmp/$(1)
+
+       zip -j -X \
+               $(if $(SOURCE_DATE_EPOCH),--mtime="$(SOURCE_DATE_EPOCH)") \
+               $@ $@.tmp/$(if $(1),$(1),$@)
+       rm -rf $@.tmp
+endef
+
 define Build/jffs2
        rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
                mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
 define Build/jffs2
        rm -rf $(KDIR_TMP)/$(DEVICE_NAME)/jffs2 && \
                mkdir -p $(KDIR_TMP)/$(DEVICE_NAME)/jffs2/$$(dirname $(1)) && \
@@ -246,6 +254,11 @@ define Build/pad-offset
        mv $@.new $@
 endef
 
        mv $@.new $@
 endef
 
+define Build/xor-image
+       $(STAGING_DIR_HOST)/bin/xorimage -i $@ -o $@.xor $(1)
+       mv $@.xor $@
+endef
+
 define Build/check-size
        @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$(stat -c%s $@)" ] || { \
                echo "WARNING: Image file $@ is too big" >&2; \
 define Build/check-size
        @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$(stat -c%s $@)" ] || { \
                echo "WARNING: Image file $@ is too big" >&2; \
@@ -261,6 +274,13 @@ define Build/combined-image
        @mv $@.new $@
 endef
 
        @mv $@.new $@
 endef
 
+define Build/linksys-image
+       $(TOPDIR)/scripts/linksys-image.sh \
+               "$(call param_get_default,type,$(1),$(DEVICE_NAME))" \
+               $@ $@.new
+               mv $@.new $@
+endef
+
 define Build/openmesh-image
        $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
                "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \
 define Build/openmesh-image
        $(TOPDIR)/scripts/om-fwupgradecfg-gen.sh \
                "$(call param_get_default,ce_type,$(1),$(DEVICE_NAME))" \
@@ -332,7 +352,7 @@ metadata_json = \
 
 define Build/append-metadata
        $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
 
 define Build/append-metadata
        $(if $(SUPPORTED_DEVICES),-echo $(call metadata_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
-       [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" ] || { \
+       [ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
                cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
                usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
                ucert -A -c "$@.ucert" -x "$@.sig" ;\
                cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
                usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
                ucert -A -c "$@.ucert" -x "$@.sig" ;\