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