source: trunk/target/linux/lantiq/image/Makefile @ 31063

Last change on this file since 31063 was 31063, checked in by blogic, 5 years ago

[lantiq] cleanup image makefile

File size: 10.6 KB
Line 
1#
2# Copyright (C) 2010-2012 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7include $(TOPDIR)/rules.mk
8include $(INCLUDE_DIR)/image.mk
9
10JFFS2_BLOCKSIZE = 64k 128k 256k
11
12ase_cmdline=-console=ttyLTQ0,115200 rootfstype=squashfs,jffs2
13xway_cmdline=-console=ttyLTQ1,115200 rootfstype=squashfs,jffs2
14falcon_cmdline=-console=ttyLTQ0,115200 rootfstype=squashfs,jffs2
15sx76x_cmdline=console=ttyLTQ1,115200 rootfstype=squashfs,jffs2
16
17define CompressLzma
18  $(STAGING_DIR_HOST)/bin/lzma e $(1) $(2)
19endef
20
21define PatchKernelLzma
22        cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
23        $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))'
24        $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).lzma)
25endef
26
27define MkBrnImage
28        mkbrncmdline -i $(KDIR)/vmlinux-$(4) -o $(KDIR)/vmlinux-$(4)-brn BRN-BOOT $(6)
29        $(call CompressLzma,$(KDIR)/vmlinux-$(4)-brn,$(KDIR)/vmlinux-$(4)-brn.lzma)
30        mkbrnimg -s $(1) -m $(2) -o $(3) $(KDIR)/vmlinux-$(4)-brn.lzma $(KDIR)/root.$(5)
31endef
32
33define MkImageLzma
34        mkimage -A mips -O linux -T kernel -a 0x80002000 -C lzma \
35                -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
36                -d $(KDIR)/vmlinux-$(1).lzma $(KDIR)/uImage-$(1)
37endef
38
39define MkImageEVA
40        lzma2eva 0x80002000 0x80002000 $(KDIR)/vmlinux-$(1).lzma $(KDIR)/$(1).eva.prealign
41        dd if=$(KDIR)/$(1).eva.prealign of=$(KDIR)/$(1).eva bs=64k conv=sync
42        cat ./eva.dummy.squashfs >> $(KDIR)/$(1).eva
43endef
44
45define Image/Build/squashfs
46        cat $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
47        $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
48        $(if $(3),$(call MkBrnImage,$(3),$(4),$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(3)-brnImage,$(2),$(1),$(5)))
49endef
50
51define Image/BuildEVA/squashfs
52        cat $(KDIR)/$(2).eva $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva
53        $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva)
54endef
55
56define Image/Build/jffs2-64k
57        dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=64k conv=sync
58        cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
59endef
60
61define Image/Build/jffs2-128k
62        dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=128k conv=sync
63        cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
64endef
65
66define Image/Build/jffs2-256k
67        dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=256k conv=sync
68        cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
69endef
70
71define Image/BuildKernel/Template
72        $(call PatchKernelLzma,$(1),$(if $(2),$(2) machtype=$(1),))
73        $(call MkImageLzma,$(1))
74        $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
75endef
76
77define Image/BuildKernelEVA/Template
78        $(call PatchKernelLzma,$(1),$(if $(2),$(2) machtype=$(1),))
79        $(call MkImageEVA,$(1))
80        $(CP) $(KDIR)/$(1).eva $(BIN_DIR)/$(IMG_PREFIX)-$(1).eva
81endef
82
83ifeq ($(CONFIG_TARGET_lantiq_danube),y)
84
85Image/BuildKernel/Profile/EASY50712=$(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
86Image/BuildKernel/Profile/ARV3527P=$(call Image/BuildKernel/Template,ARV3527P,$(xway_cmdline))
87Image/BuildKernel/Profile/ARV4510PW=$(call Image/BuildKernel/Template,ARV4510PW,$(xway_cmdline))
88Image/BuildKernel/Profile/ARV4518PW=$(call Image/BuildKernel/Template,ARV4518PW,$(xway_cmdline))
89Image/BuildKernel/Profile/ARV4519PW=$(call Image/BuildKernel/Template,ARV4519PW,$(xway_cmdline))
90Image/BuildKernel/Profile/ARV4520PW=$(call Image/BuildKernel/Template,ARV4520PW,$(xway_cmdline))
91Image/BuildKernel/Profile/ARV4525PW=$(call Image/BuildKernel/Template,ARV4525PW,$(xway_cmdline))
92Image/BuildKernel/Profile/ARV7525PW=$(call Image/BuildKernel/Template,ARV7525PW,$(xway_cmdline))
93Image/BuildKernel/Profile/ARV452CPW=$(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
94Image/BuildKernel/Profile/ARV7518PW=$(call Image/BuildKernel/Template,ARV7518PW,$(xway_cmdline))
95Image/BuildKernel/Profile/ARV752DPW=$(call Image/BuildKernel/Template,ARV752DPW,$(xway_cmdline))
96Image/BuildKernel/Profile/ARV752DPW22=$(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
97Image/BuildKernel/Profile/GIGASX76X=$(call Image/BuildKernel/Template,GIGASX76X,$(sx76x_cmdline))
98Image/BuildKernel/Profile/BTHOMEHUBV2B=$(call Image/BuildKernel/Template,BTHOMEHUBV2B,$(xway_cmdline))
99Image/BuildKernel/Profile/BTHOMEHUBV2BOPENRG=$(call Image/BuildKernel/Template,BTHOMEHUBV2BOPENRG,$(xway_cmdline))
100
101Image/Build/Profile/EASY50712=$(call Image/Build/$(1),$(1),EASY50712)
102Image/Build/Profile/ARV3527P=$(call Image/Build/$(1),$(1),ARV3527P)
103Image/Build/Profile/ARV4510PW=$(call Image/Build/$(1),$(1),ARV4510PW)
104Image/Build/Profile/ARV4518PW=$(call Image/Build/$(1),$(1),ARV4518PW)
105Image/Build/Profile/ARV4519PW=$(call Image/Build/$(1),$(1),ARV4519PW,BRNDA4519,0x12345678,memsize=32)
106Image/Build/Profile/ARV4520PW=$(call Image/Build/$(1),$(1),ARV4520PW,BRNDANUBE,0x12345678,memsize=32)
107Image/Build/Profile/ARV4525PW=$(call Image/Build/$(1),$(1),ARV4525PW,BRNDTW502,0x12345678,memsize=32)
108Image/Build/Profile/ARV7525PW=$(call Image/Build/$(1),$(1),ARV7525PW)
109Image/Build/Profile/ARV452CPW=$(call Image/Build/$(1),$(1),ARV452CPW)
110Image/Build/Profile/ARV7518PW=$(call Image/Build/$(1),$(1),ARV7518PW,BRNDA7519,0x12345678,memsize=64)
111Image/Build/Profile/ARV752DPW=$(call Image/Build/$(1),$(1),ARV752DPW)
112Image/Build/Profile/ARV752DPW22=$(call Image/Build/$(1),$(1),ARV752DPW22)
113Image/Build/Profile/GIGASX76X=$(call Image/Build/$(1),$(1),GIGASX76X)
114Image/Build/Profile/BTHOMEHUBV2B=$(call Image/Build/$(1),$(1),BTHOMEHUBV2B)
115Image/Build/Profile/BTHOMEHUBV2BOPENRG=$(call Image/Build/$(1),$(1),BTHOMEHUBV2BOPENRG)
116
117define Image/BuildKernel/Profile/Generic
118        $(call Image/BuildKernel/Template,EASY50712,$(xway_cmdline))
119        $(call Image/BuildKernel/Template,ARV3527P,$(xway_cmdline))
120        $(call Image/BuildKernel/Template,ARV4510PW,$(xway_cmdline))
121        $(call Image/BuildKernel/Template,ARV4518PW,$(xway_cmdline))
122        $(call Image/BuildKernel/Template,ARV4519PW,$(xway_cmdline))
123        $(call Image/BuildKernel/Template,ARV4520PW,$(xway_cmdline))
124        $(call Image/BuildKernel/Template,ARV452CPW,$(xway_cmdline))
125        $(call Image/BuildKernel/Template,ARV4525PW,$(xway_cmdline))
126        $(call Image/BuildKernel/Template,ARV7525PW,$(xway_cmdline))
127        $(call Image/BuildKernel/Template,ARV7518PW,$(xway_cmdline))
128        $(call Image/BuildKernel/Template,ARV752DPW,$(xway_cmdline))
129        $(call Image/BuildKernel/Template,ARV752DPW22,$(xway_cmdline))
130        $(call Image/BuildKernel/Template,GIGASX76X,$(xway_cmdline))
131        $(call Image/BuildKernel/Template,BTHOMEHUBV2B,$(xway_cmdline))
132        $(call Image/BuildKernel/Template,BTHOMEHUBV2BOPENRG,$(xway_cmdline))
133        $(call Image/BuildKernel/Template,NONE)
134endef
135
136define Image/Build/Profile/Generic
137        $(call Image/Build/$(1),$(1),EASY50712)
138        $(call Image/Build/$(1),$(1),ARV3527P)
139        $(call Image/Build/$(1),$(1),ARV4510PW)
140        $(call Image/Build/$(1),$(1),ARV4518PW)
141        $(call Image/Build/$(1),$(1),ARV4519PW,BRNDA4519,0x12345678,memsize=32)
142        $(call Image/Build/$(1),$(1),ARV4520PW)
143        $(call Image/Build/$(1),$(1),ARV452CPW)
144        $(call Image/Build/$(1),$(1),ARV4525PW,BRNDTW502,0x12345678,memsize=32)
145        $(call Image/Build/$(1),$(1),ARV7525PW)
146        $(call Image/Build/$(1),$(1),ARV7518PW,BRNDA7519,0x12345678,memsize=32)
147        $(call Image/Build/$(1),$(1),ARV752DPW)
148        $(call Image/Build/$(1),$(1),ARV752DPW22)
149        $(call Image/Build/$(1),$(1),GIGASX76X)
150        $(call Image/Build/$(1),$(1),BTHOMEHUBV2B)
151        $(call Image/Build/$(1),$(1),BTHOMEHUBV2BOPENRG)
152        $(call Image/Build/$(1),$(1),NONE)
153        $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
154endef
155endif
156
157ifeq ($(CONFIG_TARGET_lantiq_ar9),y)
158Image/BuildKernel/Profile/WBMR=$(call Image/BuildKernel/Template,WBMR,$(xway_cmdline))
159Image/BuildKernel/Profile/DGN3500B=$(call Image/BuildKernel/Template,DGN3500B,$(xway_cmdline))
160Image/BuildKernel/Profile/FRITZ7320=$(call Image/BuildKernelEVA/Template,FRITZ7320,$(xway_cmdline))
161
162Image/Build/Profile/WBMR=$(call Image/Build/$(1),$(1),WBMR)
163Image/Build/Profile/DGN3500B=$(call Image/Build/$(1),$(1),DGN3500B)
164Image/Build/Profile/FRITZ7320=$(call Image/BuildEVA/$(1),$(1),FRITZ7320)
165
166define Image/BuildKernel/Profile/Generic
167        $(call Image/BuildKernel/Template,WBMR,$(xway_cmdline))
168        $(call Image/BuildKernel/Template,DGN3500B,$(xway_cmdline))
169        $(call Image/BuildKernelEVA/Template,FRITZ7320,$(xway_cmdline))
170        $(call Image/BuildKernel/Template,NONE)
171endef
172
173define Image/Build/Profile/Generic
174        $(call Image/Build/$(1),$(1),WBMR)
175        $(call Image/Build/$(1),$(1),DGN3500B)
176        $(call Image/BuildEVA/$(1),$(1),FRITZ7320)
177        $(call Image/Build/$(1),$(1),NONE)
178        $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
179endef
180endif
181
182ifeq ($(CONFIG_TARGET_lantiq_falcon)$(CONFIG_TARGET_lantiq_falcon_stable),y)
183
184Image/BuildKernel/Profile/EASY98000=$(call Image/BuildKernel/Template,EASY98000,$(falcon_cmdline))
185Image/BuildKernel/Profile/EASY98020=$(call Image/BuildKernel/Template,EASY98020,$(falcon_cmdline))
186
187Image/Build/Profile/EASY98000=$(call Image/Build/$(1),$(1),EASY98000)
188Image/Build/Profile/EASY98020=$(call Image/Build/$(1),$(1),EASY98020)
189
190define Image/BuildKernel/Profile/Generic
191        $(call Image/BuildKernel/Template,EASY98000,$(falcon_cmdline))
192        $(call Image/BuildKernel/Template,EASY98020,$(falcon_cmdline))
193        $(call Image/BuildKernel/Template,NONE)
194endef
195
196define Image/Build/Profile/Generic
197        $(call Image/Build/$(1),$(1),EASY98000)
198        $(call Image/Build/$(1),$(1),EASY98020)
199        $(call Image/Build/$(1),$(1),NONE)
200        $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
201endef
202endif
203
204ifeq ($(CONFIG_TARGET_lantiq_ase),y)
205
206Image/BuildKernel/Profile/EASY50601=$(call Image/BuildKernel/Template,EASY50601,$(ase_cmdline))
207Image/Build/Profile/EASY50601=$(call Image/Build/$(1),$(1),EASY50601)
208
209define Image/BuildKernel/Profile/Generic
210        $(call Image/BuildKernel/Template,EASY50601,$(ase_cmdline))
211        $(call Image/BuildKernel/Template,NONE)
212endef
213
214define Image/Build/Profile/Generic
215        $(call Image/Build/$(1),$(1),EASY50601)
216        $(call Image/Build/$(1),$(1),NONE)
217        $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
218endef
219endif
220
221ifeq ($(CONFIG_TARGET_lantiq_vr9),y)
222define Image/BuildKernel/Profile/FRITZ3370
223        $(call Image/BuildKernel/Template,FRITZ3370,$(xway_cmdline))
224        $(call Image/BuildKernelEVA/Template,FRITZ3370,$(xway_cmdline))
225endef
226
227Image/Build/Profile/FRITZ3370=$(call Image/Build/$(1),$(1),FRITZ3370)
228
229define Image/BuildKernel/Profile/Generic
230        $(call Image/BuildKernel/Template,FRITZ3370,$(xway_cmdline))
231        $(call Image/BuildKernel/Template,NONE)
232endef
233
234define Image/Build/Profile/Generic
235        $(call Image/Build/$(1),$(1),FRITZ3370)
236        $(call Image/Build/$(1),$(1),NONE)
237        $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1).rootfs
238endef
239endif
240
241define Image/BuildKernel
242        $(call Image/BuildKernel/Profile/$(PROFILE))
243endef
244
245define Image/Build
246        $(call Image/Build/Profile/$(PROFILE),$(1))
247endef
248
249$(eval $(call BuildImage))
Note: See TracBrowser for help on using the repository browser.