add support for more lantiq AR9 boards
[openwrt/staging/stintel.git] / target / linux / lantiq / image / Makefile
1 #
2 # Copyright (C) 2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 JFFS2_BLOCKSIZE = 64k 128k 256k
11
12 ase_cmdline=-console=ttyLTQ0,115200 rootfstype=squashfs,jffs2
13 xway_cmdline=-console=ttyLTQ1,115200 rootfstype=squashfs,jffs2
14 falcon_cmdline=-console=ttyLTQ0,115200 rootfstype=squashfs,jffs2
15
16 define CompressLzma
17 $(STAGING_DIR_HOST)/bin/lzma e $(1) $(2)
18 endef
19
20 define PatchKernelLzma
21 cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
22 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))'
23 $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).lzma)
24 endef
25
26 define MkImageLzma
27 mkimage -A mips -O linux -T kernel -a 0x80002000 -C lzma \
28 -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
29 -d $(KDIR)/vmlinux-$(1).lzma $(KDIR)/uImage-$(1)
30 endef
31
32 define Image/Build/squashfs
33 cat $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
34 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
35 endef
36
37 define Image/Build/jffs2-64k
38 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=64k conv=sync
39 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
40 endef
41
42 define Image/Build/jffs2-128k
43 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=128k conv=sync
44 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
45 endef
46
47 define Image/Build/jffs2-256k
48 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=256k conv=sync
49 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
50 endef
51
52 define Image/BuildKernel/Template
53 $(call PatchKernelLzma,$(1),$(if $(2),$(2) machtype=$(1),))
54 $(call MkImageLzma,$(1))
55 $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
56 endef
57
58 ifeq ($(CONFIG_TARGET_lantiq_danube),y)
59 define Image/BuildKernel/Profile/EASY50712
60 $(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
61 endef
62
63 define Image/Build/Profile/EASY50712
64 $(call Image/Build/$(1),$(1),EASY50712)
65 endef
66
67 define Image/BuildKernel/Profile/EASY50812
68 $(call Image/BuildKernel/Template,EASY50812,$(xway_cmdline))
69 endef
70
71 define Image/Build/Profile/EASY50812
72 $(call Image/Build/$(1),$(1),EASY50812)
73 endef
74
75 define Image/BuildKernel/Profile/ARV3527P
76 $(call Image/BuildKernel/Template,ARV3527P,$(xway_cmdline))
77 endef
78
79 define Image/Build/Profile/ARV3527P
80 $(call Image/Build/$(1),$(1),ARV3527P)
81 endef
82
83 define Image/BuildKernel/Profile/ARV4510PW
84 $(call Image/BuildKernel/Template,ARV4510PW,$(xway_cmdline))
85 endef
86
87 define Image/Build/Profile/ARV4510PW
88 $(call Image/Build/$(1),$(1),ARV4510PW)
89 endef
90
91 define Image/BuildKernel/Profile/ARV4518PW
92 $(call Image/BuildKernel/Template,ARV4518PW,$(xway_cmdline))
93 endef
94
95 define Image/Build/Profile/ARV4518PW
96 $(call Image/Build/$(1),$(1),ARV4518PW)
97 endef
98
99 define Image/BuildKernel/Profile/ARV4520PW
100 $(call Image/BuildKernel/Template,ARV4520PW,$(xway_cmdline))
101 endef
102
103 define Image/Build/Profile/ARV4520PW
104 $(call Image/Build/$(1),$(1),ARV4520PW)
105 endef
106
107 define Image/BuildKernel/Profile/ARV4525PW
108 $(call Image/BuildKernel/Template,ARV4525PW,$(xway_cmdline))
109 endef
110
111 define Image/Build/Profile/ARV4525PW
112 $(call Image/Build/$(1),$(1),ARV4525PW)
113 endef
114
115 define Image/BuildKernel/Profile/ARV7525PW
116 $(call Image/BuildKernel/Template,ARV7525PW,$(xway_cmdline))
117 endef
118
119 define Image/Build/Profile/ARV7525PW
120 $(call Image/Build/$(1),$(1),ARV7525PW)
121 endef
122
123 define Image/BuildKernel/Profile/ARV452CPW
124 $(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
125 endef
126
127 define Image/Build/Profile/ARV452CPW
128 $(call Image/Build/$(1),$(1),ARV452CPW)
129 endef
130
131 define Image/BuildKernel/Profile/ARV7518PW
132 $(call Image/BuildKernel/Template,ARV7518PW,$(xway_cmdline))
133 endef
134
135 define Image/Build/Profile/ARV7518PW
136 $(call Image/Build/$(1),$(1),ARV7518PW)
137 endef
138
139 define Image/BuildKernel/Profile/ARV752DPW
140 $(call Image/BuildKernel/Template,ARV752DPW,$(xway_cmdline))
141 endef
142
143 define Image/Build/Profile/ARV752DPW
144 $(call Image/Build/$(1),$(1),ARV752DPW)
145 endef
146
147 define Image/BuildKernel/Profile/ARV752DPW22
148 $(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
149 endef
150
151 define Image/Build/Profile/ARV752DPW22
152 $(call Image/Build/$(1),$(1),ARV752DPW22)
153 endef
154
155 define Image/BuildKernel/Profile/GIGASX76X
156 $(call Image/BuildKernel/Template,GIGASX76X,$(xway_cmdline))
157 endef
158
159 define Image/Build/Profile/GIGASX76X
160 $(call Image/Build/$(1),$(1),GIGASX76X)
161 endef
162
163 define Image/BuildKernel/Profile/Generic
164 $(call Image/BuildKernel/Template,EASY4010,$(xway_cmdline))
165 $(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
166 $(call Image/BuildKernel/Template,EASY50812,$(xway_cmdline))
167 $(call Image/BuildKernel/Template,ARV3527P,$(xway_cmdline))
168 $(call Image/BuildKernel/Template,ARV4510PW,$(xway_cmdline))
169 $(call Image/BuildKernel/Template,ARV4518PW,$(xway_cmdline))
170 $(call Image/BuildKernel/Template,ARV4520PW,$(xway_cmdline))
171 $(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
172 $(call Image/BuildKernel/Template,ARV4525PW,$(xway_cmdline))
173 $(call Image/BuildKernel/Template,ARV7525PW,$(xway_cmdline))
174 $(call Image/BuildKernel/Template,ARV7518PW,$(xway_cmdline))
175 $(call Image/BuildKernel/Template,ARV752DPW,$(xway_cmdline))
176 $(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
177 $(call Image/BuildKernel/Template,GIGASX76X,$(xway_cmdline))
178 $(call Image/BuildKernel/Template,NONE)
179 endef
180
181 define Image/Build/Profile/Generic
182 $(call Image/Build/$(1),$(1),EASY4010)
183 $(call Image/Build/$(1),$(1),EASY50712)
184 $(call Image/Build/$(1),$(1),EASY50812)
185 $(call Image/Build/$(1),$(1),ARV3527P)
186 $(call Image/Build/$(1),$(1),ARV4510PW)
187 $(call Image/Build/$(1),$(1),ARV4518PW)
188 $(call Image/Build/$(1),$(1),ARV4520PW)
189 $(call Image/Build/$(1),$(1),ARV452CPW)
190 $(call Image/Build/$(1),$(1),ARV4525PW)
191 $(call Image/Build/$(1),$(1),ARV7525PW)
192 $(call Image/Build/$(1),$(1),ARV7518PW)
193 $(call Image/Build/$(1),$(1),ARV752DPW)
194 $(call Image/Build/$(1),$(1),ARV752DPW22)
195 $(call Image/Build/$(1),$(1),GIGASX76X)
196 $(call Image/Build/$(1),$(1),NONE)
197 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
198 endef
199 endif
200
201 ifeq ($(CONFIG_TARGET_lantiq_ar9),y)
202 define Image/BuildKernel/Profile/WBMR
203 $(call Image/BuildKernel/Template,WBMR,$(xway_cmdline))
204 endef
205
206 define Image/Build/Profile/WBMR
207 $(call Image/Build/$(1),$(1),WBMR)
208 endef
209
210 define Image/BuildKernel/Profile/DGN3500B
211 $(call Image/BuildKernel/Template,DGN3500B,$(xway_cmdline))
212 endef
213
214 define Image/Build/Profile/DGN3500B
215 $(call Image/Build/$(1),$(1),DGN3500B)
216 endef
217
218 define Image/BuildKernel/Profile/Generic
219 $(call Image/BuildKernel/Template,WBMR,$(xway_cmdline))
220 $(call Image/BuildKernel/Template,DGN3500B,$(xway_cmdline))
221 $(call Image/BuildKernel/Template,NONE)
222 endef
223
224 define Image/Build/Profile/Generic
225 $(call Image/Build/$(1),$(1),WBMR)
226 $(call Image/Build/$(1),$(1),DGN3500B)
227 $(call Image/Build/$(1),$(1),NONE)
228 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
229 endef
230 endif
231
232 ifeq ($(CONFIG_TARGET_lantiq_falcon)$(CONFIG_TARGET_lantiq_falcon_stable),y)
233 define Image/BuildKernel/Profile/EASY98000
234 $(call Image/BuildKernel/Template,EASY98000,$(falcon_cmdline))
235 endef
236
237 define Image/Build/Profile/EASY98000
238 $(call Image/Build/$(1),$(1),EASY98000)
239 endef
240
241 define Image/BuildKernel/Profile/EASY98020
242 $(call Image/BuildKernel/Template,EASY98020,$(falcon_cmdline))
243 endef
244
245 define Image/Build/Profile/EASY98020
246 $(call Image/Build/$(1),$(1),EASY98020)
247 endef
248
249 define Image/BuildKernel/Profile/Generic
250 $(call Image/BuildKernel/Template,EASY98000,$(falcon_cmdline))
251 $(call Image/BuildKernel/Template,EASY98020,$(falcon_cmdline))
252 $(call Image/BuildKernel/Template,NONE)
253 endef
254
255 define Image/Build/Profile/Generic
256 $(call Image/Build/$(1),$(1),EASY98000)
257 $(call Image/Build/$(1),$(1),EASY98020)
258 $(call Image/Build/$(1),$(1),NONE)
259 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
260 endef
261 endif
262
263 ifeq ($(CONFIG_TARGET_lantiq_ase),y)
264 define Image/BuildKernel/Profile/EASY50601
265 $(call Image/BuildKernel/Template,EASY50601,$(ase_cmdline))
266 endef
267
268 define Image/Build/Profile/EASY50601
269 $(call Image/Build/$(1),$(1),EASY50601)
270 endef
271
272 define Image/BuildKernel/Profile/Generic
273 $(call Image/BuildKernel/Template,EASY50601,$(ase_cmdline))
274 $(call Image/BuildKernel/Template,NONE)
275 endef
276
277 define Image/Build/Profile/Generic
278 $(call Image/Build/$(1),$(1),EASY50601)
279 $(call Image/Build/$(1),$(1),NONE)
280 $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
281 endef
282 endif
283
284 define Image/BuildKernel
285 $(call Image/BuildKernel/Profile/$(PROFILE))
286 endef
287
288 define Image/Build
289 $(call Image/Build/Profile/$(PROFILE),$(1))
290 endef
291
292 $(eval $(call BuildImage))