ar71xx: merge profiles into image building code
[openwrt/openwrt.git] / target / linux / ar71xx / image / legacy.mk
index 1556573b5f84bdd595ef61d5982954150afa51b2..8446bcbb6f6fc5d765522ab3cd217c509d845086 100644 (file)
@@ -1,3 +1,4 @@
+include ./legacy-devices.mk
 rootfs_type=$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
 
 # $(1): rootfs type.
@@ -145,16 +146,16 @@ endif
 # $(6): padding size.
 define CatFiles
        if [ $(2) -eq 0 ]; then \
-               filename="$(3)"; fstype=$$$${filename##*\.}; \
-               case "$$$${fstype}" in \
+               filename="$(3)"; fstype=$${filename##*\.}; \
+               case "$${fstype}" in \
                "jffs2-64k") bs=65536;; \
                "jffs2-128k") bs=131072;; \
                "jffs2-256k") bs=262144;; \
                *) bs=`stat -c%s $(1)`;; \
                esac; \
-               ( dd if=$(1) bs=$$$${bs} conv=sync;  cat $(3) ) > $(5); \
+               ( dd if=$(1) bs=$${bs} conv=sync;  cat $(3) ) > $(5); \
                if [ -n "$(6)" ]; then \
-                       case "$$$${fstype}" in \
+                       case "$${fstype}" in \
                        squashfs*) \
                                padjffs2 $(5) $(6); \
                                ;; \
@@ -356,7 +357,7 @@ endef
 define Image/Build/CameoAP94
        $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
        $(eval fwsize_fat=$(call mtdpartsize,firmware,$(5)))
-       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
+       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$(($(fwsize)-4*64*1024)),64)
        if [ -e "$(call sysupname,$(1),$(2))" ]; then \
                ( \
                        dd if=$(call sysupname,$(1),$(2)); \
@@ -371,7 +372,7 @@ define Image/Build/CameoAP94
                        ) > $(call factoryname,$(1),$(2)); \
                fi; \
        fi
-       $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2)-fat.uImage,0,$(KDIR)/root.$(1),$$$$(($(fwsize_fat)-4*64*1024)),$(KDIR_TMP)/$(2)-fat.bin,64)
+       $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2)-fat.uImage,0,$(KDIR)/root.$(1),$$(($(fwsize_fat)-4*64*1024)),$(KDIR_TMP)/$(2)-fat.bin,64)
        if [ -e "$(KDIR_TMP)/$(2)-fat.bin" ]; then \
                echo -n "" > $(KDIR_TMP)/$(2)-fat.dummy; \
                sh $(TOPDIR)/scripts/combined-image.sh \
@@ -382,7 +383,7 @@ define Image/Build/CameoAP94
 endef
 
 define Image/Build/WZRHP
-       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(3)-4*$(4)*1024)),$(4))
+       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$(($(3)-4*$(4)*1024)),$(4))
        if [ -e "$(call sysupname,$(1),$(2))" ]; then \
                ( \
                        echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
@@ -412,7 +413,7 @@ Image/Build/WHRHPG300N/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(4))
 
 define Image/Build/WHRHPG300N
        $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
-       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
+       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$(($(fwsize)-4*64*1024)),64)
        if [ -e "$(call sysupname,$(1),$(2))" ]; then \
                ( \
                        echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
@@ -431,11 +432,11 @@ endef
 
 define Image/Build/Cameo
        $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
-       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
+       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$(($(fwsize)-4*64*1024)),64)
        if [ -e "$(call sysupname,$(1),$(2))" ]; then \
-               factory_size=$$$$(($(fwsize) - $(6))); \
+               factory_size=$$(($(fwsize) - $(6))); \
                ( \
-                       dd if=$(call sysupname,$(1),$(2)) bs=$$$${factory_size} conv=sync; \
+                       dd if=$(call sysupname,$(1),$(2)) bs=$${factory_size} conv=sync; \
                        echo -n $(5); \
                ) > $(call factoryname,$(1),$(2)); \
        fi
