ar71xx: create rescue image for the WZR-HP-G300NH
[librecmc/librecmc.git] / target / linux / ar71xx / image / Makefile
index 746f52576ece21c383e70a6b22689489649332b2..09d743c479d5421c1e82c557103b3bd44775d3ab 100644 (file)
@@ -77,6 +77,26 @@ define Image/Build/WRT400N
        fi; fi
 endef
 
+dir600a1_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,896k(kernel),2816k(rootfs),64k(mac)ro,64k(art)ro,3712k@0x40000(firmware)
+define Image/Build/DIR600A1
+       $(call PatchKernelLzma,$(2),$(3) $(dir600a1_mtdlayout))
+       if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 917504 ]; then \
+               echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
+       else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 2818048 ]; then \
+               echo "Warning: $(KDIR)/root.$(1) is too big"; \
+       else \
+               mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
+                       0x80060000 \
+                       -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
+                       -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
+               ( \
+                       dd if=$(KDIR)/vmlinux-$(2).uImage bs=896k conv=sync; \
+                       dd if=$(KDIR)/root.$(1) bs=2752k conv=sync; \
+                       echo -n "AP91-AR7240-RT-090223-00"; \
+               ) > $(call imgname,$(1),$(2))-universal.bin; \
+       fi; fi
+endef
+
 dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x50000(firmware)
 define Image/Build/DIR825B1
        $(call PatchKernelLzma,$(2),$(3) $(dir825b1_mtdlayout))
@@ -94,6 +114,28 @@ define Image/Build/DIR825B1
        fi; fi
 endef
 
+define Image/Build/WZRHPG300NH
+       $(call PatchKernelLzma,$(2),$(3))
+       if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt 1048576 ]; then \
+               echo "Warning: $(KDIR)/vmlinux-$(2).bin.lzma is too big"; \
+       else if [ `stat -c%s $(KDIR)/root.$(1)` -gt 31850496 ]; then \
+               echo "Warning: $(KDIR)/root.$(1) is too big"; \
+       else \
+               mkimage -A mips -O linux -T kernel -a 0x80060000 -C lzma -e \
+                       0x80060000 \
+                       -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
+                       -d $(KDIR)/vmlinux-$(2).bin.lzma $(KDIR)/vmlinux-$(2).uImage; \
+               ( \
+                       dd if=$(KDIR)/vmlinux-$(2).uImage bs=1024k conv=sync; \
+                       dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
+               ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
+               ( \
+                       echo -n -e "# Airstation Public Fmt1\x00\x00\x00\x00\x00\x00\x00\x00"; \
+                       dd if=$(call imgname,$(1),$(2))-sysupgrade.bin; \
+               ) > $(call imgname,$(1),$(2))-tftp.bin; \
+       fi; fi
+endef
+
 cameo_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,896k(kernel),2880k(rootfs),64k(art)ro,3776k@0x30000(firmware)
 define Image/Build/Cameo
        $(call PatchKernelLzma,$(2),$(3) $(cameo_mtdlayout))
@@ -267,7 +309,7 @@ define Image/Build/WNDR3700
                $(KDIR)/vmlinux-$(2).uImage.squashfs
        -rm -f $(KDIR)/vmlinux-$(2).uImage.squashfs.tmp*
        ( \
-               dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1M conv=sync; \
+               dd if=$(KDIR)/vmlinux-$(2).uImage.squashfs bs=1024k conv=sync; \
                dd if=$(KDIR)/root.$(1) bs=64k; \
        ) > $(call imgname,$(1),$(2))-sysupgrade.bin
        $(STAGING_DIR_HOST)/bin/mkdniimg \
@@ -328,6 +370,10 @@ define Image/Build/Profile/WP543
        $(call Image/Build/Template/64k/$(1),MyLoader,wp543)
 endef
 
+define Image/Build/Profile/DIR600A1
+       $(call Image/Build/Template/64k/$(1),DIR600A1,dir-600-a1,board=DIR-600-A1)
+endef
+
 define Image/Build/Profile/DIR615C1
        $(call Image/Build/Template/squashfs-only/$(1),Cameo,dir-615-c1,board=DIR-615-C1,"AP81-AR9130-RT-070614-02")
 endef
@@ -425,10 +471,15 @@ define Image/Build/Profile/WRT160NL
        $(call Image/Build/Template/64k/$(1),CyberTAN,wrt160nl,board=WRT160NL,1.00.01)
 endef
 
+define Image/Build/Profile/WZRHPG300NH
+       $(call Image/Build/Template/128k/$(1),WZRHPG300NH,wzr-hp-g300nh,board=WZR-HP-G300NH)
+endef
+
 define Image/Build/Profile/Default
        $(call Image/Build/Profile/AP81,$(1))
        $(call Image/Build/Profile/AP83,$(1))
        $(call Image/Build/Profile/A02RBW300N,$(1))
+       $(call Image/Build/Profile/DIR600A1,$(1))
        $(call Image/Build/Profile/DIR615C1,$(1))
        $(call Image/Build/Profile/DIR825B1,$(1))
        $(call Image/Build/Profile/MZKW04NU,$(1))
@@ -448,6 +499,7 @@ define Image/Build/Profile/Default
        $(call Image/Build/Profile/WNDR3700,$(1))
        $(call Image/Build/Profile/WRT400N,$(1))
        $(call Image/Build/Profile/WRT160NL,$(1))
+       $(call Image/Build/Profile/WZRHPG300NH,$(1))
 endef
 
 define Image/Build/Profile/Madwifi