2 # Copyright (C) 2012-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
10 include $(TOPDIR
)/rules.mk
11 include $(INCLUDE_DIR
)/image.mk
15 define Image
/Build
/DTB
16 cp
$(KDIR
)/zImage
$(2) $(KDIR
)/zImage
$(2)-$(1);
17 cat
$(DTS_DIR
)/$(1).dtb
>> $(KDIR
)/zImage
$(2)-$(1);
18 $(call Image
/BuildKernel
/MkuImage
, \
19 none
, $(LOADADDR
), $(LOADADDR
), \
20 $(KDIR
)/zImage
$(2)-$(1), $(KDIR
)/uImage
$(2)-$(1))
25 # $(3): Erase Block Size
27 # $(5): Sub-Page Size (optional)
28 # $(6): VID offset (optional)
30 define Image
/BuildKernel
/Profile
/$(1)
31 $(call Image
/Build
/DTB
,$(2))
32 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
33 $(call Image
/Build
/Profile
,$(1)/Initramfs
)
37 define Image
/Build
/Profile
/$(1)/BuildSysupgrade
38 $(call Image
/Build
/SysupgradeNAND
,$(2),$$(1),$(KDIR
)/uImage-
$(2))
41 define Image
/Build
/Profile
/$(1)/Initramfs
42 $(call Image
/Build
/DTB
,$(2),-initramfs
)
43 cp
$(KDIR
)/uImage-initramfs-
$(2) $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-initramfs
46 define Image
/Build
/Profile
/$(1)/squashfs
47 $(call Image
/Build
/UbinizeImage
,$(2),,squashfs
, -p
$(3) -m
$(4) $(if
$(5),-s
$(5)) $(if
$(6),-O
$(6)))
55 # $(3): Erase Block Size
57 define Image
/BuildKernel
/Profile
/$(1)
58 $(call Image
/Build
/DTB
,$(2))
59 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
60 $(call Image
/Build
/Profile
,$(1)/Initramfs
)
64 define Image
/Build
/Profile
/$(1)/Initramfs
65 $(call Image
/Build
/DTB
,$(2),-initramfs
)
68 define Image
/Build
/Profile
/$(1)/squashfs
69 $(call Image
/Build
/UbinizeImage
,$(2),,squashfs
, -p
$(3) -m
1)
77 # $(3): Erase Block Size
79 define Image
/BuildKernel
/Profile
/$(1)
80 $(call Image
/Build
/DTB
,$(2))
81 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
82 $(call Image
/Build
/Profile
,$(1)/Initramfs
)
86 define Image
/Build
/Profile
/$(1)/Initramfs
87 $(call Image
/Build
/DTB
,$(2),-initramfs
)
90 define Image
/Build
/Profile
/$(1)/squashfs
92 dd if
=$(KDIR
)/uImage-
$(2) bs
=$(3) conv
=sync
; \
93 dd if
=$(KDIR
)/root.squashfs bs
=$(3) conv
=sync
; \
94 ) > $$(BIN_DIR
)/$$(IMG_PREFIX
)-$(2)-squashfs-firmware.bin
103 define Image
/BuildKernel
/Profile
/$(1)
104 $(call Image
/Build
/DTB
,$(2))
105 cp
$(KDIR
)/zImage-
$(2) $(BIN_DIR
)/zImage-
$(1);
106 cp
$(DTS_DIR
)/$(2).dtb
$(BIN_DIR
)/$(1).dtb
;
107 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
108 $(call Image
/Build
/Profile
,$(1)/Initramfs
)
112 define Image
/Build
/Profile
/$(1)/Initramfs
113 $(call Image
/Build
/DTB
,$(2),-initramfs
)
114 cp
$(KDIR
)/uImage-initramfs-
$(2) $(BIN_DIR
)/$(IMG_PREFIX
)-$(2)-initramfs
117 PROFILES_LIST
+= $(1)
121 # $(2): Sub Profiles list
123 define Image
/BuildKernel
/Profile
/$(1)
124 $(foreach profile
, $(2),
125 $(call Image
/BuildKernel
/Profile
/$(profile
)))
128 define Image
/Build
/Profile
/$(1)/BuildSysupgrade
129 $(foreach profile
, $(2),
130 $(call Image
/Build
/Profile
/$(profile
)/BuildSysupgrade
,$$(1)))
133 define Image
/Build
/Profile
/$(1)/Initramfs
134 $(foreach profile
, $(2),
135 $(call Image
/Build
/Profile
/$(profile
)/Initramfs
))
138 define Image
/Build
/Profile
/$(1)/squashfs
139 $(foreach profile
, $(2),
140 $(call Image
/Build
/Profile
/$(profile
)/squashfs
))
144 # Boards with NAND, without subpages
145 $(eval
$(call NANDProfile
,370-DB
,armada-370-db
,512KiB
,4096))
146 $(eval
$(call NANDProfile
,370-RD
,armada-370-rd
,512KiB
,4096))
147 $(eval
$(call NANDProfile
,385-DB-AP
,armada-385-db-ap
,256KiB
,4096))
148 $(eval
$(call NANDProfile
,Mirabox
,armada-370-mirabox
,512KiB
,4096))
149 $(eval
$(call NANDProfile
,XP-DB
,armada-xp-db
,512KiB
,4096))
150 $(eval
$(call NANDProfile
,XP-GP
,armada-xp-gp
,512KiB
,4096))
152 # Boards with NAND, with subpages
153 $(eval
$(call NANDProfile
,Mamba
,armada-xp-linksys-mamba
,128KiB
,2048,512,2048))
154 $(eval
$(call NANDProfile
,Caiman
,armada-385-linksys-caiman
,128KiB
,2048,512,2048))
155 $(eval
$(call NANDProfile
,Cobra
,armada-385-linksys-cobra
,128KiB
,2048,512,2048))
156 $(eval
$(call NANDProfile
,Shelby
,armada-385-linksys-shelby
,128KiB
,2048,512,2048))
158 # Boards with large NOR, where we want to use UBI
159 $(eval
$(call UBINORProfile
,OpenBlocks-AX-3-4
,armada-xp-openblocks-ax3-4
,128KiB
))
161 # Boards with small NOR, where UBI doesn't make sense
162 $(eval
$(call NORProfile
,388-RD
,armada-388-rd
,256KiB
))
164 $(eval
$(call MMCProfile
,Solidrun-Clearfog-A1
,armada-388-clearfog
))
170 # Caiman: Linksys WRT1200AC
171 define Image
/Build
/Profile
/Caiman
/squashfs
172 $(call Image
/Build
/UbinizeImage
,armada-385-linksys-caiman
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
174 dd if
=$(KDIR
)/uImage-armada-385-linksys-caiman bs
=6M conv
=sync
; \
175 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-385-linksys-caiman-squashfs-ubinized.bin \
177 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-385-linksys-caiman-squashfs-factory.img
180 # Cobra: Linksys WRT1900ACv2
181 define Image
/Build
/Profile
/Cobra
/squashfs
182 $(call Image
/Build
/UbinizeImage
,armada-385-linksys-cobra
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
184 dd if
=$(KDIR
)/uImage-armada-385-linksys-cobra bs
=6M conv
=sync
; \
185 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-385-linksys-cobra-squashfs-ubinized.bin \
187 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-385-linksys-cobra-squashfs-factory.img
190 # Mamba: Linksys WRT1900AC
191 define Image
/Build
/Profile
/Mamba
/squashfs
192 $(call Image
/Build
/UbinizeImage
,armada-xp-linksys-mamba
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
194 dd if
=$(KDIR
)/uImage-armada-xp-linksys-mamba bs
=3072k conv
=sync
; \
195 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-xp-linksys-mamba-squashfs-ubinized.bin \
197 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-xp-linksys-mamba-squashfs-factory.img
200 # Shelby: Linksys WRT1900ACS
201 define Image
/Build
/Profile
/Shelby
/squashfs
202 $(call Image
/Build
/UbinizeImage
,armada-385-linksys-shelby
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
204 dd if
=$(KDIR
)/uImage-armada-385-linksys-shelby bs
=6M conv
=sync
; \
205 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-385-linksys-shelby-squashfs-ubinized.bin \
207 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-385-linksys-shelby-squashfs-factory.img
214 # Marvell Armada 385 Access Point Development board (DB-88F6820-AP)
215 define Image
/Build
/Profile
/385-DB-AP
/squashfs
216 $(call Image
/Build
/UbinizeImage
,armada-385-db-ap
,,squashfs
, -p
256KiB
-m
4096)
218 dd if
=$(KDIR
)/uImage-armada-385-db-ap bs
=8M conv
=sync
; \
219 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-385-db-ap-squashfs-ubinized.bin \
221 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-385-db-ap-squashfs-factory.img
225 # The Default profile should build everything
226 $(eval
$(call MultiProfile
,Default
,$(PROFILES_LIST
)))
228 define Image
/BuildKernel
229 $(call Image
/BuildKernel
/Profile
/$(PROFILE
))
232 define Image
/Build
/squashfs
233 # Align the squashfs image size before calling the profiles,
234 # otherwise the size would keep growing
235 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
236 $(call Image
/Build
/Profile
/$(PROFILE
)/squashfs
)
240 $(call Image
/Build
/$(1))
241 $(call Image
/Build
/Profile
/$(PROFILE
)/BuildSysupgrade
,$(1))
242 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
243 $(call Image
/Build
/Profile
/$(PROFILE
)/Initramfs
)
247 $(eval
$(call BuildImage
))