ar71xx/image: allow to use more arguments for some macros
[openwrt.git] / target / linux / ar71xx / image / Makefile
index 6234ba2e893d4f3e694d958d43d1f8ff96d0ad84..5d2b6700f26931348c328b011dece8c0fd3917dd 100644 (file)
@@ -49,11 +49,11 @@ SINGLE_PROFILES:=
 # $(4)      : board name.
 # $(5)~$(7) : arguments for $(mkcmdline)
 #              board=$(1) console=$(2),$(3)
-# $(8)~$(12): extra arguments.
+# $(8)~$(14): extra arguments.
 define SingleProfile
   # $(1): action name, e.g. loader, buildkernel, squashfs, etc.
   define Image/Build/Profile/$(3)
-       $$(call Image/Build/Template/$(2)/$$(1),$(1),$(4),$$(call mkcmdline,$(5),$(6),$(7)),$(8),$(9),$(10),$(11),$(12))
+       $$(call Image/Build/Template/$(2)/$$(1),$(1),$(4),$$(call mkcmdline,$(5),$(6),$(7)),$(8),$(9),$(10),$(11),$(12),$(13),$(14))
   endef
   SINGLE_PROFILES += $(3)
 endef
@@ -149,11 +149,15 @@ endef
 endif
 
 # $(1): name of the 1st file.
+# $(2): size limit of the 1st file if it is greater than 262144, or
+#       the erase size of the flash if it is greater than zero and less
+#       than 262144
 # $(3): name of the 2nd file.
+# $(4): size limit of the 2nd file if $(2) is greater than 262144, otherwise
+#       it is the size limit of the output file
 # $(5): name of the output file.
 # $(6): padding size.
 define CatFiles
-       # $(4): size limit of the output file.
        if [ $(2) -eq 0 ]; then \
                filename="$(3)"; fstype=$$$${filename##*\.}; \
                case "$$$${fstype}" in \
@@ -174,8 +178,6 @@ define CatFiles
                        echo "Warning: $(5) is too big (> $(4) bytes)" >&2; \
                        rm -f $(5); \
                fi; \
-       # $(2): size limit of the 1st file.
-       # $(4): size limit of the 2nd file.
        else if [ $(2) -gt 262144 ]; then \
                if [ `stat -c%s "$(1)"` -gt $(2) ]; then \
                        echo "Warning: $(1) is too big (> $(2) bytes)" >&2; \
@@ -184,8 +186,6 @@ define CatFiles
                else \
                        ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
                fi; fi; \
-       # $(2): padding size for the 2nd file.
-       # $(4): size limit of the output file.
        else \
                ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
                if [ `stat -c%s $(5)` -gt $(4) ]; then \
@@ -913,7 +913,7 @@ endef
 
 define Jffs2Template
   define Image/Build/Template/$(1)/jffs2-$(2)
-    $$(call Image/Build/$$(1),jffs2-$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8))
+    $$(call Image/Build/$$(1),jffs2-$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
   endef
 endef
 
@@ -926,16 +926,16 @@ define BuildTemplate
   # $(3)     : kernel command line.
   # $(4)~$(8): extra arguments.
   define Image/Build/Template/$(1)/initramfs
-    $$(call Image/Build/$$(1)/initramfs,initramfs,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8))
+    $$(call Image/Build/$$(1)/initramfs,initramfs,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
   endef
   define Image/Build/Template/$(1)/loader
-    $$(call Image/Build/$$(1)/loader,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8))
+    $$(call Image/Build/$$(1)/loader,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
   endef
   define Image/Build/Template/$(1)/buildkernel
-    $$(call Image/Build/$$(1)/buildkernel,,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8))
+    $$(call Image/Build/$$(1)/buildkernel,,$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
   endef
   define Image/Build/Template/$(1)/squashfs
-    $$(call Image/Build/$$(1),squashfs$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8))
+    $$(call Image/Build/$$(1),squashfs$(2),$$(2),$$(3),$$(4),$$(5),$$(6),$$(7),$$(8),$$(9),$$(10))
   endef
   $(if $(3),$(foreach bs,$(3),$(eval $(call Jffs2Template,$(1),$(bs)))))
 endef