2 # Copyright (C) 2006-2011 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/image.mk
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
16 LOADADDR
=$(LOADADDR
) \
17 KERNEL_ENTRY
=$(KERNEL_ENTRY
) \
20 define trxalign
/jffs2-128k
23 define trxalign
/jffs2-64k
26 define trxalign
/squashfs
30 define Image
/LimitName16
31 $(shell expr substr
"$(1)" 1 16)
34 define Image
/Build
/CFE
35 # Generate the tagged image
36 $(STAGING_DIR_HOST
)/bin
/imagetag
-i
$(KDIR
)/vmlinux.lzma.cfe
-f
$(KDIR
)/root.
$(1) \
37 --output
$(BIN_DIR
)/openwrt-
$(4)-$(1)-cfe.bin \
38 --boardid
$(2) --chipid
$(3) --entry
$(KERNEL_ENTRY
) \
39 --load-addr
$(LOADADDR
) --rsa-signature
"$(5)" \
40 --info1
"-$(call Image/LimitName16,$(4))" --info2
$(1) \
44 define Image
/Build
/CFEFIXUP
45 # Generate the tagged image
46 $(STAGING_DIR_HOST
)/bin
/imagetag
-i
$(KDIR
)/vmlinux.lzma.cfe
-f
$(KDIR
)/root.
$(1) \
47 --output
$(BIN_DIR
)/openwrt-
$(5)-$(1)-cfe.bin \
48 --boardid
$(2) --chipid
$(4) --entry
$(KERNEL_ENTRY
) \
49 --load-addr
$(LOADADDR
) --rsa-signature
"$(6)" \
50 --info1
"+$(call Image/LimitName16,$(3))" --info2
$(1) \
54 define Image
/Build
/CFEHW553
55 # Generate the tagged image
56 $(STAGING_DIR_HOST
)/bin
/imagetag
-i
$(KDIR
)/vmlinux.lzma.cfe
-f
$(KDIR
)/root.
$(1) \
57 --output
$(BIN_DIR
)/openwrt-
$(5)-$(1)-cfe.bin \
58 --boardid
$(2) --chipid
$(3) --entry
$(LOADADDR
) \
59 --load-addr
$(LOADADDR
) --tag-version
7 \
60 --block-size
0x20000 --image-offset
$(4)
63 define Image
/Build
/CFEAGPF
64 # Generate the tagged image
65 $(STAGING_DIR_HOST
)/bin
/imagetag
-i
$(KDIR
)/vmlinux.lzma.cfe
-f
$(KDIR
)/root.
$(1) \
66 --output
$(BIN_DIR
)/openwrt-
$(5)-$(1)-cfe.bin \
67 --boardid
$(2) --chipid
$(3) --entry
$(LOADADDR
) \
68 --load-addr
$(LOADADDR
) --tag-version
8 \
69 --signature2 IMAGE
--block-size
0x20000 \
70 --image-offset
$(4) --info1
"-$(call Image/LimitName16,$(5))" --info2
$(1)
73 define Image
/Build
/RG100A
74 # Generate the tagged image
75 $(STAGING_DIR_HOST
)/bin
/imagetag
-i
$(KDIR
)/vmlinux.lzma.cfe
-f
$(KDIR
)/root.
$(1) \
76 --output
$(BIN_DIR
)/openwrt-
$(5)-$(1)-cfe.bin \
77 --boardid
$(2) --chipid
$(3) --entry
$(LOADADDR
) \
78 --load-addr
$(LOADADDR
) --block-size
0x20000 \
79 --image-offset
$(4) --info1
"-$(call Image/LimitName16,$(5))" --info2
$(1)
82 define Image
/Build
/RedBoot
83 cp
$(KDIR
)/vmlinux.elf
$(BIN_DIR
)/openwrt-
$(1)-vmlinux.elf
84 gzip
-9 -c
$(KDIR
)/vmlinux
> $(KDIR
)/vmlinux.bin.gz
85 $(STAGING_DIR_HOST
)/bin
/lzma e
$(KDIR
)/vmlinux
$(KDIR
)/vmlinux.bin.l7
86 dd if
=$(KDIR
)/vmlinux.bin.l7 of
=$(BIN_DIR
)/openwrt-
$(1)-vmlinux.lzma bs
=65536 conv
=sync
87 dd if
=$(KDIR
)/vmlinux.bin.gz of
=$(BIN_DIR
)/openwrt-
$(1)-vmlinux.gz bs
=65536 conv
=sync
90 define Image
/Build
/SPW303V
91 # Generate the tagged image
92 $(STAGING_DIR_HOST
)/bin
/imagetag
-i
$(KDIR
)/vmlinux.lzma.cfe
-f
$(KDIR
)/root.
$(1) \
93 --output
$(BIN_DIR
)/openwrt-
$(4)-$(1)-cfe.bin.tmp \
94 --boardid
$(2) --chipid
$(3) --entry
$(KERNEL_ENTRY
) \
95 --load-addr
$(LOADADDR
) --rsa-signature
"$(5)" \
98 $(STAGING_DIR_HOST
)/bin
/spw303v
-i
$(BIN_DIR
)/openwrt-
$(4)-$(1)-cfe.bin.tmp \
99 -o
$(BIN_DIR
)/openwrt-
$(4)-$(1)-cfe-sysupgrade.bin
100 $(STAGING_DIR_HOST
)/bin
/xorimage
-i
$(BIN_DIR
)/openwrt-
$(4)-$(1)-cfe-sysupgrade.bin \
101 -o
$(BIN_DIR
)/openwrt-
$(4)-$(1)-cfe-factory.bin
102 rm -f
$(BIN_DIR
)/openwrt-
$(4)-$(1)-cfe.bin.tmp
105 define Image
/Build
/CFEOLD
106 $(TOPDIR
)/scripts
/brcmImage.pl
-t
-p \
108 -k
$(KDIR
)/vmlinux.lzma.cfe \
109 -r
$(KDIR
)/root.
$(1) \
110 -o
$(BIN_DIR
)/openwrt-
$(2)-$(1)-cfe.bin
114 $(MAKE
) -C lzma-loader
clean
118 # Standard LZMA kernel
119 cat
$(KDIR
)/vmlinux |
$(STAGING_DIR_HOST
)/bin
/lzma e
-si
-so
-eos
-lc1
-lp2
-pb2
> $(KDIR
)/vmlinux.lzma
121 # CFE is a LZMA nazi! It took me hours to find out the parameters!
122 # Also I think lzma has a bug cause it generates different output depending on
123 # if you use stdin / stdout or not. Use files instead of stdio here, cause
124 # otherwise CFE will complain and not boot the image.
125 $(STAGING_DIR_HOST
)/bin
/lzma e
-d22
-fb64
-a1
$(KDIR
)/vmlinux
$(KDIR
)/vmlinux.lzma.tmp
127 # Strip out the length, CFE doesn't like this
128 dd if
=$(KDIR
)/vmlinux.lzma.tmp of
=$(KDIR
)/vmlinux.lzma.cfe bs
=5 count
=1
129 dd if
=$(KDIR
)/vmlinux.lzma.tmp of
=$(KDIR
)/vmlinux.lzma.cfe ibs
=13 obs
=5 skip
=1 seek
=1 conv
=notrunc
130 rm -f
$(KDIR
)/vmlinux.lzma.tmp
132 # Build the LZMA loader
133 rm -f
$(KDIR
)/loader.gz
134 $(MAKE
) -C lzma-loader \
135 BUILD_DIR
="$(KDIR)" \
139 echo
-ne
"\\x00" >> $(KDIR
)/loader.gz
140 rm -f
$(KDIR
)/fs_mark
141 touch
$(KDIR
)/fs_mark
142 $(call prepare_generic_squashfs
,$(KDIR
)/fs_mark
)
146 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-root.
$(1) bs
=128k conv
=sync
148 $(call Image
/Build
/CFE
,$(1),96345GW2
,6345,96345GW2-generic
)
149 $(call Image
/Build
/CFE
,$(1),96345GW2
,6345,96348GW2-bc221
,,--layoutver
5)
150 $(call Image
/Build
/CFE
,$(1),96345GW2
,6345,92345GW2-rev
,OpenWRT-
$(REVISION
))
151 $(call Image
/Build
/CFE
,$(1),96348GW
,6348,96348GW-generic
,,)
152 $(call Image
/Build
/CFE
,$(1),96348GW
,6348,96348GW-bc221
,,--layoutver
5)
153 $(call Image
/Build
/CFE
,$(1),6338GW
,6338,6338GW-generic
,,)
154 $(call Image
/Build
/CFE
,$(1),6338W
,6338,6338W-generic
,,)
155 $(call Image
/Build
/CFE
,$(1),96348GW-11
,6348,96348GW-11-gen
)
156 $(call Image
/Build
/CFE
,$(1),96348GW-10
,6348,96348GW-10-gen
)
158 # BT Voyager V210_BTR
159 $(call Image
/Build
/CFE
,$(1),V210_BB
,6348,BTV210_BTR
,,--layoutver
5)
160 # BT Voyager V210_ROI, V210_WB
161 $(call Image
/Build
/CFE
,$(1),V210
,6348,BTV210_ROI_WB
,,--layoutver
5)
162 # BT Voyager V2091_BTR
163 $(call Image
/Build
/CFE
,$(1),V2091_BB
,6348,BTV2091_BTR
,,--layoutver
5)
164 # BT Voyager V2091_ROI, V2091_WB
165 $(call Image
/Build
/CFE
,$(1),V2091
,6348,BTV2091_ROI_WB
,,--layoutver
5)
166 # BT Voyager V220V, V220V_MGCP_BTR
167 $(call Image
/Build
/CFE
,$(1),RTA1052V
,6348,BTV220V_MGCP_BTR
,,--layoutver
5)
168 # BT Voyager V2110, V2110_AA, V2110_ROI
169 $(call Image
/Build
/CFE
,$(1),V2110
,6348,BTV2110
,,--layoutver
5)
170 # BT Voyager V2500V, V2500V_SIP_CLUB, V2500V_AA
171 $(call Image
/Build
/CFE
,$(1),V2500V_BB
,6348,BTV2500V
,,--layoutver
5)
172 # RTA1025W_16 (numerous routers)
173 $(call Image
/Build
/CFE
,$(1),RTA1025W_16
,6348,RTA1025W_16
,,--layoutver
5)
174 # RTA1320_16M (numerous routers)
175 $(call Image
/Build
/CFE
,$(1),RTA1320_16M
,6338,RTA1320_16M
,,--layoutver
5)
177 $(call Image
/Build
/CFEFIXUP
,$(1),96348GW
,GW6000
,6348,GW6000
)
179 $(call Image
/Build
/CFEFIXUP
,$(1),96348GW
,GW6200
,6348,GW6200
,$(shell printf
'\x99'))
181 $(call Image
/Build
/CFE
,$(1),96358VW
,6358,NEUFBOX4
,OpenWRT-
$(REVISION
))
183 $(call Image
/Build
/CFEFIXUP
,$(1),96348GW-11
,CT536_CT5621
,6348,CT536_CT5621
)
185 $(call Image
/Build
/CFEOLD
,$(1),DV201AMR
,6348)
187 $(call Image
/Build
/CFE
,$(1),96348GW-A
,6348,USR9108
)
188 # NetGear DG834GT, DG834PN
189 $(call Image
/Build
/CFE
,$(1),96348GW-10
,6348,DG834GT_DG834PN
)
191 $(call Image
/Build
/CFE
,$(1),96348GW-10
,6348,F5D7633
)
192 # D-Link DSL-2640B, rev B2
193 $(call Image
/Build
/CFE
,$(1),D-4P-W
,6348,DSL2640B-B2
)
195 $(call Image
/Build
/CFE
,$(1),96358VW2
,6358,DSL2650U
)
196 # D-Link DSL-2740B/DSL-2741B, rev C2
197 $(call Image
/Build
/CFEFIXUP
,$(1),96358GW
,AW4139
,6358,DSL274XB-C2
)
198 # D-Link DSL-2740B/DSL-2741B, rev C3
199 $(call Image
/Build
/CFE
,$(1),AW4139
,6358,DSL274XB-C3
)
200 # D-Link DVA-G3810BN/TL
201 $(call Image
/Build
/CFE
,$(1),96358GW
,6358,DVAG3810BN
)
203 # TP-Link TD-8810A, TD-8810B, TD-8811A, TD-8811B
204 $(call Image
/Build
/CFE
,$(1),8L-2M
-8M
,6338,TP8810_8811
)
206 $(call Image
/Build
/CFE
,$(1),96348GW-11
,6348,TD8900GB
,$(shell printf
'PRID\x89\x10\x00\x02'))
209 $(call Image
/Build
/CFE
,$(1),F@ST2404
,6348,F@ST2404-cfe
)
210 $(call Image
/Build
/CFE
,$(1),F@ST2404
,6348,F@ST2404
,OpenWRT-
$(REVISION
))
212 $(call Image
/Build
/RedBoot
,livebox
)
213 # Pirelli Alice Gate VoIP 2 Plus Wi-Fi AGPF-S0
214 $(call Image
/Build
/CFEAGPF
,$(1),AGPF-S0
,6358,0x20000,AGV2
+W-cfe
)
215 $(call Image
/Build
/CFEAGPF
,$(1),AGPF-S0
,6358,0x20000,AGV2
+W
)
217 $(call Image
/Build
/CFEAGPF
,$(1),DWV-S0
,6358,0x10000,A226G-cfe
)
218 $(call Image
/Build
/CFEAGPF
,$(1),DWV-S0
,6358,0x10000,A226G
)
221 $(call Image
/Build
/CFEAGPF
,$(1),DWV-S0
,6358,0x20000,A226M-cfe
)
222 $(call Image
/Build
/CFEAGPF
,$(1),DWV-S0
,6358,0x20000,A226M
)
225 $(call Image
/Build
/RG100A
,$(1),96358VW2
,6358,0x20000,RG100A_DB120
)
227 # Telsey CPVA642-type (e.g. CPA-ZNTE60T)
228 $(call Image
/Build
/CFE
,$(1),CPVA642
,6358,CPA-ZNTE60T
,,--signature
"Telsey Tlc",--signature2
"99.99.999",--second-image-flag
"0")
230 # T-Com Speedport W 500V
231 $(call Image
/Build
/CFEFIXUP
,$(1),96348GW
,SPW500V
,6348,SPW500V
)
234 $(call Image
/Build
/CFEHW553
,$(1),HW553
,6358,0x20000,HW553
)
236 # T-Com Speedport W 303V Typ B
237 $(call Image
/Build
/SPW303V
,$(1),96358-502V
,6358,SPW303V
)
240 $(eval
$(call BuildImage
))