Don't try to generate whr-g300n image if it's going to be more than 4M
[openwrt.git] / target / linux / ramips / image / Makefile
index df5649a4270fc700f8de31b45126e786c1d09f2a..63f7425a9ed5ee68a8f6bf2c5e909abc87d9b145 100644 (file)
@@ -456,13 +456,15 @@ define BuildFirmware/WHRG300N/squashfs
        $(call BuildFirmware/Default4M/$(1),$(1),whr-g300n,WHR-G300N)
        # the following line has a bad argument 3 ... the old Makefile was already broken       
        $(call BuildFirmware/Buffalo,$(1),whr-g300n,whr-g300n)
-       ( \
-               echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
-                       dd bs=512 count=1 conv=sync; \
-               dd if=$(call sysupname,$(1),whr-g300n); \
-       ) > $(KDIR)/whr-g300n-tftp.tmp
-       buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
-               -o $(call imgname,$(1),whr-g300n)-tftp.bin
+       if [ -e "$(call sysupname,$(1),$(2))" ]; then \
+               ( \
+                       echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
+                               dd bs=512 count=1 conv=sync; \
+                       dd if=$(call sysupname,$(1),whr-g300n); \
+               ) > $(KDIR)/whr-g300n-tftp.tmp && \
+               buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
+                       -o $(call imgname,$(1),whr-g300n)-tftp.bin; \
+       fi
 endef
 BuildFirmware/WHRG300N/initramfs=$(call BuildFirmware/OF/initramfs,$(1),whr-g300n,WHR-G300N)
 Image/Build/Profile/WHRG300N=$(call BuildFirmware/WHRG300N/$(1),$(1))
@@ -599,6 +601,33 @@ endif
 #
 # RT3662/RT3883 Profiles
 #
+
+# $(1) = squashfs/initramfs
+# $(2) = lowercase board name
+# $(3) = dts file
+# $(4) = kernel size
+# $(5) = rootfs size
+# $(6) = signature
+# $(7) = model
+# $(8) = flash address
+# $(9) = start address
+define BuildFirmware/EdimaxCombined/squashfs
+       $(call PatchKernelLzmaDtb,$(2),$(3))
+       $(call MkImage,lzma,$(KDIR)/vmlinux-$(2).bin.lzma,$(KDIR)/vmlinux-$(2).bin.uImage)
+       if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.uImage"` -gt `expr $(4) - 20` ]; then \
+               echo "Warning: $(KDIR)/vmlinux-$(2).bin.uImage is too big" >&2; \
+               exit 1; \
+       else if [ `stat -c%s "$(KDIR)/root.$(1)"` -gt $(5) ]; then \
+               echo "Warning: $(KDIR)/root.$(1) is too big" >&2; \
+               exit 1; \
+       else \
+               ( dd if=$(KDIR)/vmlinux-$(2).bin.uImage bs=`expr $(4) - 20` conv=sync ; dd if=$(KDIR)/root.$(1) ) > $(KDIR)/vmlinux-$(2).bin.uImage.combined ; \
+       fi ; fi
+       mkedimaximg -i "$(KDIR)/vmlinux-$(2).bin.uImage.combined" \
+               -o $(call imgname,$(1),$(2)).bin \
+               -s $(6) -m $(7) -f $(8) -S $(9)
+endef
+
 Image/Build/Profile/DIR645=$(call BuildFirmware/Seama/$(1),$(1),dir-645,DIR-645,wrgn39_dlob.hans_dir645,$(ralink_default_fw_size_8M))
 
 omniembhpm_mtd_size=16449536
@@ -610,11 +639,16 @@ Image/Build/Profile/TEW691GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-691gr,TEW
 
 Image/Build/Profile/TEW692GR=$(call BuildFirmware/UMedia/$(1),$(1),tew-692gr,TEW-692GR,0x026920)
 
+kernel_size_BR6475ND:=2097152
+rootfs_size_BR6475ND:=5832704
+Image/Build/Profile/BR6475ND=$(call BuildFirmware/EdimaxCombined/$(1),$(1),br-6475nd,BR-6475ND,$(kernel_size_BR6475ND),$(rootfs_size_BR6475ND),CSYS,RN54,0x70000,0x01100000)
+
 ifeq ($(SUBTARGET),rt3883)
 define Image/Build/Profile/Default
        $(call Image/Build/Profile/DIR645,$(1))
        $(call Image/Build/Profile/OMNIEMBHPM,$(1))
        $(call Image/Build/Profile/RTN56U,$(1))
+       $(call Image/Build/Profile/BR6475ND,$(1))
        $(call Image/Build/Profile/TEW691GR,$(1))
        $(call Image/Build/Profile/TEW692GR,$(1))
 endef
@@ -634,6 +668,8 @@ Image/Build/Profile/WHR300HP2=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-300
 Image/Build/Profile/WHR600D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-600d,WHR-600D,$(whr_300hp2_mtd_size))
 dlink810l_mtd_size=6881280
 Image/Build/Profile/DIR-810L=$(call BuildFirmware/CustomFlash/$(1),$(1),dir-810l,DIR-810L,$(dlink810l_mtd_size))
+na930_mtd_size=20971520
+Image/Build/Profile/NA930=$(call BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
 
 ifeq ($(SUBTARGET),mt7620a)
 define Image/Build/Profile/Default
@@ -645,6 +681,7 @@ define Image/Build/Profile/Default
        $(call Image/Build/Profile/DIR-810L,$(1))
        $(call Image/Build/Profile/WHR300HP2,$(1))
        $(call Image/Build/Profile/WHR600D,$(1))
+       $(call Image/Build/Profile/NA930,$(1))
 endef
 endif
 
@@ -655,11 +692,13 @@ endif
 
 Image/Build/Profile/WMR300=$(call BuildFirmware/Default8M/$(1),$(1),wmr-300,WMR300)
 Image/Build/Profile/RT-N14U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n14u,RT-N14U)
+Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WRTNODE)
 
 ifeq ($(SUBTARGET),mt7620n)
 define Image/Build/Profile/Default
        $(call Image/Build/Profile/WMR300,$(1))
        $(call Image/Build/Profile/RT-N14U,$(1))
+       $(call Image/Build/Profile/WRTNODE,$(1))
 endef
 endif