brcm63xx: drop call to prepare_generic_squashfs
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / image / Makefile
1 #
2 # Copyright (C) 2006-2011 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 LOADADDR = 0x80010000 # RAM start + 16M
11 KERNEL_ENTRY = $(LOADADDR) # Newer kernels add a jmp to the kernel_entry at the start of the binary
12 RAMSIZE = 0x01000000 # 64MB
13
14 LOADER_MAKEOPTS= \
15 KDIR=$(KDIR) \
16 LOADADDR=$(LOADADDR) \
17 KERNEL_ENTRY=$(KERNEL_ENTRY) \
18 RAMSIZE=$(RAMSIZE)
19
20 define trxalign/jffs2-128k
21 -a 0x20000
22 endef
23 define trxalign/jffs2-64k
24 -a 0x10000
25 endef
26 define trxalign/squashfs
27 -a 1024
28 endef
29
30 define Image/LimitName16
31 $(shell expr substr "$(1)" 1 16)
32 endef
33
34 TARGET_DTBS:=
35 TARGET_IMAGES:=
36
37 TARGET_Default_DTBS:=
38 TARGET_Default_IMAGES:=
39
40 define Image/Build/CFE
41 # Generate the tagged image
42 $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
43 --output $(BIN_DIR)/openwrt-$(4)-$(1)-cfe.bin \
44 --boardid $(2) --chipid $(3) --entry $(KERNEL_ENTRY) \
45 --load-addr $(LOADADDR) --rsa-signature "$(5)" \
46 --info1 "-$(call Image/LimitName16,$(4))" --info2 $(1) \
47 $(6) $(7) $(8) $(9)
48 endef
49
50 define Image/Build/CFEDTB
51 # Generate the tagged image
52 $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux-$(2).lzma.cfe -f $(KDIR)/root.$(1) \
53 --output $(BIN_DIR)/openwrt-$(5)-$(1)-cfe.bin \
54 --boardid $(3) --chipid $(4) --entry $(KERNEL_ENTRY) \
55 --load-addr $(LOADADDR) --info1 "-$(call Image/LimitName16,$(5))" \
56 --info2 $(1) $(6)
57 endef
58
59 define Image/Build/OLDCFEDTB
60 # Generate the tagged image
61 $(TOPDIR)/scripts/brcmImage.pl -t -p \
62 -b $(3) -c $(4) -e $(KERNEL_ENTRY) -a $(LOADADDR) \
63 -k $(KDIR)/vmlinux-$(2).lzma.cfe -r $(KDIR)/root.$(1) \
64 -o $(BIN_DIR)/openwrt-$(5)-$(1)-cfe.bin $(6)
65 endef
66
67 define Image/Build/SPW303VCFEDTB
68 # Generate the tagged image
69 $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux-$(2).lzma.cfe -f $(KDIR)/root.$(1) \
70 --output $(BIN_DIR)/openwrt-$(5)-$(1).tmp \
71 --boardid $(3) --chipid $(4) --entry $(KERNEL_ENTRY) \
72 --load-addr $(LOADADDR) $(6)
73 # Fix up header
74 $(STAGING_DIR_HOST)/bin/spw303v -i $(BIN_DIR)/openwrt-$(5)-$(1).tmp \
75 -o $(BIN_DIR)/openwrt-$(5)-$(1)-cfe-sysupgrade.bin
76 $(STAGING_DIR_HOST)/bin/xorimage -i $(BIN_DIR)/openwrt-$(5)-$(1)-cfe-sysupgrade.bin \
77 -o $(BIN_DIR)/openwrt-$(5)-$(1)-cfe-factory.bin
78 rm -f $(BIN_DIR)/openwrt-$(5)-$(1).tmp
79 endef
80
81 define Image/Build/ZYXCFEDTB
82 # Generate the tagged image
83 $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux-$(2).lzma.cfe -f $(KDIR)/root.$(1) \
84 --output $(BIN_DIR)/openwrt-$(5)-$(1).tmp \
85 --boardid $(3) --chipid $(4) --entry $(KERNEL_ENTRY) \
86 --load-addr $(LOADADDR) --info1 "-$(call Image/LimitName16,$(5))" \
87 --info2 $(1) $(6)
88 # Fix up header
89 $(STAGING_DIR_HOST)/bin/zyxbcm -i $(BIN_DIR)/openwrt-$(5)-$(1).tmp \
90 -o $(BIN_DIR)/openwrt-$(5)-$(1)-zyxcfe.bin
91 rm -f $(BIN_DIR)/openwrt-$(5)-$(1).tmp
92 endef
93
94 define Image/Build/RedBoot
95 cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(1)-vmlinux.elf
96 gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
97 $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
98 dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(1)-vmlinux.lzma bs=65536 conv=sync
99 dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(1)-vmlinux.gz bs=65536 conv=sync
100 endef
101
102 define Image/Build/HCS
103 $(STAGING_DIR_HOST)/bin/hcsmakeimage --magic_byte=$(3) \
104 --rev_maj=$(4) --rev_min=$(5) --input_file=$(6) \
105 --output_file=$(BIN_DIR)/openwrt-$(2)-$(1).bin
106 endef
107
108 define Build/Clean
109 $(MAKE) -C lzma-loader clean
110 endef
111
112 define Image/PrepareLoader
113 # Standard LZMA kernel
114 $(STAGING_DIR_HOST)/bin/lzma e -d22 -fb64 -a1 $(KDIR)/vmlinux$(1) $(KDIR)/vmlinux$(1).lzma
115
116 # Build the LZMA loader
117 rm -rf $(KDIR)/lzma-loader
118 $(MAKE) -C lzma-loader \
119 $(LOADER_MAKEOPTS) \
120 BUILD_DIR="$(KDIR)" \
121 TARGET_DIR="$(BIN_DIR)" \
122 LOADER_DATA="$(KDIR)/vmlinux$(1).lzma" \
123 LOADER=$(IMG_PREFIX)-loader$(1).elf \
124 LZMA_TEXT_START=0x80a00000 \
125 compile loader.elf
126
127 rm -f $(KDIR)/vmlinux$(1).lzma
128 endef
129
130 define Image/PrepareLoaderDTB
131 # append dtb to vmlinux, then build a standard LZMA loader
132 cat $(KDIR)/vmlinux$(1) $(DTS_DIR)/$(2).dtb > $(KDIR)/vmlinux$(1)-$(2)
133 $(call Image/PrepareLoader,$(1)-$(2))
134 endef
135
136 define Image/PrepareCFELzmaKernel
137 # CFE is a LZMA nazi! It took me hours to find out the parameters!
138 # Also I think lzma has a bug cause it generates different output depending on
139 # if you use stdin / stdout or not. Use files instead of stdio here, cause
140 # otherwise CFE will complain and not boot the image.
141 $(STAGING_DIR_HOST)/bin/lzma e -d22 -fb64 -a1 $(KDIR)/vmlinux$(1) $(KDIR)/vmlinux$(1).lzma.tmp
142
143 # Strip out the length, CFE doesn't like this
144 dd if=$(KDIR)/vmlinux$(1).lzma.tmp of=$(KDIR)/vmlinux$(1).lzma.cfe bs=5 count=1
145 dd if=$(KDIR)/vmlinux$(1).lzma.tmp of=$(KDIR)/vmlinux$(1).lzma.cfe ibs=13 obs=5 skip=1 seek=1 conv=notrunc
146 rm -f $(KDIR)/vmlinux$(1).lzma.tmp
147 endef
148
149 define Image/PrepareCFELzmaKernelDTB
150 # compile the dts (the dtb will be later reused for the lzma loader)
151 $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(DTS_DIR)/$(1).dtb ../dts/$(1).dts
152 cat $(KDIR)/vmlinux $(DTS_DIR)/$(1).dtb > $(KDIR)/vmlinux-$(1)
153 $(call Image/PrepareCFELzmaKernel,-$(1))
154 endef
155
156 define Image/Prepare
157 $(call Image/PrepareCFELzmaKernel,)
158
159 $(foreach board,$(sort $(TARGET_$(PROFILE)_DTBS)), $(call Image/PrepareCFELzmaKernelDTB,$(board)))
160
161 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
162 $(call Image/PrepareLoader,-initramfs)
163 $(foreach board,$(sort $(TARGET_$(PROFILE)_DTBS)), $(call Image/PrepareLoaderDTB,-initramfs,$(board)))
164 endif
165 endef
166
167 define Image/Build/Initramfs
168 # Netgear CVG834G
169 $(call Image/Build/HCS,initramfs,cvg834g,a020,0001,0022,$(KDIR)/vmlinux-initramfs)
170 endef
171
172 # $(1) = Image build
173 # $(2) = Profile
174 # $(3) = dtb
175 # $(4) = boardname
176 # $(5) = chipid
177 # $(6) = imagename
178 # $(7) = additional options
179 define ImageDTB
180 define Image/Build/$(6)
181 $$(call Image/Build/$(1),$$(1),$(3),$(4),$(5),$(6),$(7))
182 endef
183
184 TARGET_Default_DTBS += $(3)
185 TARGET_Default_IMAGES += $(6)
186 TARGET_$(2)_DTBS += $(3)
187 TARGET_$(2)_IMAGES += $(6)
188 endef
189
190 define Image/Build
191 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
192
193 # BT Voyager V2500V, V2500V_SIP_CLUB, V2500V_AA
194 $(call Image/Build/CFE,$(1),V2500V_BB,6348,BTV2500V,,--layoutver 5)
195 # RTA1025W_16 (numerous routers)
196 $(call Image/Build/CFE,$(1),RTA1025W_16,6348,RTA1025W_16,,--layoutver 5)
197 # RTA1320_16M (numerous routers)
198 $(call Image/Build/CFE,$(1),RTA1320_16M,6338,RTA1320_16M,,--layoutver 5)
199
200 # Inventel Livebox
201 $(call Image/Build/RedBoot,livebox)
202
203 # Netgear CVG834G
204 $(call Image/Build/HCS,$(1),cvg834g,a020,0001,0022,$(KDIR)/vmlinux)
205
206 # build dtb image list
207 $(foreach image,$(TARGET_$(PROFILE)_IMAGES),$(call Image/Build/$(image),$(1)))
208
209 ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
210 $(call Image/Build/Initramfs)
211 endif
212 endef
213
214 # Generic 963281TAN
215 $(eval $(call ImageDTB,CFEDTB,963281TAN,bcm963281TAN,963281TAN,6328,963281TAN-4M-flash-generic,--pad 2))
216 $(eval $(call ImageDTB,CFEDTB,963281TAN,bcm963281TAN,963281TAN,6328,963281TAN-8M-flash-generic,--pad 4))
217 $(eval $(call ImageDTB,CFEDTB,963281TAN,bcm963281TAN,963281TAN,6328,963281TAN-16M-flash-generic,--pad 8))
218 # Generic 96328avng
219 $(eval $(call ImageDTB,CFEDTB,96328avng,bcm96328avng,96328avng,6328,96328avng-4M-flash-generic,--pad 2))
220 $(eval $(call ImageDTB,CFEDTB,96328avng,bcm96328avng,96328avng,6328,96328avng-8M-flash-generic,--pad 4))
221 $(eval $(call ImageDTB,CFEDTB,96328avng,bcm96328avng,96328avng,6328,96328avng-16M-flash-generic,--pad 8))
222 # Generic 96338GW
223 $(eval $(call ImageDTB,CFEDTB,96338GW,bcm96338GW,6338GW,6338,96338GW-generic))
224 # Generic 96338W
225 $(eval $(call ImageDTB,CFEDTB,96338W,bcm96338W,6338W,6338,96338W-generic))
226 # Generic 96345GW2
227 $(eval $(call ImageDTB,CFEDTB,96345GW2,bcm96345GW2,96345GW2,6345,96345GW2-generic))
228 $(eval $(call ImageDTB,CFEDTB,96345GW2,bcm96345GW2,96345GW2,6345,96345GW2-bc221,--layoutver 5))
229 # Generic 96348GW
230 $(eval $(call ImageDTB,CFEDTB,96348GW,bcm96348GW,96348GW,6348,96348GW-generic))
231 $(eval $(call ImageDTB,CFEDTB,96348GW,bcm96348GW,96348GW,6348,96348GW-bc221,--layoutver 5))
232 # Generic 96348GW-10
233 $(eval $(call ImageDTB,CFEDTB,96348GW_10,bcm96348GW-10,96348GW-10,6348,96348GW-10-generic))
234 # Generic 96348GW-11
235 $(eval $(call ImageDTB,CFEDTB,96348GW_11,bcm96348GW-11,96348GW-11,6348,96348GW-11-generic))
236 # Generic 96348R
237 $(eval $(call ImageDTB,CFEDTB,96348R,bcm96348R,96348R,6348,96348R-generic))
238 # Generic 96358VW
239 $(eval $(call ImageDTB,CFEDTB,96358VW,bcm96358VW,96358VW,6358,96358VW-generic))
240 # Generic 96358VW2
241 $(eval $(call ImageDTB,CFEDTB,96358VW2,bcm96358VW2,96358VW2,6358,96358VW2-generic))
242 # Generic 96368MVNgr
243 $(eval $(call ImageDTB,CFEDTB,96368MVNgr,bcm96368MVNgr,96368MVNgr,6368,96368MVNgr-generic))
244 # Generic 96368MVWG
245 $(eval $(call ImageDTB,CFEDTB,96368MVWG,bcm96368MVWG,96368MVWG,6368,96368MVWG-generic))
246
247 # ADB P.DG A4001N
248 $(eval $(call ImageDTB,CFEDTB,A4001N,a4001n,96328dg2x2,6328,A4001N,--pad 8))
249 # ADB P.DG A4001N1
250 $(eval $(call ImageDTB,CFEDTB,A4001N1,a4001n1,963281T_TEF,6328,A4001N1,--pad 8))
251 # Alcatel RG100A
252 $(eval $(call ImageDTB,CFEDTB,RG100A,rg100a,96358VW2,6358,RG100A,--block-size 0x20000 --image-offset 0x20000))
253 # Asmax AR 1004g
254 $(eval $(call ImageDTB,CFEDTB,AR1004G,ar1004g,96348GW-10,6348,AR1004G))
255 # Belkin F5D7633
256 $(eval $(call ImageDTB,CFEDTB,F5D7633,f5d7633,96348GW-10,6348,F5D7633,--block-size 0x20000 --image-offset 0x20000))
257 # Comtrend AR-5381u
258 $(eval $(call ImageDTB,CFEDTB,AR5381u,ar-5381u,96328A-1241N,6328,AR-5381u,--pad 8))
259 # Comtrend AR-5387un
260 $(eval $(call ImageDTB,CFEDTB,AR5387un,ar-5387un,96328A-1441N1,6328,AR-5387un,--pad 8))
261 # Comtrend 536, 5621
262 $(eval $(call ImageDTB,CFEDTB,CT536_CT5621,ct536plus,96348GW-11,6348,CT536_CT5621))
263 # Comtrend CT-5365
264 $(eval $(call ImageDTB,CFEDTB,CT5365,ct-5365,96348A-122,6348,CT-5365))
265 # Comtrend CT-6373
266 $(eval $(call ImageDTB,CFEDTB,CT6373,ct-6373,CT6373-1,6358,CT-6373))
267 # Comtrend VR-3025u
268 $(eval $(call ImageDTB,CFEDTB,VR3025u,vr-3025u,96368M-1541N,6368,VR-3025u,--pad 16 --image-offset 0x20000 --block-size 0x20000))
269 # Comtrend VR-3025un
270 $(eval $(call ImageDTB,CFEDTB,VR3025un,vr-3025un,96368M-1341N,6368,VR-3025un,--pad 4))
271 # Comtrend WAP-5813n
272 $(eval $(call ImageDTB,CFEDTB,WAP5813n,wap-5813n,96369R-1231N,6368,WAP-5813n,--pad 4))
273 # D-Link DSL-2640B, rev B2
274 $(eval $(call ImageDTB,CFEDTB,DSL2640B_B,dsl-2640b-b,D-4P-W,6348,DSL2640B-B2))
275 # D-Link DSL-2650U
276 $(eval $(call ImageDTB,CFEDTB,DSL2650U,dsl-2650u,96358VW2,6358,DSL2650U))
277 # D-Link DSL-2740B/DSL-2741B, rev C2
278 $(eval $(call ImageDTB,CFEDTB,DSL274XB_C,dsl-274xb-c,96358GW,6358,DSL274XB-C2))
279 # D-Link DSL-2740B/DSL-2741B, rev C3
280 $(eval $(call ImageDTB,CFEDTB,DSL274XB_C,dsl-274xb-c,AW4139,6358,DSL274XB-C3))
281 # D-Link DSL-2740B/DSL-2741B, rev F1
282 $(eval $(call ImageDTB,CFEDTB,DSL274XB_F,dsl-274xb-f,AW4339U,6328,DSL274XB-F1-EU,--signature2 "4.06.01.EUF1" --pad 4))
283 $(eval $(call ImageDTB,CFEDTB,DSL274XB_F,dsl-274xb-f,AW4339U,6328,DSL274XB-F1-AU,--signature2 "4.06.01.AUF1" --pad 4))
284 # D-Link DVA-G3810BN/TL
285 $(eval $(call ImageDTB,CFEDTB,DVAG3810BN,dva-g3810bn_tl,96358VW,6358,DVAG3810BN))
286 # Davolink DV-201AMR
287 $(eval $(call ImageDTB,OLDCFEDTB,DV201AMR,dv-201amr,DV201AMR,6348,DV-201AMR))
288 # Huawei HG520v
289 $(eval $(call ImageDTB,CFEDTB,HG520v,hg520v,HW6358GW_B,6358,HG520v,--rsa-signature "EchoLife_HG520v"))
290 # Huawei HG553
291 $(eval $(call ImageDTB,CFEDTB,HG553,hg553,HW553,6358,HG553,--rsa-signature "EchoLife_HG553" --image-offset 0x20000 --block-size 0x20000 --tag-version 7))
292 # Huawei HG556a
293 $(eval $(call ImageDTB,CFEDTB,HG556a_AB,hg556a-a,HW556,6358,HG556a_A,--rsa-signature "EchoLife_HG556a" --image-offset 0x20000 --block-size 0x10000 --tag-version 8))
294 $(eval $(call ImageDTB,CFEDTB,HG556a_AB,hg556a-b,HW556,6358,HG556a_B,--rsa-signature "EchoLife_HG556a" --image-offset 0x20000 --block-size 0x20000 --tag-version 8))
295 $(eval $(call ImageDTB,CFEDTB,HG556a_C,hg556a-c,HW556,6358,HG556a_C,--rsa-signature "EchoLife_HG556a" --image-offset 0x20000 --block-size 0x20000 --tag-version 8))
296 # Netgear DG834GT/PN
297 $(eval $(call ImageDTB,CFEDTB,DG834GTPN,dg834gtpn,96348GW-10,6348,DG834GT_PN))
298 # Pirelli Alice Gate VoIP 2 Plus Wi-Fi AGPF-S0
299 $(eval $(call ImageDTB,CFEDTB,AGPF_S0,agpf-s0,AGPF-S0,6358,AGV2+W,--block-size 0x20000 --image-offset 0x20000 --signature2 IMAGE --tag-version 8))
300 # Pirelli A226G
301 $(eval $(call ImageDTB,CFEDTB,A226G,a226g,DWV-S0,6358,A226G,--signature2 IMAGE --tag-version 8))
302 # Pirelli A226M/A226M-FWB
303 $(eval $(call ImageDTB,CFEDTB,A226M,a226m,DWV-S0,6358,A226M,--signature2 IMAGE --tag-version 8))
304 $(eval $(call ImageDTB,CFEDTB,A226M,a226m-fwb,DWV-S0,6358,A226M-FWB,--block-size 0x20000 --image-offset 0x20000 --signature2 IMAGE --tag-version 8))
305 # Sagem F@ST2404
306 $(eval $(call ImageDTB,CFEDTB,FAST2404,fast2404,F@ST2404,6348,F@ST2404))
307 # Sagem F@ST2504n
308 $(eval $(call ImageDTB,CFEDTB,FAST2504n,fast2504n,F@ST2504n,6362,F@ST2504n))
309 # Sagem F@ST2604
310 $(eval $(call ImageDTB,CFEDTB,FAST2604,fast2604,F@ST2604,6348,F@ST2604))
311 # Sagem F@ST2704V2
312 $(eval $(call ImageDTB,CFEDTB,FAST2704V2,fast2704v2,F@ST2704V2,6328,F@ST2704V2))
313 # SFR Neufbox 4
314 $(eval $(call ImageDTB,CFEDTB,Neufbox4,nb4-ser-r0,96358VW,6358,NEUFBOX4-SER,--rsa-signature "OpenWRT-$(REVISION)"))
315 $(eval $(call ImageDTB,CFEDTB,Neufbox4,nb4-fxc-r1,96358VW,6358,NEUFBOX4-FXC,--rsa-signature "OpenWRT-$(REVISION)"))
316 # SFR Neufbox 6
317 $(eval $(call ImageDTB,CFEDTB,Neufbox6,nb6-ser-r0,NB6-SER-r0,6362,NEUFBOX6,--rsa-signature "OpenWRT-$(REVISION)"))
318 # T-Com Speedport W 303V Typ B
319 $(eval $(call ImageDTB,SPW303VCFEDTB,SPW303V,spw303v,96358-502V,6358,SPW303V,--pad 4))
320 # T-Com Speedport W 500V
321 $(eval $(call ImageDTB,CFEDTB,SPW500V,spw500v,96348GW,6348,SPW500V))
322 # Tecom GW6000
323 $(eval $(call ImageDTB,CFEDTB,GW6000,gw6000,96348GW,6348,GW6000))
324 # Tecom GW6200
325 $(eval $(call ImageDTB,CFEDTB,GW6200,gw6200,96348GW,6348,GW6200,--rsa-signature "$(shell printf '\x99')"))
326 # Telsey CPVA642-type (e.g. CPA-ZNTE60T)
327 $(eval $(call ImageDTB,CFEDTB,CPVA642,cpva642,CPVA642,6358,CPA-ZNTE60T,--signature "Telsey Tlc" --signature2 "99.99.999" --second-image-flag "0" --pad 4))
328 # TP-Link TD-W8900GB
329 $(eval $(call ImageDTB,CFEDTB,TDW8900GB,td-w8900gb,96348GW-11,6348,TD-W8900GB,--rsa-signature "$(shell printf 'PRID\x89\x10\x00\x02')" --image-offset 0x20000))
330 # USRobotics 9108
331 $(eval $(call ImageDTB,CFEDTB,USR9108,usr9108,96348GW-A,6348,USR9108))
332 # ZyXEL P870HW-51a v2
333 $(eval $(call ImageDTB,ZYXCFEDTB,P870HW_51a_v2,p870hw-51a-v2,96368VVW,6368,P870HW-51a_v2,--rsa-signature "ZyXEL" --signature "ZyXEL_0001"))
334
335 $(eval $(call BuildImage))