@@ -471,15 +472,15 @@ Image/Build/CameoDB120_8M/initramfs=$(call MkuImageLzma/initramfs,$(2),$(3) $(ca
 
 define Image/Build/CameoHornet
        $(eval fwsize=$(call mtdpartsize,firmware,$(4)))
-       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
+       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$(($(fwsize)-4*64*1024)),64)
        if [ -e "$(call sysupname,$(1),$(2))" ]; then \
                for r in $(7); do \
-                       [ -n "$$$$r" ] && dashr="-$$$$r" || dashr=; \
-                       [ -z "$$$$r" ] && r="DEF"; \
-                       mkcameofw -M HORNET -R "$$$$r" -S $(5) -V $(6) -c \
+                       [ -n "$$r" ] && dashr="-$$r" || dashr=; \
+                       [ -z "$$r" ] && r="DEF"; \
+                       mkcameofw -M HORNET -R "$$r" -S $(5) -V $(6) -c \
                                -K $(8) -I $(fwsize) \
                                -k "$(call sysupname,$(1),$(2))" \
-                               -o $(call imgname,$(1),$(2))-factory$$$$dashr.bin; \
+                               -o $(call imgname,$(1),$(2))-factory$$dashr.bin; \
                        true; \
                done; \
        fi
@@ -623,7 +624,7 @@ endef
 
 define Image/Build/Planex
        $(eval fwsize=$(call mtdpartsize,firmware,$(planex_mtdlayout)))
-       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
+       $(call Sysupgrade/KRuImage,$(1),$(2),0,$$(($(fwsize)-4*64*1024)),64)
        if [ -e "$(call sysupname,$(1),$(2))" ]; then \
                $(STAGING_DIR_HOST)/bin/mkplanexfw \
                        -B $(2) \
@@ -660,7 +661,7 @@ define Image/Build/Seama
        [ -e "$(KDIR)/loader-$(2).bin" ]
        $(call CompressLzma,$(KDIR)/loader-$(2).bin,$(KDIR_TMP)/loader-$(2).bin.lzma)
        -rm -f $(KDIR_TMP)/image-$(2).tmp
-       $(call CatFiles,$(KDIR_TMP)/loader-$(2).bin.lzma,$$$$(($(6) - 64)),$(KDIR)/root.$(1),$(7),$(KDIR_TMP)/image-$(2).tmp)
+       $(call CatFiles,$(KDIR_TMP)/loader-$(2).bin.lzma,$$(($(6) - 64)),$(KDIR)/root.$(1),$(7),$(KDIR_TMP)/image-$(2).tmp)
        [ -e "$(KDIR_TMP)/image-$(2).tmp" ] && { \
                head -c -4 "$(KDIR_TMP)/image-$(2).tmp" > "$(KDIR_TMP)/image-$(2).no-jffs2mark.tmp"; \
                $(STAGING_DIR_HOST)/bin/seama \
@@ -760,11 +761,11 @@ define Image/Build/Netgear
        $(call CatFiles,$(KDIR_TMP)/vmlinux-$(2).uImage.squashfs,0,$(KDIR)/root.$(1),$(fwsize),$(call sysupname,$(1),$(2)),64)
        if [ -e $(call sysupname,$(1),$(2)) ]; then \
                for r in $(7) ; do \
-                       [ -n "$$$$r" ] && dashr="-$$$$r" || dashr= ; \
+                       [ -n "$$r" ] && dashr="-$$r" || dashr= ; \
                        $(STAGING_DIR_HOST)/bin/mkdniimg \
-                               -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
+                               -B $(6) -v OpenWrt.$(REVISION) -r "$$r" $(8) \
                                -i $(call sysupname,$(1),$(2)) \
-                               -o $(call imgname,$(1),$(2))-factory$$$$dashr.img; \
+                               -o $(call imgname,$(1),$(2))-factory$$dashr.img; \
                done; \
        fi
 endef
@@ -791,7 +792,7 @@ define Image/Build/NetgearNAND/buildkernel
        $(call PatchKernelLzma,$(2),$(3) $(4),-d20)
        dd if=$(KDIR_TMP)/vmlinux-$(2).bin.lzma \
                of=$(KDIR_TMP)/vmlinux-$(2).bin.tmp \
-               bs=$$$$(($(kernelsize)-131072-2*64-1)) \
+               bs=$$(($(kernelsize)-131072-2*64-1)) \
                count=1 conv=sync
        $(call MkuImage,lzma,-M $(5),$(KDIR_TMP)/vmlinux-$(2).bin.tmp,$(KDIR_TMP)/vmlinux-$(2).uImage)
        echo -ne '\xff' >> $(KDIR_TMP)/vmlinux-$(2).uImage
@@ -830,7 +831,7 @@ define Image/Build/NetgearNAND
                dd if=$(KDIR_TMP)/$(2)-root.ubi \
        ) > $(imageraw)
        $(STAGING_DIR_HOST)/bin/mkdniimg \
-               -B $(6) -v OpenWrt.$(REVISION) -r "$$$$r" $(8) \
+               -B $(6) -v OpenWrt.$(REVISION) -r "$$r" $(8) \
                -i $(imageraw) \
                -o $(call imgname,ubi,$(2))-factory.img
 
@@ -865,7 +866,7 @@ define      Image/Build/ZyXELNAND/buildkernel
                --pad=$(kernelsize) --big-endian --squash-uids -v -e 128KiB \
                -o $(KDIR_TMP)/$(2)-kernel.jffs2 \
                -d $(KDIR_TMP)/$(2)/image \
-               2>&1 1>/dev/null | awk '/^.+$$$$/'
+               2>&1 1>/dev/null | awk '/^.+$$/'
        -rm -rf $(KDIR_TMP)/$(2)
 endef
 
@@ -918,7 +919,7 @@ define Image/Build/Zcomax
                $(STAGING_DIR_HOST)/bin/mkzcfw \
                        -B $(2) \
                        -k $(KDIR_TMP)/vmlinux-$(2).uImage \
-                       -r $(BIN_DIR)/$(IMG_PREFIX)-root.$(1) \
+                       -r $(KDIR)/root.$(1) \
                        -o $(call imgname,$(1),$(2))-factory.img; \
        fi
 endef
@@ -1204,9 +1205,3 @@ define Image/Build/Profile
        $(call Image/Build/Profile/$(1),buildkernel)
        $(call Image/Build/Profile/$(1),$(2))
 endef
-
-# $(1): filesystem type.
-define Image/Build
-       $(call Image/Build/$(call rootfs_type,$(1)),$(1))
-       $(call Image/Build/Profile/$(IMAGE_PROFILE),$(1))
-endef