2 # Copyright (C) 2010-2012 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 # boards missing since devicetree update
9 #EASY50712 ARV3527P BTHOMEHUBV2B BTHOMEHUBV2BOPENRG
11 include $(TOPDIR
)/rules.mk
12 include $(INCLUDE_DIR
)/image.mk
14 JFFS2_BLOCKSIZE
= 64k
128k
256k
16 LOADER_MAKE
:= $(NO_TRACE_MAKE
) -C lzma-loader KDIR
=$(KDIR
)
18 define Image
/BuildLoader
/Template
19 -rm -rf
$(KDIR
)/lzma-loader
20 $(LOADER_MAKE
) LOADER
=loader
$(2)-$(1).bin\
21 LZMA_TEXT_START
=0x80a00000 \
23 LOADER_DATA
="$(KDIR)/vmlinux$(2)-$(1).lzma" BOARD
="$(1)" \
29 $(STAGING_DIR_HOST
)/bin
/lzma e
$(1) $(2)
32 define PatchKernelLzma
33 cp
$(KDIR
)/vmlinux
$(2) $(KDIR
)/vmlinux
$(2)-$(1)
34 $(LINUX_DIR
)/scripts
/dtc
/dtc
-O dtb
-o
$(KDIR
)/$(1).dtb ..
/dts
/$(1).dts
35 $(STAGING_DIR_HOST
)/bin
/patch-dtb
$(KDIR
)/vmlinux
$(2)-$(1) $(KDIR
)/$(1).dtb
36 $(call CompressLzma
,$(KDIR
)/vmlinux
$(2)-$(1),$(KDIR
)/vmlinux
$(2)-$(1).lzma
)
40 mkbrncmdline
-i
$(KDIR
)/vmlinux-
$(4) -o
$(KDIR
)/vmlinux-
$(4)-brn BRN-BOOT
$(6)
41 $(call CompressLzma
,$(KDIR
)/vmlinux-
$(4)-brn
,$(KDIR
)/vmlinux-
$(4)-brn.lzma
)
42 mkbrnimg
-s
$(1) -m
$(2) -o
$(3) $(KDIR
)/vmlinux-
$(4)-brn.lzma
$(KDIR
)/root.
$(5)
46 mkimage
-A mips
-O linux
-T kernel
-a
0x80002000 -C lzma \
47 -e
0x80002000 -n
'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
48 -d
$(KDIR
)/vmlinux
$(2)-$(1).lzma
$(KDIR
)/uImage-
$(1)$(2)
51 define TPLinkImageLzma
52 mktplinkfw2
-c
-B
$(2) -s \
53 -k
$(KDIR
)/vmlinux
$(3)-$(1).lzma
-o
$(KDIR
)/uImage-
$(1)$(3)
57 lzma2eva
0x80002000 0x80002000 $(KDIR
)/vmlinux-
$(1).lzma
$(KDIR
)/$(1).eva.prealign
58 dd if
=$(KDIR
)/$(1).eva.prealign of
=$(KDIR
)/$(1).eva.align
.64k bs
=64k conv
=sync
59 dd if
=$(KDIR
)/$(1).eva.prealign of
=$(KDIR
)/$(1).eva.align
.128k bs
=128k conv
=sync
60 cat .
/eva.dummy.squashfs
>> $(KDIR
)/$(1).eva.align
.64k
67 define PatchKernelGzip
68 cp
$(KDIR
)/vmlinux
$(3) $(KDIR
)/vmlinux
$(3)-$(1)
69 $(STAGING_DIR_HOST
)/bin
/patch-cmdline
$(KDIR
)/vmlinux
$(3)-$(1) '$(strip $(2))'
70 $(call CompressGzip
,$(KDIR
)/vmlinux
$(3)-$(1),$(KDIR
)/vmlinux
$(3)-$(1).gzip
)
74 mkimage
-A mips
-O linux
-T kernel
-a
0x80002000 -C gzip \
75 -e
0x80002000 -n
'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
76 -d
$(KDIR
)/vmlinux
$(2)-$(1).gzip
$(KDIR
)/uImage-
$(1)$(2)
79 define Image
/Build
/squashfs
80 cat
$(KDIR
)/uImage-
$(2) $(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
81 $(call prepare_generic_squashfs
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
)
82 $(if
$(3),$(call MkBrnImage
,$(3),$(4),$(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(3)-brnImage
,$(2),$(1),$(5)))
85 define Image
/BuildTPLink
/squashfs
86 mktplinkfw2
-B
$(3) -s
-a
0x4 -j \
87 -k
$(KDIR
)/vmlinux-
$(2).lzma
-r
$(KDIR
)/root.
$(1) \
88 -o
$(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-sysupgrade.image
91 define Image
/BuildEVA
/squashfs
92 cat
$(KDIR
)/$(2).eva.align
.64k
$(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image.eva
93 $(call prepare_generic_squashfs
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image.eva
)
96 define Image
/BuildLoader
/squashfs
97 dd if
=$(KDIR
)/loader-
$(2).bin of
=$(KDIR
)/loader-
$(2).bin.padded bs
=1536k conv
=sync
98 cat
$(KDIR
)/loader-
$(2).bin.padded
$(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
99 $(call prepare_generic_squashfs
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
)
102 define Image
/BuildEVA
/jffs2-128k
103 cat
$(KDIR
)/$(2).eva.align
.128k
$(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image.eva
106 define Image
/Build
/jffs2-64k
107 dd if
=$(KDIR
)/uImage-
$(2) of
=$(KDIR
)/uImage-
$(2)-$(1) bs
=64k conv
=sync
108 cat
$(KDIR
)/uImage-
$(2)-$(1) $(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
111 define Image
/Build
/jffs2-128k
112 dd if
=$(KDIR
)/uImage-
$(2) of
=$(KDIR
)/uImage-
$(2)-$(1) bs
=128k conv
=sync
113 cat
$(KDIR
)/uImage-
$(2)-$(1) $(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
116 define Image
/Build
/jffs2-256k
117 dd if
=$(KDIR
)/uImage-
$(2) of
=$(KDIR
)/uImage-
$(2)-$(1) bs
=256k conv
=sync
118 cat
$(KDIR
)/uImage-
$(2)-$(1) $(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
121 define Image
/Build
/ubifs
123 ifneq ($($(PROFILE
)_UBIFS_OPTS
),)
124 $(CP
) $(KDIR
)/root.ubifs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE
)-rootfs.ubifs
128 define Image
/Build
/ubi
130 ifneq ($($(PROFILE
)_UBI_OPTS
),)
131 $(CP
) $(KDIR
)/root.ubi
$(BIN_DIR
)/$(IMG_PREFIX
)-$(PROFILE
)-rootfs.ubi
135 define Image
/InstallKernel
/Template
137 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL
),)
138 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
140 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE
),)
141 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-uImage
$(TARGET_DIR
)/boot
/
142 ln
-sf
$(IMG_PREFIX
)-$(1)-uImage
$(TARGET_DIR
)/boot
/uImage
145 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE
),)
146 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-zImage
$(TARGET_DIR
)/boot
/
147 ln
-sf
$(IMG_PREFIX
)-$(1)-zImage
$(TARGET_DIR
)/boot
/zImage
151 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB
),)
152 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
155 $(CP
) $(KDIR
)/$(1).dtb
$(TARGET_DIR
)/boot
/
160 define Image
/BuildKernel
/Template
161 $(call PatchKernelLzma
,$(1))
162 $(call MkImageLzma
,$(1))
163 $(CP
) $(KDIR
)/uImage-
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-uImage
164 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
165 $(call PatchKernelLzma
,$(1),-initramfs
)
166 $(call MkImageLzma
,$(1),-initramfs
)
167 $(CP
) $(KDIR
)/uImage-
$(1)-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-uImage-initramfs
171 define Image
/BuildKernelLoader
/Template
172 $(call PatchKernelLzma
,$(1))
173 $(call Image
/BuildLoader
/Template
,$(1))
174 $(CP
) $(KDIR
)/loader-
$(1).bin
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux-loader
175 $(CP
) $(KDIR
)/vmlinux-
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux
176 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
177 $(call PatchKernelLzma
,$(1),-initramfs
)
178 $(call Image
/BuildLoader
/Template
,$(1),-initramfs
)
179 $(CP
) $(KDIR
)/loader-initramfs-
$(1).bin
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux-initramfs-loader
180 $(CP
) $(KDIR
)/vmlinux-initramfs-
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-vmlinux-initramfs
184 define Image
/BuildKernelTPLink
/Template
185 $(call PatchKernelLzma
,$(1))
186 $(call TPLinkImageLzma
,$(1),$(2))
187 $(CP
) $(KDIR
)/uImage-
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-uImage
188 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
189 $(call PatchKernelLzma
,$(1),-initramfs
)
190 $(call TPLinkImageLzma
,$(1),$(2),-initramfs
)
191 $(CP
) $(KDIR
)/uImage-
$(1)-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-uImage-initramfs
195 define Image
/BuildKernelEVA
/Template
196 $(call PatchKernelLzma
,$(1))
197 $(call MkImageEVA
,$(1))
198 $(CP
) $(KDIR
)/$(1).eva.align
.64k
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).eva.align
.64k
199 $(CP
) $(KDIR
)/$(1).eva.align
.128k
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).eva.align
.128k
202 define Image
/BuildKernelGzip
/Template
203 $(call PatchKernelGzip
,$(1),$(if
$(2),$(2) machtype
=$(1),))
204 $(call MkImageGzip
,$(1))
205 $(CP
) $(KDIR
)/uImage-
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-uImage
206 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
207 $(call PatchKernelGzip
,$(1),$(if
$(2),$(2) machtype
=$(1),),-initramfs
)
208 $(call MkImageGzip
,$(1),-initramfs
)
209 $(CP
) $(KDIR
)/uImage-
$(1)-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-uImage-initramfs
214 ifeq ($(CONFIG_TARGET_lantiq_falcon
),y
)
216 Image
/BuildKernel
/Profile
/EASY98000NOR
=$(call Image
/BuildKernel
/Template
,EASY98000NOR
)
217 Image
/Build
/Profile
/EASY98000NOR
=$(call Image
/Build
/$(1),$(1),EASY98000NOR
)
219 Image
/BuildKernel
/Profile
/EASY98000SFLASH
=$(call Image
/BuildKernel
/Template
,EASY98000SFLASH
)
220 Image
/Build
/Profile
/EASY98000SFLASH
=$(call Image
/Build
/$(1),$(1),EASY98000SFLASH
)
225 ifeq ($(CONFIG_TARGET_lantiq_ase
),y
)
227 Image
/BuildKernel
/Profile
/DGN1000B
=$(call Image
/BuildKernel
/Template
,DGN1000B
)
228 Image
/Build
/Profile
/DGN1000B
=$(call Image
/Build
/$(1),$(1),DGN1000B
)
233 ifeq ($(CONFIG_TARGET_lantiq_xway
),y
)
236 Image
/BuildKernel
/Profile
/EASY50712
=$(call Image
/BuildKernel
/Template
,EASY50712
)
237 Image
/Build
/Profile
/EASY50712
=$(call Image
/Build
/$(1),$(1),EASY50712
)
239 Image
/BuildKernel
/Profile
/ACMP252
=$(call Image
/BuildKernel
/Template
,ACMP252
)
240 Image
/Build
/Profile
/ACMP252
=$(call Image
/Build
/$(1),$(1),ACMP252
)
242 Image
/BuildKernel
/Profile
/ARV4510PW
=$(call Image
/BuildKernel
/Template
,ARV4510PW
)
243 Image
/Build
/Profile
/ARV4510PW
=$(call Image
/Build
/$(1),$(1),ARV4510PW
)
245 Image
/BuildKernel
/Profile
/ARV4525PW
=$(call Image
/BuildKernel
/Template
,ARV4525PW
)
246 Image
/Build
/Profile
/ARV4525PW
=$(call Image
/Build
/$(1),$(1),ARV4525PW
)
248 Image
/BuildKernel
/Profile
/ARV7525PW
=$(call Image
/BuildKernel
/Template
,ARV7525PW
)
249 Image
/Build
/Profile
/ARV7525PW
=$(call Image
/Build
/$(1),$(1),ARV7525PW
)
251 Image
/BuildKernel
/Profile
/ARV4518PWR01
=$(call Image
/BuildKernel
/Template
,ARV4518PWR01
)
252 Image
/Build
/Profile
/ARV4518PWR01
=$(call Image
/Build
/$(1),$(1),ARV4518PWR01
)
254 Image
/BuildKernel
/Profile
/ARV4518PWR01A
=$(call Image
/BuildKernel
/Template
,ARV4518PWR01A
)
255 Image
/Build
/Profile
/ARV4518PWR01A
=$(call Image
/Build
/$(1),$(1),ARV4518PWR01A
)
257 Image
/BuildKernel
/Profile
/ARV4519PW
=$(call Image
/BuildKernel
/Template
,ARV4519PW
)
258 Image
/Build
/Profile
/ARV4519PW
=$(call Image
/Build
/$(1),$(1),ARV4519PW
)
260 Image
/BuildKernel
/Profile
/ARV4520PW
=$(call Image
/BuildKernel
/Template
,ARV4520PW
)
261 Image
/Build
/Profile
/ARV4520PW
=$(call Image
/Build
/$(1),$(1),ARV4520PW
)
263 Image
/BuildKernel
/Profile
/ARV452CQW
=$(call Image
/BuildKernel
/Template
,ARV452CQW
)
264 Image
/Build
/Profile
/ARV452CQW
=$(call Image
/Build
/$(1),$(1),ARV452CQW
)
266 Image
/BuildKernel
/Profile
/ARV7510PW22
=$(call Image
/BuildKernel
/Template
,ARV7510PW22
)
267 Image
/Build
/Profile
/ARV7510PW22
=$(call Image
/Build
/$(1),$(1),ARV7510PW22
)
269 Image
/BuildKernel
/Profile
/ARV7518PW
=$(call Image
/BuildKernel
/Template
,ARV7518PW
)
270 Image
/Build
/Profile
/ARV7518PW
=$(call Image
/Build
/$(1),$(1),ARV7518PW
)
272 Image
/BuildKernel
/Profile
/ARV7519PW
=$(call Image
/BuildKernel
/Template
,ARV7519PW
)
273 Image
/Build
/Profile
/ARV7519PW
=$(call Image
/Build
/$(1),$(1),ARV7519PW
)
275 Image
/BuildKernel
/Profile
/ARV752DPW
=$(call Image
/BuildKernel
/Template
,ARV752DPW
)
276 Image
/Build
/Profile
/ARV752DPW
=$(call Image
/Build
/$(1),$(1),ARV752DPW
)
278 Image
/BuildKernel
/Profile
/ARV752DPW22
=$(call Image
/BuildKernel
/Template
,ARV752DPW22
)
279 Image
/Build
/Profile
/ARV752DPW22
=$(call Image
/Build
/$(1),$(1),ARV752DPW22
)
281 Image
/BuildKernel
/Profile
/GIGASX76X
=$(call Image
/BuildKernel
/Template
,GIGASX76X
)
282 Image
/Build
/Profile
/GIGASX76X
=$(call Image
/Build
/$(1),$(1),GIGASX76X
)
286 Image
/BuildKernel
/Profile
/DGN3500
=$(call Image
/BuildKernel
/Template
,DGN3500
)
287 Image
/Build
/Profile
/DGN3500
=$(call Image
/Build
/$(1),$(1),DGN3500
)
289 Image
/BuildKernel
/Profile
/DGN3500B
=$(call Image
/BuildKernel
/Template
,DGN3500
)
290 Image
/Build
/Profile
/DGN3500B
=$(call Image
/Build
/$(1),$(1),DGN3500
)
292 Image
/BuildKernel
/Profile
/WBMRA
=$(call Image
/BuildKernel
/Template
,WBMR
)
293 Image
/Build
/Profile
/WBMRA
=$(call Image
/Build
/$(1),$(1),WBMR
)
295 Image
/BuildKernel
/Profile
/WBMRB
=$(call Image
/BuildKernel
/Template
,WBMR
)
296 Image
/Build
/Profile
/WBMRB
=$(call Image
/Build
/$(1),$(1),WBMR
)
298 Image
/BuildKernel
/Profile
/FRITZ7320
=$(call Image
/BuildKernelEVA
/Template
,FRITZ7320
)
299 Image
/Build
/Profile
/FRITZ7320
=$(call Image
/BuildEVA
/$(1),$(1),FRITZ7320
)
301 Image
/BuildKernel
/Profile
/GR7000
=$(call Image
/BuildKernel
/Template
,GR7000
)
302 Image
/Build
/Profile
/GR7000
=$(call Image
/Build
/$(1),$(1),GR7000
)
304 Image
/BuildKernel
/Profile
/H201L
=$(call Image
/BuildKernel
/Template
,H201L
)
305 Image
/Build
/Profile
/H201L
=$(call Image
/Build
/$(1),$(1),H201L
)
307 Image
/BuildKernel
/Profile
/P2601HNFX
=$(call Image
/BuildKernel
/Template
,P2601HNFX
)
308 Image
/Build
/Profile
/P2601HNFX
=$(call Image
/Build
/$(1),$(1),P2601HNFX
)
310 Image
/BuildKernel
/Profile
/ARV7519RWV11
=$(call Image
/BuildKernel
/Template
,ARV7519RWV11
,$(1))
311 Image
/Build
/Profile
/ARV7519RWV11
=$(call Image
/Build
/$(1), $(1),ARV7519RWV11
)
313 Image
/BuildKernel
/Profile
/ARV7519RWV12
=$(call Image
/BuildKernel
/Template
,ARV7519RWV12
,$(1))
314 Image
/Build
/Profile
/ARV7519RWV12
=$(call Image
/Build
/$(1), $(1),ARV7519RWV12
)
319 ifeq ($(CONFIG_TARGET_lantiq_xrx200
),y
)
322 Image
/BuildKernel
/Profile
/P2812HNUFX
=$(call Image
/BuildKernel
/Template
,P2812HNUFX
)
323 Image
/InstallKernel
/Template
/P2812HNUFX
=$(call Image
/InstallKernel
/Template
,P2812HNUFX
)
324 Image
/Build
/Profile
/P2812HNUFX
=$(call Image
/Build
/$(1),$(1),P2812HNUFX
)
326 Image
/BuildKernel
/Profile
/EASY80920NAND
=$(call Image
/BuildKernel
/Template
,EASY80920NAND
)
327 Image
/Build
/Profile
/EASY80920NAND
=$(call Image
/Build
/$(1),$(1),EASY80920NAND
)
329 Image
/BuildKernel
/Profile
/EASY80920NOR
=$(call Image
/BuildKernel
/Template
,EASY80920NOR
)
330 Image
/Build
/Profile
/EASY80920NOR
=$(call Image
/Build
/$(1),$(1),EASY80920NOR
)
332 Image
/BuildKernel
/Profile
/FRITZ3370
=$(call Image
/BuildKernelEVA
/Template
,FRITZ3370
)
333 Image
/Build
/Profile
/FRITZ3370
=$(call Image
/BuildEVA
/$(1),$(1),FRITZ3370
)
335 Image
/BuildKernel
/Profile
/VG3503J
=$(call Image
/BuildKernelLoader
/Template
,VG3503J
)
336 Image
/Build
/Profile
/VG3503J
=$(call Image
/BuildLoader
/$(1),$(1),VG3503J
)
338 Image
/BuildKernel
/Profile
/TDW8970
=$(call Image
/BuildKernelTPLink
/Template
,TDW8970
,TD-W8970v1
,$(1))
339 Image
/Build
/Profile
/TDW8970
=$(call Image
/BuildTPLink
/$(1),$(1),TDW8970
,TD-W8970v1
)
341 Image
/BuildKernel
/Profile
/VGV7519NOR
=$(call Image
/BuildKernel
/Template
,VGV7519NOR
,$(1))
342 Image
/Build
/Profile
/VGV7519NOR
=$(call Image
/Build
/$(1),$(1),VGV7519NOR
)
344 Image
/BuildKernel
/Profile
/VGV7519BRN
=$(call Image
/BuildKernel
/Template
,VGV7519BRN
,$(1))
345 Image
/Build
/Profile
/VGV7519BRN
=$(call Image
/Build
/$(1),$(1),VGV7519BRN
,5D00008000
,0x12345678,$(1))
350 ifeq ($(CONFIG_TARGET_lantiq_svip_be
),y
)
352 Image
/BuildKernel
/Profile
/EASY33016
=$(call Image
/BuildKernelGzip
/Template
,EASY33016
)
353 Image
/Build
/Profile
/EASY33016
=$(call Image
/Build
/$(1),$(1),EASY33016
)
358 define Image
/BuildKernel
359 $(call Image
/BuildKernel
/Profile
/$(PROFILE
))
362 define Image
/InstallKernel
363 $(call Image
/InstallKernel
/Template
/$(PROFILE
))
367 $(call Image
/Build
/Profile
/$(PROFILE
),$(1))
370 $(eval
$(call BuildImage
))