add FE phy firmware
[openwrt/openwrt.git] / target / linux / lantiq / image / Makefile
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 #
7
8 # boards missing since devicetree update
9 #EASY50712 ARV3527P GIGASX76X ARV4519PW BTHOMEHUBV2B BTHOMEHUBV2BOPENRG
10 #WBMR P2601HNFX H201L
11
12 include $(TOPDIR)/rules.mk
13 include $(INCLUDE_DIR)/image.mk
14
15 JFFS2_BLOCKSIZE = 64k 128k 256k
16
17 define CompressLzma
18 $(STAGING_DIR_HOST)/bin/lzma e $(1) $(2)
19 endef
20
21 define PatchKernelLzma
22 cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
23 $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(1).dtb ./$(1).dts
24 $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1) $(KDIR)/$(1).dtb
25 $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).lzma)
26 endef
27
28 define MkBrnImage
29 mkbrncmdline -i $(KDIR)/vmlinux-$(4) -o $(KDIR)/vmlinux-$(4)-brn BRN-BOOT $(6)
30 $(call CompressLzma,$(KDIR)/vmlinux-$(4)-brn,$(KDIR)/vmlinux-$(4)-brn.lzma)
31 mkbrnimg -s $(1) -m $(2) -o $(3) $(KDIR)/vmlinux-$(4)-brn.lzma $(KDIR)/root.$(5)
32 endef
33
34 define MkImageLzma
35 mkimage -A mips -O linux -T kernel -a 0x80002000 -C lzma \
36 -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
37 -d $(KDIR)/vmlinux-$(1).lzma $(KDIR)/uImage-$(1)
38 endef
39
40 define MkImageEVA
41 lzma2eva 0x80002000 0x80002000 $(KDIR)/vmlinux-$(1).lzma $(KDIR)/$(1).eva.prealign
42 dd if=$(KDIR)/$(1).eva.prealign of=$(KDIR)/$(1).eva bs=64k conv=sync
43 cat ./eva.dummy.squashfs >> $(KDIR)/$(1).eva
44 endef
45
46 define CompressGzip
47 gzip -c $(1) > $(2)
48 endef
49
50 define PatchKernelGzip
51 cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1)
52 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))'
53 $(call CompressGzip,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).gzip)
54 endef
55
56 define MkImageGzip
57 mkimage -A mips -O linux -T kernel -a 0x80002000 -C gzip \
58 -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
59 -d $(KDIR)/vmlinux-$(1).gzip $(KDIR)/uImage-$(1)
60 endef
61
62 define Image/Build/squashfs
63 cat $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
64 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
65 $(if $(3),$(call MkBrnImage,$(3),$(4),$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(3)-brnImage,$(2),$(1),$(5)))
66 endef
67
68 define Image/BuildEVA/squashfs
69 cat $(KDIR)/$(2).eva $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva
70 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva)
71 endef
72
73 define Image/BuildNANDEVA/jffs2-128k
74 cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).rootfs
75 endef
76
77 define Image/Build/jffs2-64k
78 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=64k conv=sync
79 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
80 endef
81
82 define Image/Build/jffs2-128k
83 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=128k conv=sync
84 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
85 endef
86
87 define Image/Build/jffs2-256k
88 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=256k conv=sync
89 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
90 endef
91
92 define Image/BuildKernel/Template
93 $(call PatchKernelLzma,$(1),$(if $(2),$(2) machtype=$(1),))
94 $(call MkImageLzma,$(1))
95 $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
96 endef
97
98 define Image/BuildKernelEVA/Template
99 $(call PatchKernelLzma,$(1),$(if $(2),$(2) machtype=$(1),))
100 $(call MkImageEVA,$(1))
101 $(CP) $(KDIR)/$(1).eva $(BIN_DIR)/$(IMG_PREFIX)-$(1).eva
102 endef
103
104 define Image/BuildKernelGzip/Template
105 $(call PatchKernelGzip,$(1),$(if $(2),$(2) machtype=$(1),))
106 $(call MkImageGzip,$(1))
107 $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
108 endef
109
110
111 ifeq ($(CONFIG_TARGET_lantiq_falcon),y)
112
113 Image/BuildKernel/Profile/EASY98000NOR=$(call Image/BuildKernel/Template,EASY98000NOR)
114 Image/Build/Profile/EASY98000NOR=$(call Image/Build/$(1),$(1),EASY98000NOR)
115
116 Image/BuildKernel/Profile/EASY98000SFLASH=$(call Image/BuildKernel/Template,EASY98000SFLASH)
117 Image/Build/Profile/EASY98000SFLASH=$(call Image/Build/$(1),$(1),EASY98000SFLASH)
118
119 endif
120
121
122
123 ifeq ($(CONFIG_TARGET_lantiq_ase),y)
124
125 Image/BuildKernel/Profile/DGN1000B=$(call Image/BuildKernel/Template,DGN1000B)
126 Image/Build/Profile/DGN1000B=$(call Image/Build/$(1),$(1),DGN1000B)
127
128 endif
129
130
131
132 ifeq ($(CONFIG_TARGET_lantiq_xway),y)
133
134 # Danube
135 Image/BuildKernel/Profile/EASY50712=$(call Image/BuildKernel/Template,EASY50712)
136 Image/Build/Profile/EASY50712=$(call Image/Build/$(1),$(1),EASY50712)
137
138 Image/BuildKernel/Profile/ACMP252=$(call Image/BuildKernel/Template,ACMP252)
139 Image/Build/Profile/ACMP252=$(call Image/Build/$(1),$(1),ACMP252)
140
141 Image/BuildKernel/Profile/ARV4510PW=$(call Image/BuildKernel/Template,ARV4510PW)
142 Image/Build/Profile/ARV4510PW=$(call Image/Build/$(1),$(1),ARV4510PW)
143
144 Image/BuildKernel/Profile/ARV4525PW=$(call Image/BuildKernel/Template,ARV4525PW)
145 Image/Build/Profile/ARV4525PW=$(call Image/Build/$(1),$(1),ARV4525PW)
146
147 Image/BuildKernel/Profile/ARV7525PW=$(call Image/BuildKernel/Template,ARV7525PW)
148 Image/Build/Profile/ARV7525PW=$(call Image/Build/$(1),$(1),ARV7525PW)
149
150 Image/BuildKernel/Profile/ARV4518PWR01=$(call Image/BuildKernel/Template,ARV4518PWR01)
151 Image/Build/Profile/ARV4518PWR01=$(call Image/Build/$(1),$(1),ARV4518PWR01)
152
153 Image/BuildKernel/Profile/ARV4518PWR01A=$(call Image/BuildKernel/Template,ARV4518PWR01A)
154 Image/Build/Profile/ARV4518PWR01A=$(call Image/Build/$(1),$(1),ARV4518PWR01A)
155
156 Image/BuildKernel/Profile/ARV4520PW=$(call Image/BuildKernel/Template,ARV4520PW)
157 Image/Build/Profile/ARV4520PW=$(call Image/Build/$(1),$(1),ARV4520PW)
158
159 Image/BuildKernel/Profile/ARV452CQW=$(call Image/BuildKernel/Template,ARV452CQW)
160 Image/Build/Profile/ARV452CQW=$(call Image/Build/$(1),$(1),ARV452CQW)
161
162 Image/BuildKernel/Profile/ARV7518PW=$(call Image/BuildKernel/Template,ARV7518PW)
163 Image/Build/Profile/ARV7518PW=$(call Image/Build/$(1),$(1),ARV7518PW)
164
165 Image/BuildKernel/Profile/ARV752DPW=$(call Image/BuildKernel/Template,ARV752DPW)
166 Image/Build/Profile/ARV752DPW=$(call Image/Build/$(1),$(1),ARV752DPW)
167
168 Image/BuildKernel/Profile/ARV752DPW22=$(call Image/BuildKernel/Template,ARV752DPW22)
169 Image/Build/Profile/ARV752DPW22=$(call Image/Build/$(1),$(1),ARV752DPW22)
170
171
172 # AR9
173 Image/BuildKernel/Profile/DGN3500=$(call Image/BuildKernel/Template,DGN3500)
174 Image/Build/Profile/DGN3500=$(call Image/Build/$(1),$(1),DGN3500)
175
176 Image/BuildKernel/Profile/DGN3500B=$(call Image/BuildKernel/Template,DGN3500)
177 Image/Build/Profile/DGN3500B=$(call Image/Build/$(1),$(1),DGN3500)
178
179 Image/BuildKernel/Profile/WBMRA=$(call Image/BuildKernel/Template,WBMR)
180 Image/Build/Profile/WBMRA=$(call Image/Build/$(1),$(1),WBMR)
181
182 Image/BuildKernel/Profile/WBMRB=$(call Image/BuildKernel/Template,WBMR)
183 Image/Build/Profile/WBMRB=$(call Image/Build/$(1),$(1),WBMR)
184
185 Image/BuildKernel/Profile/FRITZ7320=$(call Image/BuildKernelEVA/Template,FRITZ7320)
186 Image/Build/Profile/FRITZ7320=$(call Image/BuildEVA/$(1),$(1),FRITZ7320)
187
188
189 # VR9
190 Image/BuildKernel/Profile/EASY80920NAND=$(call Image/BuildKernel/Template,EASY80920NAND)
191 Image/Build/Profile/EASY80920NAND=$(call Image/Build/$(1),$(1),EASY80920NAND)
192
193 Image/BuildKernel/Profile/EASY80920NOR=$(call Image/BuildKernel/Template,EASY80920NOR)
194 Image/Build/Profile/EASY80920NOR=$(call Image/Build/$(1),$(1),EASY80920NOR)
195
196 Image/BuildKernel/Profile/FRITZ3370=$(call Image/BuildKernelEVA/Template,FRITZ3370)
197 Image/Build/Profile/FRITZ3370=$(call Image/BuildNANDEVA/$(1),$(1),FRITZ3370)
198
199 endif
200
201
202
203 ifeq ($(CONFIG_TARGET_lantiq_svip_be),y)
204
205 Image/BuildKernel/Profile/EASY33016=$(call Image/BuildKernelGzip/Template,EASY33016)
206 Image/Build/Profile/EASY33016=$(call Image/Build/$(1),$(1),EASY33016)
207
208 endif
209
210
211 define Image/BuildKernel
212 $(call Image/BuildKernel/Profile/$(PROFILE))
213 endef
214
215 define Image/Build
216 $(call Image/Build/Profile/$(PROFILE),$(1))
217 endef
218
219 $(eval $(call BuildImage))