[adm5120] build firmware image for the CR-NSADP board
[openwrt/svn-archive/archive.git] / target / linux / adm5120 / image / router_le.mk
1 #
2 # Copyright (C) 2007,2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 define trxedimax/jffs2-128k
9 -a 0x20000 -f $(KDIR)/root.jffs2-128k
10 endef
11
12 define trxedimax/jffs2-64k
13 -a 0x10000 -f $(KDIR)/root.jffs2-64k
14 endef
15
16 define trxedimax/squashfs
17 -a 1024 -f $(KDIR)/root.squashfs
18 endef
19
20 define Image/Build/TRXEdimax
21 $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
22 $(call trxedimax/$(2))
23 endef
24
25 define Image/Build/Compex
26 $(call Image/Build/Loader,$(2),gz,0x80500000,0,y,$(2))
27 $(call Image/Build/TRX,$(call imgname,$(1),$(2)).trx,$(1),$(KDIR)/loader-$(2).gz)
28 endef
29
30 define Image/Build/Edimax
31 $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
32 $(call Image/Build/TRXEdimax,$(call imgname,$(1),$(2)).trx,$(1))
33 $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d -w \
34 -r $(KDIR)/loader-$(2).gz::0x1000 \
35 -x $(call imgname,$(1),$(2)).trx:0x10000 \
36 -x $(JFFS2MARK):0x10000 \
37 $(call imgname,$(1),$(2))-webui.bin
38 $(STAGING_DIR_HOST)/bin/mkcsysimg -B $(2) -d \
39 -r $(KDIR)/loader-$(2).gz::0x1000 \
40 -x $(call imgname,$(1),$(2)).trx:0x10000 \
41 -x $(JFFS2MARK):0x10000 \
42 $(call imgname,$(1),$(2))-xmodem.bin
43 rm -f $(call imgname,$(1),$(2)).trx
44 endef
45
46 define Image/Build/Infineon
47 $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(2))
48 $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
49 dd if=$(KDIR)/loader-$(2).gz of=$(call imgname,$(1),$(2)).img bs=64k conv=sync
50 cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2)).img
51 endef
52
53 define Image/Build/Cellvision
54 $(call Image/Build/Loader,$(2),bin,0x80500000,0x6D8,y,$(3))
55 mkdir -p $(BIN_DIR)/tmp
56 cp $(KDIR)/loader-$(2).bin $(BIN_DIR)/tmp/vmlinux.bin
57 gzip -9 $(BIN_DIR)/tmp/vmlinux.bin
58 dd if=$(BIN_DIR)/tmp/vmlinux.bin.gz of=$(call imgname,$(1),$(2))-xmodem.bin bs=64k conv=sync
59 rm -rf $(BIN_DIR)/tmp
60 $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
61 cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2))-xmodem.bin
62 $(STAGING_DIR_HOST)/bin/mkcasfw -B $(2) -d \
63 -K $(call imgname,$(1),$(2))-xmodem.bin \
64 $(call imgname,$(1),$(2))-webui.bin
65 endef
66
67 define Image/Build/Cellvision2
68 # only for CAS-700/771/790/861
69 $(call Image/Build/Loader,$(2),gz,0x80500000,0x6D8,y,$(3))
70 $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
71 dd if=$(KDIR)/loader-$(2).gz of=$(call imgname,$(1),$(2)).bin bs=64k conv=sync
72 cat $(call imgname,$(1),$(2)).trx >> $(call imgname,$(1),$(2)).bin
73 echo -ne '\x14\x07\x24\x06$(2)' | dd bs=14 count=1 conv=sync >> $(call imgname,$(1),$(2)).bin
74 echo -ne 'OpenWrt\x00\x00\x00' >> $(call imgname,$(1),$(2)).bin
75 endef
76
77 define Image/Build/MyLoader
78 $(call Image/Build/Loader,$(2),gz,0x80500000,0)
79 $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
80 $(STAGING_DIR_HOST)/bin/mkmylofw -B $(2) \
81 -p0x20000:0x10000:ahp:0x80001000 \
82 -p0x30000:0 \
83 -b0x20000:0x10000:h:$(KDIR)/loader-$(2).gz \
84 -b0x30000:0::$(call imgname,$(1),$(2)).trx \
85 $(call imgname,$(1),$(2)).bin
86 endef
87
88 #
89 # Cellvision CAS-630/630W, CAS-670/670W, NFS-101U/101WU, NFS-202U/202WU
90 #
91 define Image/Build/Template/Cellvision
92 $(call Image/Build/Cellvision,$(1),$(2),$(3))
93 endef
94
95 define Image/Build/Template/Cellvision/squashfs
96 $(call Image/Build/Template/Cellvision,squashfs,$(1),$(2))
97 endef
98
99 define Image/Build/Template/Cellvision/jffs2-64k
100 $(call Image/Build/Template/Cellvision,jffs2-64k,$(1),$(2))
101 endef
102
103 #
104 # Cellvision CAS-700/700W, CAS-771/771W, CAS-790, CAS-861/861W
105 #
106 define Image/Build/Template/Cellvision2
107 $(call Image/Build/Cellvision2,$(1),$(2),$(3))
108 endef
109
110 define Image/Build/Template/Cellvision2/squashfs
111 $(call Image/Build/Template/Cellvision2,squashfs,$(1),$(2))
112 endef
113
114 define Image/Build/Template/Cellvision2/jffs2-64k
115 $(call Image/Build/Template/Cellvision2,jffs2-64k,$(1),$(2))
116 endef
117
118 define Image/Build/Template/Cellvision2/Initramfs
119 $(call Image/Build/LZMAKernel/Cellvision,$(1),$(2),gz)
120 endef
121
122 #
123 # Compex NP27G, NP28G, WP54G, WP54AG, WPP54G, WPP54AG
124 #
125 define Image/Build/Template/Compex
126 $(call Image/Build/MyLoader,$(1),$(2))
127 endef
128
129 define Image/Build/Template/Compex/squashfs
130 $(call Image/Build/Template/Compex,squashfs,$(1))
131 endef
132
133 define Image/Build/Template/Compex/jffs2-64k
134 $(call Image/Build/Template/Compex,jffs2-64k,$(1))
135 endef
136
137 define Image/Build/Template/Compex/Initramfs
138 $(call Image/Build/LZMAKernel/Generic,$(1),bin)
139 endef
140
141 #
142 # Compex WP54G-WRT
143 #
144 define Image/Build/Template/WP54GWRT
145 $(call Image/Build/Compex,$(1),wp54g-wrt)
146 endef
147
148 define Image/Build/Template/WP54GWRT/squashfs
149 $(call Image/Build/Template/WP54GWRT,squashfs)
150 endef
151
152 define Image/Build/Template/WP54GWRT/jffs2-64k
153 $(call Image/Build/Template/WP54GWRT,jffs2-64k)
154 endef
155
156 define Image/Build/Template/WP54GWRT/Initramfs
157 $(call Image/Build/LZMAKernel/KArgs,wp54g-wrt,bin)
158 endef
159
160 #
161 # Edimax BR-6104K, BR-6104KP, BR-6104Wg, BR-6114WG
162 #
163 define Image/Build/Template/Edimax
164 $(call Image/Build/Edimax,$(1),$(2))
165 endef
166
167 define Image/Build/Template/Edimax/squashfs
168 $(call Image/Build/Template/Edimax,squashfs,$(1))
169 endef
170
171 define Image/Build/Template/Edimax/Initramfs
172 $(call Image/Build/LZMAKernel/Admboot,$(1),gz)
173 endef
174
175 #
176 # Infineon EASY 5120, EASY 83000
177 #
178 define Image/Build/Template/Infineon
179 $(call Image/Build/Infineon,$(1),$(2))
180 endef
181
182 define Image/Build/Template/Infineon/squashfs
183 $(call Image/Build/Template/Infineon,squashfs,$(1))
184 endef
185
186 define Image/Build/Template/Infineon/jffs2-64k
187 $(call Image/Build/Template/Infineon,jffs2-64k,$(1))
188 endef
189
190 define Image/Build/Template/Infineon/Initramfs
191 $(call Image/Build/LZMAKernel/Admboot,$(1),gz)
192 endef
193
194 #
195 # Mikrotik RouterBOARD 1xx
196 #
197 define Image/Build/Template/Mikrotik/Initramfs
198 $(CP) $(KDIR)/vmlinux.elf $(call imgname,netboot,rb1xx)
199 endef
200
201 #
202 # Profiles
203 #
204 define Image/Build/Profile/CAS630
205 $(call Image/Build/Template/Cellvision/$(1),cas-630,cas-630)
206 endef
207
208 define Image/Build/Profile/CAS630W
209 $(call Image/Build/Template/Cellvision/$(1),cas-630w,cas-630)
210 endef
211
212 define Image/Build/Profile/CAS670
213 $(call Image/Build/Template/Cellvision/$(1),cas-670,cas-670)
214 endef
215
216 define Image/Build/Profile/CAS670W
217 $(call Image/Build/Template/Cellvision/$(1),cas-670w,cas-670)
218 endef
219
220 define Image/Build/Profile/NFS101U
221 $(call Image/Build/Template/Cellvision/$(1),nfs-101u,nfs-101u)
222 $(call Image/Build/Template/Cellvision/$(1),dn-7013,nfs-101u)
223 $(call Image/Build/Template/Cellvision/$(1),dns-120,nfs-101u)
224 $(call Image/Build/Template/Cellvision/$(1),mu-5000fs,nfs-101u)
225 $(call Image/Build/Template/Cellvision/$(1),tn-u100,nfs-101u)
226 $(call Image/Build/Template/Cellvision/$(1),cr-nsadp,nfs-101u)
227 endef
228
229 define Image/Build/Profile/NFS101WU
230 $(call Image/Build/Template/Cellvision/$(1),nfs-101wu,nfs-101u)
231 $(call Image/Build/Template/Cellvision/$(1),dns-g120,nfs-101u)
232 endef
233
234 define Image/Build/Profile/CAS700
235 $(call Image/Build/Template/Cellvision2/$(1),cas-700,cas-700)
236 endef
237
238 define Image/Build/Profile/CAS700W
239 $(call Image/Build/Template/Cellvision2/$(1),cas-700w,cas-700)
240 endef
241
242 define Image/Build/Profile/CAS771
243 $(call Image/Build/Template/Cellvision2/$(1),cas-771,cas-771)
244 endef
245
246 define Image/Build/Profile/CAS771W
247 $(call Image/Build/Template/Cellvision2/$(1),cas-771w,cas-771)
248 endef
249
250 define Image/Build/Profile/CAS790
251 $(call Image/Build/Template/Cellvision2/$(1),cas-790,cas-790)
252 endef
253
254 define Image/Build/Profile/CAS861
255 $(call Image/Build/Template/Cellvision2/$(1),cas-861,cas-861)
256 endef
257
258 define Image/Build/Profile/CAS861W
259 $(call Image/Build/Template/Cellvision2/$(1),cas-861w,cas-861)
260 endef
261
262 define Image/Build/Profile/NP27G
263 $(call Image/Build/Template/Compex/$(1),np27g)
264 endef
265
266 define Image/Build/Profile/NP28G
267 $(call Image/Build/Template/Compex/$(1),np28g)
268 endef
269
270 define Image/Build/Profile/WP54
271 $(call Image/Build/Template/Compex/$(1),wp54g)
272 $(call Image/Build/Template/Compex/$(1),wp54ag)
273 $(call Image/Build/Template/Compex/$(1),wpp54g)
274 $(call Image/Build/Template/Compex/$(1),wpp54ag)
275 $(call Image/Build/Template/WP54GWRT/$(1))
276 endef
277
278 define Image/Build/Profile/BR6104K
279 $(call Image/Build/Template/Edimax/$(1),br-6104k)
280 endef
281
282 define Image/Build/Profile/BR6104KP
283 $(call Image/Build/Template/Edimax/$(1),br-6104kp)
284 endef
285
286 define Image/Build/Profile/BR6104WG
287 $(call Image/Build/Template/Edimax/$(1),br-6104wg)
288 endef
289
290 define Image/Build/Profile/BR6114WG
291 $(call Image/Build/Template/Edimax/$(1),br-6114wg)
292 endef
293
294 define Image/Build/Profile/EASY83000
295 $(call Image/Build/Template/Infineon/$(1),easy-83000)
296 endef
297
298 define Image/Build/Profile/EASY5120RT
299 $(call Image/Build/Template/Infineon/$(1),easy-5120-rt)
300 endef
301
302 define Image/Build/Profile/EASY5120PATA
303 $(call Image/Build/Template/Infineon/$(1),easy-5120p-ata)
304 endef
305
306 define Image/Build/Profile/PMUGW
307 $(call Image/Build/Template/Infineon/$(1),powerline-mugw)
308 endef
309
310 define Image/Build/Profile/RouterBoard
311 $(call Image/Build/Template/Mikrotik/$(1))
312 endef
313
314 ifeq ($(CONFIG_BROKEN),y)
315 define Image/Build/Experimental
316 # Cellvison
317 $(call Image/Build/Profile/CAS630,$(1))
318 $(call Image/Build/Profile/CAS630W,$(1))
319 $(call Image/Build/Profile/CAS670,$(1))
320 $(call Image/Build/Profile/CAS670W,$(1))
321 $(call Image/Build/Profile/CAS700,$(1))
322 $(call Image/Build/Profile/CAS700W,$(1))
323 $(call Image/Build/Profile/CAS771,$(1))
324 $(call Image/Build/Profile/CAS771W,$(1))
325 $(call Image/Build/Profile/CAS861,$(1))
326 $(call Image/Build/Profile/CAS861W,$(1))
327 $(call Image/Build/Profile/NFS101U,$(1))
328 $(call Image/Build/Profile/NFS101WU,$(1))
329 # Motorola
330 $(call Image/Build/Profile/PMUGW,$(1))
331 endef
332 endif
333
334 define Image/Build/Profile/Generic
335 # Compex
336 $(call Image/Build/Profile/WP54,$(1))
337 $(call Image/Build/Profile/NP27G,$(1))
338 $(call Image/Build/Profile/NP28G,$(1))
339 # Edimax
340 $(call Image/Build/Profile/BR6104K,$(1))
341 $(call Image/Build/Profile/BR6104KP,$(1))
342 $(call Image/Build/Profile/BR6104WG,$(1))
343 $(call Image/Build/Profile/BR6114WG,$(1))
344 # Infineon
345 $(call Image/Build/Profile/EASY83000,$(1))
346 $(call Image/Build/Profile/EASY5120RT,$(1))
347 $(call Image/Build/Profile/EASY5120PATA,$(1))
348 # Mikrotik
349 $(call Image/Build/Profile/RB1xx/$(1))
350
351 $(call Image/Build/Experimental,$(1))
352 endef
353
354 ifeq ($(PROFILE),RouterBoard)
355 define Image/cmdline/yaffs2
356 root=/dev/mtdblock3 rootfstype=yaffs2 init=/etc/preinit
357 endef
358
359 define Image/BuildKernel/RouterBoard
360 $(CP) $(KDIR)/vmlinux.elf $(call imgname,kernel,rb1xx)
361 $(STAGING_DIR_HOST)/bin/patch-cmdline $(call imgname,kernel,rb1xx) \
362 '$(strip $(call Image/cmdline/yaffs2))'
363 endef
364
365 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
366 define Image/BuildKernel
367 $(call Image/BuildKernel/RouterBoard)
368 endef
369 endif
370
371 endif
372