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.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/image.mk
10 JFFS2_BLOCKSIZE
= 64k
128k
256k
12 ase_cmdline
=-console
=ttyLTQ0
,115200 rootfstype
=squashfs
,jffs2
13 xway_cmdline
=-console
=ttyLTQ1
,115200 rootfstype
=squashfs
,jffs2
14 falcon_cmdline
=-console
=ttyLTQ0
,115200 rootfstype
=squashfs
,jffs2
15 sx76x_cmdline
=console
=ttyLTQ1
,115200 rootfstype
=squashfs
,jffs2
18 $(STAGING_DIR_HOST
)/bin
/lzma e
$(1) $(2)
21 define PatchKernelLzma
22 cp
$(KDIR
)/vmlinux
$(KDIR
)/vmlinux-
$(1)
23 $(STAGING_DIR_HOST
)/bin
/patch-cmdline
$(KDIR
)/vmlinux-
$(1) '$(strip $(2))'
24 $(call CompressLzma
,$(KDIR
)/vmlinux-
$(1),$(KDIR
)/vmlinux-
$(1).lzma
)
28 mkbrncmdline
-i
$(KDIR
)/vmlinux-
$(4) -o
$(KDIR
)/vmlinux-
$(4)-brn BRN-BOOT
$(6)
29 $(call CompressLzma
,$(KDIR
)/vmlinux-
$(4)-brn
,$(KDIR
)/vmlinux-
$(4)-brn.lzma
)
30 mkbrnimg
-s
$(1) -m
$(2) -o
$(3) $(KDIR
)/vmlinux-
$(4)-brn.lzma
$(KDIR
)/root.
$(5)
34 mkimage
-A mips
-O linux
-T kernel
-a
0x80002000 -C lzma \
35 -e
0x80002000 -n
'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
36 -d
$(KDIR
)/vmlinux-
$(1).lzma
$(KDIR
)/uImage-
$(1)
40 lzma2eva
0x80002000 0x80002000 $(KDIR
)/vmlinux-
$(1).lzma
$(KDIR
)/$(1).eva.prealign
41 dd if
=$(KDIR
)/$(1).eva.prealign of
=$(KDIR
)/$(1).eva bs
=64k conv
=sync
42 cat .
/eva.dummy.squashfs
>> $(KDIR
)/$(1).eva
45 define Image
/Build
/squashfs
46 cat
$(KDIR
)/uImage-
$(2) $(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
47 $(call prepare_generic_squashfs
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
)
48 $(if
$(3),$(call MkBrnImage
,$(3),$(4),$(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(3)-brnImage
,$(2),$(1),$(5)))
51 define Image
/BuildEVA
/squashfs
52 cat
$(KDIR
)/$(2).eva
$(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image.eva
53 $(call prepare_generic_squashfs
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image.eva
)
56 define Image
/Build
/jffs2-64k
57 dd if
=$(KDIR
)/uImage-
$(2) of
=$(KDIR
)/uImage-
$(2)-$(1) bs
=64k conv
=sync
58 cat
$(KDIR
)/uImage-
$(2)-$(1) $(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
61 define Image
/Build
/jffs2-128k
62 dd if
=$(KDIR
)/uImage-
$(2) of
=$(KDIR
)/uImage-
$(2)-$(1) bs
=128k conv
=sync
63 cat
$(KDIR
)/uImage-
$(2)-$(1) $(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
66 define Image
/Build
/jffs2-256k
67 dd if
=$(KDIR
)/uImage-
$(2) of
=$(KDIR
)/uImage-
$(2)-$(1) bs
=256k conv
=sync
68 cat
$(KDIR
)/uImage-
$(2)-$(1) $(KDIR
)/root.
$(1) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-$(1).image
71 define Image
/BuildKernel
/Template
72 $(call PatchKernelLzma
,$(1),$(if
$(2),$(2) machtype
=$(1),))
73 $(call MkImageLzma
,$(1))
74 $(CP
) $(KDIR
)/uImage-
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-uImage
77 define Image
/BuildKernelEVA
/Template
78 $(call PatchKernelLzma
,$(1),$(if
$(2),$(2) machtype
=$(1),))
79 $(call MkImageEVA
,$(1))
80 $(CP
) $(KDIR
)/$(1).eva
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).eva
83 ifeq ($(CONFIG_TARGET_lantiq_danube
),y
)
85 Image
/BuildKernel
/Profile
/EASY50712
=$(call Image
/BuildKernel
/Template
,EASY50712
,$(xway_cmdline
))
86 Image
/BuildKernel
/Profile
/ARV3527P
=$(call Image
/BuildKernel
/Template
,ARV3527P
,$(xway_cmdline
))
87 Image
/BuildKernel
/Profile
/ARV4510PW
=$(call Image
/BuildKernel
/Template
,ARV4510PW
,$(xway_cmdline
))
88 Image
/BuildKernel
/Profile
/ARV4518PW
=$(call Image
/BuildKernel
/Template
,ARV4518PW
,$(xway_cmdline
))
89 Image
/BuildKernel
/Profile
/ARV4519PW
=$(call Image
/BuildKernel
/Template
,ARV4519PW
,$(xway_cmdline
))
90 Image
/BuildKernel
/Profile
/ARV4520PW
=$(call Image
/BuildKernel
/Template
,ARV4520PW
,$(xway_cmdline
))
91 Image
/BuildKernel
/Profile
/ARV4525PW
=$(call Image
/BuildKernel
/Template
,ARV4525PW
,$(xway_cmdline
))
92 Image
/BuildKernel
/Profile
/ARV7525PW
=$(call Image
/BuildKernel
/Template
,ARV7525PW
,$(xway_cmdline
))
93 Image
/BuildKernel
/Profile
/ARV452CPW
=$(call Image
/BuildKernel
/Template
,ARV452CPW
,$(xway_cmdline
))
94 Image
/BuildKernel
/Profile
/ARV7518PW
=$(call Image
/BuildKernel
/Template
,ARV7518PW
,$(xway_cmdline
))
95 Image
/BuildKernel
/Profile
/ARV752DPW
=$(call Image
/BuildKernel
/Template
,ARV752DPW
,$(xway_cmdline
))
96 Image
/BuildKernel
/Profile
/ARV752DPW22
=$(call Image
/BuildKernel
/Template
,ARV752DPW22
,$(xway_cmdline
))
97 Image
/BuildKernel
/Profile
/GIGASX76X
=$(call Image
/BuildKernel
/Template
,GIGASX76X
,$(sx76x_cmdline
))
98 Image
/BuildKernel
/Profile
/BTHOMEHUBV2B
=$(call Image
/BuildKernel
/Template
,BTHOMEHUBV2B
,$(xway_cmdline
))
99 Image
/BuildKernel
/Profile
/BTHOMEHUBV2BOPENRG
=$(call Image
/BuildKernel
/Template
,BTHOMEHUBV2BOPENRG
,$(xway_cmdline
))
101 Image
/Build
/Profile
/EASY50712
=$(call Image
/Build
/$(1),$(1),EASY50712
)
102 Image
/Build
/Profile
/ARV3527P
=$(call Image
/Build
/$(1),$(1),ARV3527P
)
103 Image
/Build
/Profile
/ARV4510PW
=$(call Image
/Build
/$(1),$(1),ARV4510PW
)
104 Image
/Build
/Profile
/ARV4518PW
=$(call Image
/Build
/$(1),$(1),ARV4518PW
)
105 Image
/Build
/Profile
/ARV4519PW
=$(call Image
/Build
/$(1),$(1),ARV4519PW
,BRNDA4519
,0x12345678,memsize
=32)
106 Image
/Build
/Profile
/ARV4520PW
=$(call Image
/Build
/$(1),$(1),ARV4520PW
,BRNDANUBE
,0x12345678,memsize
=32)
107 Image
/Build
/Profile
/ARV4525PW
=$(call Image
/Build
/$(1),$(1),ARV4525PW
,BRNDTW502
,0x12345678,memsize
=32)
108 Image
/Build
/Profile
/ARV7525PW
=$(call Image
/Build
/$(1),$(1),ARV7525PW
)
109 Image
/Build
/Profile
/ARV452CPW
=$(call Image
/Build
/$(1),$(1),ARV452CPW
)
110 Image
/Build
/Profile
/ARV7518PW
=$(call Image
/Build
/$(1),$(1),ARV7518PW
,BRNDA7519
,0x12345678,memsize
=64)
111 Image
/Build
/Profile
/ARV752DPW
=$(call Image
/Build
/$(1),$(1),ARV752DPW
)
112 Image
/Build
/Profile
/ARV752DPW22
=$(call Image
/Build
/$(1),$(1),ARV752DPW22
)
113 Image
/Build
/Profile
/GIGASX76X
=$(call Image
/Build
/$(1),$(1),GIGASX76X
)
114 Image
/Build
/Profile
/BTHOMEHUBV2B
=$(call Image
/Build
/$(1),$(1),BTHOMEHUBV2B
)
115 Image
/Build
/Profile
/BTHOMEHUBV2BOPENRG
=$(call Image
/Build
/$(1),$(1),BTHOMEHUBV2BOPENRG
)
117 define Image
/BuildKernel
/Profile
/Generic
118 $(call Image
/BuildKernel
/Template
,NONE
)
121 define Image
/Build
/Profile
/Generic
122 $(call Image
/Build
/$(1),$(1),NONE
)
123 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).rootfs
127 ifeq ($(CONFIG_TARGET_lantiq_ar9
),y
)
128 Image
/BuildKernel
/Profile
/WBMR
=$(call Image
/BuildKernel
/Template
,WBMR
,$(xway_cmdline
))
129 Image
/BuildKernel
/Profile
/DGN3500B
=$(call Image
/BuildKernel
/Template
,DGN3500B
,$(xway_cmdline
))
130 Image
/BuildKernel
/Profile
/P2601HNFX
=$(call Image
/BuildKernel
/Template
,P2601HNFX
,$(xway_cmdline
))
131 Image
/BuildKernel
/Profile
/H201L
=$(call Image
/BuildKernel
/Template
,H201L
,$(xway_cmdline
))
132 Image
/BuildKernel
/Profile
/FRITZ7320
=$(call Image
/BuildKernelEVA
/Template
,FRITZ7320
,$(xway_cmdline
))
134 Image
/Build
/Profile
/WBMR
=$(call Image
/Build
/$(1),$(1),WBMR
)
135 Image
/Build
/Profile
/DGN3500B
=$(call Image
/Build
/$(1),$(1),DGN3500B
)
136 Image
/Build
/Profile
/P2601HNFX
=$(call Image
/Build
/$(1),$(1),P2601HNFX
)
137 Image
/Build
/Profile
/H201L
=$(call Image
/Build
/$(1),$(1),H201L
)
138 Image
/Build
/Profile
/FRITZ7320
=$(call Image
/BuildEVA
/$(1),$(1),FRITZ7320
)
140 define Image
/BuildKernel
/Profile
/Generic
141 $(call Image
/BuildKernel
/Template
,NONE
)
144 define Image
/Build
/Profile
/Generic
145 $(call Image
/Build
/$(1),$(1),NONE
)
146 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).rootfs
150 ifeq ($(CONFIG_TARGET_lantiq_falcon
)$(CONFIG_TARGET_lantiq_falcon_stable
),y
)
152 Image
/BuildKernel
/Profile
/EASY98000
=$(call Image
/BuildKernel
/Template
,EASY98000
,$(falcon_cmdline
))
153 Image
/BuildKernel
/Profile
/EASY98020
=$(call Image
/BuildKernel
/Template
,EASY98020
,$(falcon_cmdline
))
155 Image
/Build
/Profile
/EASY98000
=$(call Image
/Build
/$(1),$(1),EASY98000
)
156 Image
/Build
/Profile
/EASY98020
=$(call Image
/Build
/$(1),$(1),EASY98020
)
158 define Image
/BuildKernel
/Profile
/Generic
159 $(call Image
/BuildKernel
/Template
,NONE
)
162 define Image
/Build
/Profile
/Generic
163 $(call Image
/Build
/$(1),$(1),NONE
)
164 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).rootfs
168 ifeq ($(CONFIG_TARGET_lantiq_ase
),y
)
170 Image
/BuildKernel
/Profile
/EASY50601
=$(call Image
/BuildKernel
/Template
,EASY50601
,$(ase_cmdline
))
171 Image
/Build
/Profile
/EASY50601
=$(call Image
/Build
/$(1),$(1),EASY50601
)
173 define Image
/BuildKernel
/Profile
/Generic
174 $(call Image
/BuildKernel
/Template
,NONE
)
177 define Image
/Build
/Profile
/Generic
178 $(call Image
/Build
/$(1),$(1),NONE
)
179 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).rootfs
183 ifeq ($(CONFIG_TARGET_lantiq_vr9
),y
)
184 define Image
/BuildKernel
/Profile
/FRITZ3370
185 $(call Image
/BuildKernel
/Template
,FRITZ3370
,$(xway_cmdline
))
186 $(call Image
/BuildKernelEVA
/Template
,FRITZ3370
,$(xway_cmdline
))
189 Image
/Build
/Profile
/FRITZ3370
=$(call Image
/Build
/$(1),$(1),FRITZ3370
)
191 define Image
/BuildKernel
/Profile
/Generic
192 $(call Image
/BuildKernel
/Template
,NONE
)
195 define Image
/Build
/Profile
/Generic
196 $(call Image
/Build
/$(1),$(1),NONE
)
197 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).rootfs
201 define Image
/BuildKernel
202 $(call Image
/BuildKernel
/Profile
/$(PROFILE
))
206 $(call Image
/Build
/Profile
/$(PROFILE
),$(1))
209 $(eval
$(call BuildImage
))