56d048bbbd07fb0e7b8011ef895d88a70a4ff4a7
[openwrt.git] / target / linux / brcm63xx / image / Makefile
1 #
2 # Copyright (C) 2006-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 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/Build/CFE
31 # Generate the tagged image
32 $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
33 --output $(BIN_DIR)/openwrt-$(4)-$(1)-cfe.bin \
34 --boardid $(2) --chipid $(3) --entry $(KERNEL_ENTRY) \
35 --load-addr $(LOADADDR) --rsa-signature "$(5)" \
36 --info1 "$(4) $(REVISION)" --info2 $(1) \
37 $(6) $(7) $(8) $(9)
38 endef
39
40 define Image/Build/CFEAGPF
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-$(5)-$(1)-cfe.bin \
44 --boardid $(2) --chipid $(3) --entry $(LOADADDR) \
45 --load-addr $(LOADADDR) --tag-version 8 \
46 --signature2 IMAGE --block-size 0x20000 \
47 --image-offset $(4) --info1 "$(5) $(REVISION)" --info2 $(1)
48 endef
49
50 define Image/Build/RG100A
51 # Generate the tagged image
52 $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
53 --output $(BIN_DIR)/openwrt-$(5)-$(1)-cfe.bin \
54 --boardid $(2) --chipid $(3) --entry $(LOADADDR) \
55 --load-addr $(LOADADDR) --block-size 0x20000 \
56 --image-offset $(4) --info1 "$(5) $(REVISION)" --info2 $(1)
57 endef
58
59 define Image/Build/RedBoot
60 cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(1)-vmlinux.elf
61 gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
62 $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
63 dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(1)-vmlinux.lzma bs=65536 conv=sync
64 dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(1)-vmlinux.gz bs=65536 conv=sync
65 endef
66
67 define Image/Build/CFEOLD
68 $(TOPDIR)/scripts/brcmImage.pl -t -p \
69 -b $(2) -c $(3) \
70 -k $(KDIR)/vmlinux.lzma.cfe \
71 -r $(KDIR)/root.$(1) \
72 -o $(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin
73 endef
74
75 define Build/Clean
76 $(MAKE) -C lzma-loader clean
77 endef
78
79 define Image/Prepare
80 # Standard LZMA kernel
81 cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
82
83 # CFE is a LZMA nazi! It took me hours to find out the parameters!
84 # Also I think lzma has a bug cause it generates different output depending on
85 # if you use stdin / stdout or not. Use files instead of stdio here, cause
86 # otherwise CFE will complain and not boot the image.
87 $(STAGING_DIR_HOST)/bin/lzma e -d22 -fb64 -a1 $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma.tmp
88
89 # Strip out the length, CFE doesn't like this
90 dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe bs=5 count=1
91 dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe ibs=13 obs=5 skip=1 seek=1 conv=notrunc
92 rm -f $(KDIR)/vmlinux.lzma.tmp
93
94 # Build the LZMA loader
95 rm -f $(KDIR)/loader.gz
96 $(MAKE) -C lzma-loader \
97 BUILD_DIR="$(KDIR)" \
98 TARGET="$(KDIR)" \
99 clean install
100
101 echo -ne "\\x00" >> $(KDIR)/loader.gz
102 rm -f $(KDIR)/fs_mark
103 touch $(KDIR)/fs_mark
104 $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
105 endef
106
107 define Image/Build
108 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
109 # Various routers
110 $(call Image/Build/CFE,$(1),96345GW2,6345,96345GW2-generic)
111 $(call Image/Build/CFE,$(1),96345GW2,6345,96348GW2-bc221,,--layoutver 5)
112 $(call Image/Build/CFE,$(1),96345GW2,6345,92345GW2-revision,OpenWRT-$(REVISION))
113 $(call Image/Build/CFE,$(1),96348GW,6348,96348GW-generic,,)
114 $(call Image/Build/CFE,$(1),96348GW,6348,96348GW-bc221,,--layoutver 5)
115 $(call Image/Build/CFE,$(1),6338GW,6338,6338GW-generic,,)
116 $(call Image/Build/CFE,$(1),6338W,6338,6338W-generic,,)
117
118 # BT Voyager V210_BTR
119 $(call Image/Build/CFE,$(1),V210_BB,6348,BTV210_BTR,,--layoutver 5)
120 # BT Voyager V210_ROI, V210_WB
121 $(call Image/Build/CFE,$(1),V210,6348,BTV210_ROI_WB,,--layoutver 5)
122 # BT Voyager V2091_BTR
123 $(call Image/Build/CFE,$(1),V2091_BB,6348,BTV2091_BTR,,--layoutver 5)
124 # BT Voyager V2091_ROI, V2091_WB
125 $(call Image/Build/CFE,$(1),V2091,6348,BTV2091_ROI_WB,,--layoutver 5)
126 # BT Voyager V220V, V220V_MGCP_BTR
127 $(call Image/Build/CFE,$(1),RTA1052V,6348,BTV220V_MGCP_BTR,,--layoutver 5)
128 # BT Voyager V2110, V2110_AA, V2110_ROI
129 $(call Image/Build/CFE,$(1),V2110,6348,BTV2110,,--layoutver 5)
130 # BT Voyager V2500V, V2500V_SIP_CLUB, V2500V_AA
131 $(call Image/Build/CFE,$(1),V2500V_BB,6348,BTV2500V,,--layoutver 5)
132 # RTA1025W_16 (numerous routers)
133 $(call Image/Build/CFE,$(1),RTA1025W_16,6348,RTA1025W_16,,--layoutver 5)
134 # Tecom GW6000
135 $(call Image/Build/CFE,$(1),96348GW,6348,GW6000)
136 # Tecom GW6200
137 $(call Image/Build/CFE,$(1),96348GW,6348,GW6200,$(shell printf '\x99'))
138 # Neufbox4
139 $(call Image/Build/CFE,$(1),96358VW,6358,NEUFBOX4,OpenWRT-$(REVISION))
140 # Comtrend 536, 5621
141 $(call Image/Build/CFE,$(1),96348GW-11,6348,CT536_CT5621)
142 # Davolink DV201AMR
143 $(call Image/Build/CFEOLD,$(1),DV201AMR,6348)
144 # USR 9108
145 $(call Image/Build/CFE,$(1),96348GW-A,6348,USR9108)
146 # NetGear DG834GT, DG834PN
147 $(call Image/Build/CFE,$(1),96348GW-10,6348,DG834GT_DG834PN)
148 # Belkin f5d7633
149 $(call Image/Build/CFE,$(1),96348GW-10,6348,F5D7633)
150 # D-Link DSL-2640B
151 $(call Image/Build/CFE,$(1),D-4P-W,6348,DSL2640B)
152 # D-Link DSL-2740B
153 $(call Image/Build/CFE,$(1),96358GW,6358,DSL2740B)
154
155 # TP-Link TD-8810A, TD-8810B, TD-8811A, TD-8811B
156 $(call Image/Build/CFE,$(1),8L-2M-8M,6338,TP8810_8811)
157 # TP-Link 8900GB
158 $(call Image/Build/CFE,$(1),96348GW-11,6348,TD8900GB,$(shell printf 'PRID\x89\x10\x00\x02'))
159
160 # Sagem F@ST2404
161 $(call Image/Build/CFE,$(1),F@ST2404,6348,F@ST2404-cfe)
162 $(call Image/Build/CFE,$(1),F@ST2404,6348,F@ST2404,OpenWRT-$(REVISION))
163 # Inventel Livebox
164 $(call Image/Build/RedBoot,livebox)
165 # Pirelli Alice Gate VoIP 2 Plus Wi-Fi AGPF-S0
166 $(call Image/Build/CFEAGPF,$(1),AGPF-S0,6358,0x20000,AGV2+W-cfe)
167 $(call Image/Build/CFEAGPF,$(1),AGPF-S0,6358,0x20000,AGV2+W)
168 # Pirelli A226G
169 $(call Image/Build/CFEAGPF,$(1),DWV-S0,6358,0x10000,A226G-cfe)
170 $(call Image/Build/CFEAGPF,$(1),DWV-S0,6358,0x10000,A226G)
171
172 # RG100A,DB120 etc.
173 $(call Image/Build/RG100A,$(1),96358VW2,6358,0x20000,RG100A_DB120)
174
175 endef
176
177 $(eval $(call BuildImage))
This page took 0.046625 seconds and 3 git commands to generate.