lantiq: add device tree support for arv4519pw
[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 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 LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
18
19 define Image/BuildLoader/Template
20 -rm -rf $(KDIR)/lzma-loader
21 $(LOADER_MAKE) LOADER=loader-$(1).$(2)\
22 LZMA_TEXT_START=0x80a00000 \
23 LOADADDR=0x80002000 \
24 LOADER_DATA="$(KDIR)/vmlinux-$(1).lzma" BOARD="$(1)" \
25 compile loader.$(2)
26 endef
27
28
29 define CompressLzma
30 $(STAGING_DIR_HOST)/bin/lzma e $(1) $(2)
31 endef
32
33 define PatchKernelLzma
34 cp $(KDIR)/vmlinux$(2) $(KDIR)/vmlinux$(2)-$(1)
35 $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(1).dtb ../dts/$(1).dts
36 $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux$(2)-$(1) $(KDIR)/$(1).dtb
37 $(call CompressLzma,$(KDIR)/vmlinux$(2)-$(1),$(KDIR)/vmlinux$(2)-$(1).lzma)
38 endef
39
40 define MkBrnImage
41 mkbrncmdline -i $(KDIR)/vmlinux-$(4) -o $(KDIR)/vmlinux-$(4)-brn BRN-BOOT $(6)
42 $(call CompressLzma,$(KDIR)/vmlinux-$(4)-brn,$(KDIR)/vmlinux-$(4)-brn.lzma)
43 mkbrnimg -s $(1) -m $(2) -o $(3) $(KDIR)/vmlinux-$(4)-brn.lzma $(KDIR)/root.$(5)
44 endef
45
46 define MkImageLzma
47 mkimage -A mips -O linux -T kernel -a 0x80002000 -C lzma \
48 -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
49 -d $(KDIR)/vmlinux$(2)-$(1).lzma $(KDIR)/uImage-$(1)$(2)
50 endef
51
52 define MkImageEVA
53 lzma2eva 0x80002000 0x80002000 $(KDIR)/vmlinux-$(1).lzma $(KDIR)/$(1).eva.prealign
54 dd if=$(KDIR)/$(1).eva.prealign of=$(KDIR)/$(1).eva bs=64k conv=sync
55 cat ./eva.dummy.squashfs >> $(KDIR)/$(1).eva
56 endef
57
58 define CompressGzip
59 gzip -c $(1) > $(2)
60 endef
61
62 define PatchKernelGzip
63 cp $(KDIR)/vmlinux$(3) $(KDIR)/vmlinux$(3)-$(1)
64 $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux$(3)-$(1) '$(strip $(2))'
65 $(call CompressGzip,$(KDIR)/vmlinux$(3)-$(1),$(KDIR)/vmlinux$(3)-$(1).gzip)
66 endef
67
68 define MkImageGzip
69 mkimage -A mips -O linux -T kernel -a 0x80002000 -C gzip \
70 -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
71 -d $(KDIR)/vmlinux$(2)-$(1).gzip $(KDIR)/uImage-$(1)$(2)
72 endef
73
74 define Image/Build/squashfs
75 cat $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
76 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
77 $(if $(3),$(call MkBrnImage,$(3),$(4),$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(3)-brnImage,$(2),$(1),$(5)))
78 endef
79
80 define Image/BuildEVA/squashfs
81 cat $(KDIR)/$(2).eva $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva
82 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva)
83 endef
84
85 define Image/BuildLoader/squashfs
86 dd if=$(KDIR)/loader-$(2).bin of=$(KDIR)/loader-$(2).bin.padded bs=1536k conv=sync
87 cat $(KDIR)/loader-$(2).bin.padded $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
88 $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image)
89 endef
90
91 define Image/BuildNANDEVA/jffs2-128k
92 cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).rootfs
93 endef
94
95 define Image/Build/jffs2-64k
96 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=64k conv=sync
97 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
98 endef
99
100 define Image/Build/jffs2-128k
101 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=128k conv=sync
102 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
103 endef
104
105 define Image/Build/jffs2-256k
106 dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=256k conv=sync
107 cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image
108 endef
109
110 define Image/BuildKernel/Template
111 $(call PatchKernelLzma,$(1))
112 $(call MkImageLzma,$(1))
113 $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
114 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
115 $(call PatchKernelLzma,$(1),-initramfs)
116 $(call MkImageLzma,$(1),-initramfs)
117 $(CP) $(KDIR)/uImage-$(1)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage-initramfs
118 endif
119 endef
120
121 define Image/BuildKernelLoader/Template
122 $(call PatchKernelLzma,$(1))
123 $(call Image/BuildLoader/Template,$(1),bin)
124 $(CP) $(KDIR)/loader-$(1).bin $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux-loader
125 $(CP) $(KDIR)/vmlinux-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-vmlinux
126 endef
127
128 define Image/BuildKernelEVA/Template
129 $(call PatchKernelLzma,$(1))
130 $(call MkImageEVA,$(1))
131 $(CP) $(KDIR)/$(1).eva $(BIN_DIR)/$(IMG_PREFIX)-$(1).eva
132 endef
133
134 define Image/BuildKernelGzip/Template
135 $(call PatchKernelGzip,$(1),$(if $(2),$(2) machtype=$(1),))
136 $(call MkImageGzip,$(1))
137 $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage
138 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
139 $(call PatchKernelGzip,$(1),$(if $(2),$(2) machtype=$(1),),-initramfs)
140 $(call MkImageGzip,$(1),-initramfs)
141 $(CP) $(KDIR)/uImage-$(1)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage-initramfs
142 endif
143 endef
144
145
146 ifeq ($(CONFIG_TARGET_lantiq_falcon),y)
147
148 Image/BuildKernel/Profile/EASY98000NOR=$(call Image/BuildKernel/Template,EASY98000NOR)
149 Image/Build/Profile/EASY98000NOR=$(call Image/Build/$(1),$(1),EASY98000NOR)
150
151 Image/BuildKernel/Profile/EASY98000SFLASH=$(call Image/BuildKernel/Template,EASY98000SFLASH)
152 Image/Build/Profile/EASY98000SFLASH=$(call Image/Build/$(1),$(1),EASY98000SFLASH)
153
154 endif
155
156
157
158 ifeq ($(CONFIG_TARGET_lantiq_ase),y)
159
160 Image/BuildKernel/Profile/DGN1000B=$(call Image/BuildKernel/Template,DGN1000B)
161 Image/Build/Profile/DGN1000B=$(call Image/Build/$(1),$(1),DGN1000B)
162
163 endif
164
165
166
167 ifeq ($(CONFIG_TARGET_lantiq_xway),y)
168
169 # Danube
170 Image/BuildKernel/Profile/EASY50712=$(call Image/BuildKernel/Template,EASY50712)
171 Image/Build/Profile/EASY50712=$(call Image/Build/$(1),$(1),EASY50712)
172
173 Image/BuildKernel/Profile/ACMP252=$(call Image/BuildKernel/Template,ACMP252)
174 Image/Build/Profile/ACMP252=$(call Image/Build/$(1),$(1),ACMP252)
175
176 Image/BuildKernel/Profile/ARV4510PW=$(call Image/BuildKernel/Template,ARV4510PW)
177 Image/Build/Profile/ARV4510PW=$(call Image/Build/$(1),$(1),ARV4510PW)
178
179 Image/BuildKernel/Profile/ARV4525PW=$(call Image/BuildKernel/Template,ARV4525PW)
180 Image/Build/Profile/ARV4525PW=$(call Image/Build/$(1),$(1),ARV4525PW)
181
182 Image/BuildKernel/Profile/ARV7525PW=$(call Image/BuildKernel/Template,ARV7525PW)
183 Image/Build/Profile/ARV7525PW=$(call Image/Build/$(1),$(1),ARV7525PW)
184
185 Image/BuildKernel/Profile/ARV4518PWR01=$(call Image/BuildKernel/Template,ARV4518PWR01)
186 Image/Build/Profile/ARV4518PWR01=$(call Image/Build/$(1),$(1),ARV4518PWR01)
187
188 Image/BuildKernel/Profile/ARV4518PWR01A=$(call Image/BuildKernel/Template,ARV4518PWR01A)
189 Image/Build/Profile/ARV4518PWR01A=$(call Image/Build/$(1),$(1),ARV4518PWR01A)
190
191 Image/BuildKernel/Profile/ARV4519PW=$(call Image/BuildKernel/Template,ARV4519PW)
192 Image/Build/Profile/ARV4519PW=$(call Image/Build/$(1),$(1),ARV4519PW)
193
194 Image/BuildKernel/Profile/ARV4520PW=$(call Image/BuildKernel/Template,ARV4520PW)
195 Image/Build/Profile/ARV4520PW=$(call Image/Build/$(1),$(1),ARV4520PW)
196
197 Image/BuildKernel/Profile/ARV452CQW=$(call Image/BuildKernel/Template,ARV452CQW)
198 Image/Build/Profile/ARV452CQW=$(call Image/Build/$(1),$(1),ARV452CQW)
199
200 Image/BuildKernel/Profile/ARV7518PW=$(call Image/BuildKernel/Template,ARV7518PW)
201 Image/Build/Profile/ARV7518PW=$(call Image/Build/$(1),$(1),ARV7518PW)
202
203 Image/BuildKernel/Profile/ARV752DPW=$(call Image/BuildKernel/Template,ARV752DPW)
204 Image/Build/Profile/ARV752DPW=$(call Image/Build/$(1),$(1),ARV752DPW)
205
206 Image/BuildKernel/Profile/ARV752DPW22=$(call Image/BuildKernel/Template,ARV752DPW22)
207 Image/Build/Profile/ARV752DPW22=$(call Image/Build/$(1),$(1),ARV752DPW22)
208
209
210 # AR9
211 Image/BuildKernel/Profile/DGN3500=$(call Image/BuildKernel/Template,DGN3500)
212 Image/Build/Profile/DGN3500=$(call Image/Build/$(1),$(1),DGN3500)
213
214 Image/BuildKernel/Profile/DGN3500B=$(call Image/BuildKernel/Template,DGN3500)
215 Image/Build/Profile/DGN3500B=$(call Image/Build/$(1),$(1),DGN3500)
216
217 Image/BuildKernel/Profile/WBMRA=$(call Image/BuildKernel/Template,WBMR)
218 Image/Build/Profile/WBMRA=$(call Image/Build/$(1),$(1),WBMR)
219
220 Image/BuildKernel/Profile/WBMRB=$(call Image/BuildKernel/Template,WBMR)
221 Image/Build/Profile/WBMRB=$(call Image/Build/$(1),$(1),WBMR)
222
223 Image/BuildKernel/Profile/FRITZ7320=$(call Image/BuildKernelEVA/Template,FRITZ7320)
224 Image/Build/Profile/FRITZ7320=$(call Image/BuildEVA/$(1),$(1),FRITZ7320)
225
226
227 # VR9
228 Image/BuildKernel/Profile/EASY80920NAND=$(call Image/BuildKernel/Template,EASY80920NAND)
229 Image/Build/Profile/EASY80920NAND=$(call Image/Build/$(1),$(1),EASY80920NAND)
230
231 Image/BuildKernel/Profile/EASY80920NOR=$(call Image/BuildKernel/Template,EASY80920NOR)
232 Image/Build/Profile/EASY80920NOR=$(call Image/Build/$(1),$(1),EASY80920NOR)
233
234 Image/BuildKernel/Profile/FRITZ3370=$(call Image/BuildKernelEVA/Template,FRITZ3370)
235 Image/Build/Profile/FRITZ3370=$(call Image/BuildNANDEVA/$(1),$(1),FRITZ3370)
236
237 Image/BuildKernel/Profile/VG3503J=$(call Image/BuildKernelLoader/Template,VG3503J)
238 Image/Build/Profile/VG3503J=$(call Image/BuildLoader/$(1),$(1),VG3503J)
239
240 endif
241
242
243
244 ifeq ($(CONFIG_TARGET_lantiq_svip_be),y)
245
246 Image/BuildKernel/Profile/EASY33016=$(call Image/BuildKernelGzip/Template,EASY33016)
247 Image/Build/Profile/EASY33016=$(call Image/Build/$(1),$(1),EASY33016)
248
249 endif
250
251
252 define Image/BuildKernel
253 $(call Image/BuildKernel/Profile/$(PROFILE))
254 endef
255
256 define Image/Build
257 $(call Image/Build/Profile/$(PROFILE),$(1))
258 endef
259
260 $(eval $(call BuildImage))