37fcb369378fd4971055c02a9bb76eff32d3755f
[openwrt/openwrt.git] / target / linux / ath79 / image / nand.mk
1 DEVICE_VARS += RAS_ROOTFS_SIZE RAS_BOARD RAS_VERSION
2
3 # attention: only zlib compression is allowed for the boot fs
4 define Build/zyxel-buildkerneljffs
5 rm -rf $(KDIR_TMP)/zyxelnbg6716
6 mkdir -p $(KDIR_TMP)/zyxelnbg6716/image/boot
7 cp $@ $(KDIR_TMP)/zyxelnbg6716/image/boot/vmlinux.lzma.uImage
8 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
9 --big-endian --squash-uids -v -e 128KiB -q -f -n -x lzma -x rtime \
10 -o $@ \
11 -d $(KDIR_TMP)/zyxelnbg6716/image
12 rm -rf $(KDIR_TMP)/zyxelnbg6716
13 endef
14
15 define Build/zyxel-factory
16 let \
17 maxsize="$(subst k,* 1024,$(RAS_ROOTFS_SIZE))"; \
18 let size="$$(stat -c%s $@)"; \
19 if [ $$size -lt $$maxsize ]; then \
20 $(STAGING_DIR_HOST)/bin/mkrasimage \
21 -b $(RAS_BOARD) \
22 -v $(RAS_VERSION) \
23 -r $@ \
24 -s $$maxsize \
25 -o $@.new \
26 -l 131072 \
27 && mv $@.new $@ ; \
28 fi
29 endef
30
31 define Device/8dev_rambutan
32 SOC := qca9557
33 DEVICE_VENDOR := 8devices
34 DEVICE_MODEL := Rambutan
35 DEVICE_PACKAGES := kmod-usb2
36 BLOCKSIZE := 128k
37 PAGESIZE := 2048
38 KERNEL_SIZE := 4096k
39 KERNEL_IN_UBI := 1
40 IMAGES := factory.bin sysupgrade.tar
41 IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
42 IMAGE/factory.bin := append-ubi
43 endef
44 TARGET_DEVICES += 8dev_rambutan
45
46 define Device/aerohive_hiveap-121
47 SOC := ar9344
48 DEVICE_VENDOR := Aerohive
49 DEVICE_MODEL := HiveAP 121
50 DEVICE_PACKAGES := kmod-usb2
51 BLOCKSIZE := 128k
52 PAGESIZE := 2048
53 IMAGE_SIZE := 116m
54 KERNEL_SIZE := 5120k
55 UBINIZE_OPTS := -E 5
56 SUPPORTED_DEVICES += hiveap-121
57 IMAGES += factory.bin
58 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
59 check-size
60 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
61 endef
62 TARGET_DEVICES += aerohive_hiveap-121
63
64 define Device/domywifi_dw33d
65 SOC := qca9558
66 DEVICE_VENDOR := DomyWifi
67 DEVICE_MODEL := DW33D
68 DEVICE_PACKAGES := kmod-usb2 kmod-usb-storage kmod-usb-ledtrig-usbport \
69 kmod-ath10k-ct ath10k-firmware-qca988x-ct
70 KERNEL_SIZE := 5120k
71 IMAGE_SIZE := 98304k
72 BLOCKSIZE := 128k
73 PAGESIZE := 2048
74 UBINIZE_OPTS := -E 5
75 IMAGES += factory.bin
76 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
77 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
78 check-size
79 endef
80 TARGET_DEVICES += domywifi_dw33d
81
82 define Device/glinet_gl-ar300m-common-nand
83 SOC := qca9531
84 DEVICE_VENDOR := GL.iNet
85 DEVICE_MODEL := GL-AR300M
86 DEVICE_PACKAGES := kmod-usb2
87 KERNEL_SIZE := 4096k
88 IMAGE_SIZE := 16000k
89 PAGESIZE := 2048
90 VID_HDR_OFFSET := 2048
91 endef
92
93 define Device/glinet_gl-ar300m-nand
94 $(Device/glinet_gl-ar300m-common-nand)
95 DEVICE_VARIANT := NAND
96 BLOCKSIZE := 128k
97 IMAGES += factory.img
98 IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
99 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
100 SUPPORTED_DEVICES += glinet,gl-ar300m-nor
101 endef
102 TARGET_DEVICES += glinet_gl-ar300m-nand
103
104 define Device/glinet_gl-ar300m-nor
105 $(Device/glinet_gl-ar300m-common-nand)
106 DEVICE_VARIANT := NOR
107 BLOCKSIZE := 64k
108 SUPPORTED_DEVICES += glinet,gl-ar300m-nand gl-ar300m
109 endef
110 TARGET_DEVICES += glinet_gl-ar300m-nor
111
112 define Device/glinet_gl-ar750s-common
113 SOC := qca9563
114 DEVICE_VENDOR := GL.iNet
115 DEVICE_MODEL := GL-AR750S
116 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9887-ct kmod-usb2 \
117 kmod-usb-storage block-mount
118 IMAGE_SIZE := 16000k
119 endef
120
121 define Device/glinet_gl-ar750s-nor-nand
122 $(Device/glinet_gl-ar750s-common)
123 DEVICE_VARIANT := NOR/NAND
124 KERNEL_SIZE := 4096k
125 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
126 SUPPORTED_DEVICES += glinet,gl-ar750s-nor
127 endef
128 TARGET_DEVICES += glinet_gl-ar750s-nor-nand
129
130 define Device/glinet_gl-ar750s-nor
131 $(Device/glinet_gl-ar750s-common)
132 DEVICE_VARIANT := NOR
133 BLOCKSIZE := 64k
134 SUPPORTED_DEVICES += gl-ar750s glinet,gl-ar750s glinet,gl-ar750s-nor-nand
135 endef
136 TARGET_DEVICES += glinet_gl-ar750s-nor
137
138 define Device/glinet_gl-e750
139 SOC := qca9531
140 DEVICE_VENDOR := GL.iNet
141 DEVICE_MODEL := GL-E750
142 DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9887-ct kmod-usb2
143 SUPPORTED_DEVICES += gl-e750
144 KERNEL_SIZE := 4096k
145 IMAGE_SIZE := 131072k
146 PAGESIZE := 2048
147 VID_HDR_OFFSET := 2048
148 BLOCKSIZE := 128k
149 IMAGES += factory.img
150 IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
151 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
152 endef
153 TARGET_DEVICES += glinet_gl-e750
154
155 # fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + 0xff)
156 define Device/netgear_ath79_nand
157 DEVICE_VENDOR := NETGEAR
158 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
159 KERNEL_SIZE := 4096k
160 BLOCKSIZE := 128k
161 PAGESIZE := 2048
162 IMAGE_SIZE := 25600k
163 KERNEL := kernel-bin | append-dtb | lzma -d20 | \
164 pad-offset $$(KERNEL_SIZE) 129 | uImage lzma | \
165 append-string -e '\xff' | \
166 append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC)
167 KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma
168 IMAGES := sysupgrade.bin factory.img
169 IMAGE/factory.img := append-kernel | append-ubi | netgear-dni | \
170 check-size
171 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | \
172 check-size
173 UBINIZE_OPTS := -E 5
174 endef
175
176 define Device/netgear_wndr3700-v4
177 SOC := ar9344
178 DEVICE_MODEL := WNDR3700
179 DEVICE_VARIANT := v4
180 UIMAGE_MAGIC := 0x33373033
181 NETGEAR_BOARD_ID := WNDR3700v4
182 NETGEAR_HW_ID := 29763948+128+128
183 $(Device/netgear_ath79_nand)
184 endef
185 TARGET_DEVICES += netgear_wndr3700-v4
186
187 define Device/netgear_wndr4300
188 SOC := ar9344
189 DEVICE_MODEL := WNDR4300
190 UIMAGE_MAGIC := 0x33373033
191 NETGEAR_BOARD_ID := WNDR4300
192 NETGEAR_HW_ID := 29763948+0+128+128+2x2+3x3
193 $(Device/netgear_ath79_nand)
194 endef
195 TARGET_DEVICES += netgear_wndr4300
196
197 define Device/netgear_wndr4300sw
198 SOC := ar9344
199 DEVICE_MODEL := WNDR4300SW
200 UIMAGE_MAGIC := 0x33373033
201 NETGEAR_BOARD_ID := WNDR4300SW
202 NETGEAR_HW_ID := 29763948+0+128+128+2x2+3x3
203 $(Device/netgear_ath79_nand)
204 endef
205 TARGET_DEVICES += netgear_wndr4300sw
206
207 define Device/netgear_wndr4300tn
208 SOC := ar9344
209 DEVICE_MODEL := WNDR4300TN
210 UIMAGE_MAGIC := 0x33373033
211 NETGEAR_BOARD_ID := WNDR4300TN
212 NETGEAR_HW_ID := 29763948+0+128+128+2x2+3x3
213 $(Device/netgear_ath79_nand)
214 endef
215 TARGET_DEVICES += netgear_wndr4300tn
216
217 define Device/netgear_wndr4300-v2
218 SOC := qca9563
219 DEVICE_MODEL := WNDR4300
220 DEVICE_VARIANT := v2
221 UIMAGE_MAGIC := 0x27051956
222 NETGEAR_BOARD_ID := WNDR4500series
223 NETGEAR_HW_ID := 29764821+2+128+128+3x3+3x3+5508012175
224 $(Device/netgear_ath79_nand)
225 endef
226 TARGET_DEVICES += netgear_wndr4300-v2
227
228 define Device/netgear_wndr4500-v3
229 SOC := qca9563
230 DEVICE_MODEL := WNDR4500
231 DEVICE_VARIANT := v3
232 UIMAGE_MAGIC := 0x27051956
233 NETGEAR_BOARD_ID := WNDR4500series
234 NETGEAR_HW_ID := 29764821+2+128+128+3x3+3x3+5508012173
235 $(Device/netgear_ath79_nand)
236 endef
237 TARGET_DEVICES += netgear_wndr4500-v3
238
239 define Device/zyxel_nbg6716
240 SOC := qca9558
241 DEVICE_VENDOR := ZyXEL
242 DEVICE_MODEL := NBG6716
243 DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-ath10k-ct \
244 ath10k-firmware-qca988x-ct
245 RAS_BOARD := NBG6716
246 RAS_ROOTFS_SIZE := 29696k
247 RAS_VERSION := "OpenWrt Linux-$(LINUX_VERSION)"
248 KERNEL_SIZE := 4096k
249 BLOCKSIZE := 128k
250 PAGESIZE := 2048
251 KERNEL := kernel-bin | append-dtb | uImage none | zyxel-buildkerneljffs | \
252 check-size 4096k
253 IMAGES := sysupgrade.tar sysupgrade-4M-Kernel.bin factory.bin
254 IMAGE/sysupgrade.tar/squashfs := append-rootfs | pad-to $$$$(BLOCKSIZE) | \
255 sysupgrade-tar rootfs=$$$$@ | append-metadata
256 IMAGE/sysupgrade-4M-Kernel.bin/squashfs := append-kernel | \
257 pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to 263192576 | gzip
258 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
259 zyxel-factory
260 UBINIZE_OPTS := -E 5
261 endef
262 TARGET_DEVICES += zyxel_nbg6716