ar71xx: Add support for ZyXEL NBG6616.
[openwrt/staging/hauke.git] / target / linux / ar71xx / image / Makefile
index 15cf2c6b8bff594e1c88568950f3e3c0098b2581..29e5064909e6282b28eaf4c5b518e8c01fe5634b 100644 (file)
@@ -2055,6 +2055,39 @@ ifdef CONFIG_PACKAGE_uboot-ar71xx-nbg460n_550n_550nh
   endef
 endif
 
+define Device/NBG6616
+       BOARDNAME = NBG6616
+       KERNEL_SIZE = 2048k
+       IMAGE_SIZE = 15323k
+       MTDPARTS = spi0.0:192k(u-boot)ro,64k(env)ro,64k(RFdata)ro,384k(zyxel_rfsd),384k(romd),64k(header),2048k(kernel),13184k(rootfs),15232k@0x120000(firmware)
+       CMDLINE += mem=128M
+       IMAGES := sysupgrade.bin
+       KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage
+       IMAGE/sysupgrade.bin = append-kernel $$$$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
+       # We cannot currently build a factory image. It is the sysupgrade image
+       # prefixed with a header (which is actually written into the MTD device).
+       # The header is 2kiB and is filled with 0xff. The format seems to be:
+       #   2 bytes:  0x0000
+       #   2 bytes:  checksum of the data partition (big endian)
+       #   4 bytes:  length of the contained image file (big endian)
+       #  32 bytes:  Firmware Version string (NUL terminated, 0xff padded)
+       #   2 bytes:  0x0000
+       #   2 bytes:  checksum over the header partition (big endian)
+       #  32 bytes:  Model (e.g. "NBG6616", NUL termiated, 0xff padded)
+       #      rest: 0xff padding
+       #
+       # The checksums are calculated by adding up all bytes and if a 16bit
+       # overflow occurs, one is added and the sum is masked to 16 bit:
+       #   csum = csum + databyte; if (csum > 0xffff) { csum += 1; csum &= 0xffff };
+       # Should the file have an odd number of bytes then the byte len-0x800 is
+       # used additionally.
+       # The checksum for the header is calcualted over the first 2048 bytes with
+       # the firmware checksum as the placeholder during calculation.
+       #
+       # The header is padded with 0xff to the erase block size of the device.
+endef
+
+TARGET_DEVICES += NBG6616
 
 define Image/Build/ZyXELNAND/buildkernel
        $(eval kernelsize=$(call mtdpartsize,kernel,$(5)))