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
101 # $(2): Sub Profiles list
103 define Image
/BuildKernel
/Profile
/$(1)
104 $(foreach profile
, $(2),
105 $(call Image
/BuildKernel
/Profile
/$(profile
)))
108 define Image
/Build
/Profile
/$(1)/BuildSysupgrade
109 $(foreach profile
, $(2),
110 $(call Image
/Build
/Profile
/$(profile
)/BuildSysupgrade
,$$(1)))
113 define Image
/Build
/Profile
/$(1)/Initramfs
114 $(foreach profile
, $(2),
115 $(call Image
/Build
/Profile
/$(profile
)/Initramfs
))
118 define Image
/Build
/Profile
/$(1)/squashfs
119 $(foreach profile
, $(2),
120 $(call Image
/Build
/Profile
/$(profile
)/squashfs
))
124 # Boards with NAND, without subpages
125 $(eval
$(call NANDProfile
,370-DB
,armada-370-db
,512KiB
,4096))
126 $(eval
$(call NANDProfile
,370-RD
,armada-370-rd
,512KiB
,4096))
127 $(eval
$(call NANDProfile
,385-DB-AP
,armada-385-db-ap
,256KiB
,4096))
128 $(eval
$(call NANDProfile
,Mirabox
,armada-370-mirabox
,512KiB
,4096))
129 $(eval
$(call NANDProfile
,XP-DB
,armada-xp-db
,512KiB
,4096))
130 $(eval
$(call NANDProfile
,XP-GP
,armada-xp-gp
,512KiB
,4096))
132 # Boards with NAND, with subpages
133 $(eval
$(call NANDProfile
,Mamba
,armada-xp-linksys-mamba
,128KiB
,2048,512,2048))
134 $(eval
$(call NANDProfile
,Caiman
,armada-385-linksys-caiman
,128KiB
,2048,512,2048))
135 $(eval
$(call NANDProfile
,Cobra
,armada-385-linksys-cobra
,128KiB
,2048,512,2048))
136 $(eval
$(call NANDProfile
,Shelby
,armada-385-linksys-shelby
,128KiB
,2048,512,2048))
138 # Boards with large NOR, where we want to use UBI
139 $(eval
$(call UBINORProfile
,OpenBlocks-AX-3-4
,armada-xp-openblocks-ax3-4
,128KiB
))
141 # Boards with small NOR, where UBI doesn't make sense
142 $(eval
$(call NORProfile
,388-RD
,armada-388-rd
,256KiB
))
148 # Caiman: Linksys WRT1200AC
149 define Image
/Build
/Profile
/Caiman
/squashfs
150 $(call Image
/Build
/UbinizeImage
,armada-385-linksys-caiman
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
152 dd if
=$(KDIR
)/uImage-armada-385-linksys-caiman bs
=6M conv
=sync
; \
153 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-385-linksys-caiman-squashfs-ubinized.bin \
155 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-385-linksys-caiman-squashfs-factory.img
158 # Cobra: Linksys WRT1900ACv2
159 define Image
/Build
/Profile
/Cobra
/squashfs
160 $(call Image
/Build
/UbinizeImage
,armada-385-linksys-cobra
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
162 dd if
=$(KDIR
)/uImage-armada-385-linksys-cobra bs
=6M conv
=sync
; \
163 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-385-linksys-cobra-squashfs-ubinized.bin \
165 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-385-linksys-cobra-squashfs-factory.img
168 # Mamba: Linksys WRT1900AC
169 define Image
/Build
/Profile
/Mamba
/squashfs
170 $(call Image
/Build
/UbinizeImage
,armada-xp-linksys-mamba
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
172 dd if
=$(KDIR
)/uImage-armada-xp-linksys-mamba bs
=3072k conv
=sync
; \
173 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-xp-linksys-mamba-squashfs-ubinized.bin \
175 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-xp-linksys-mamba-squashfs-factory.img
178 # Shelby: Linksys WRT1900ACS
179 define Image
/Build
/Profile
/Shelby
/squashfs
180 $(call Image
/Build
/UbinizeImage
,armada-385-linksys-shelby
,,squashfs
, -p
128KiB
-m
2048 -s
512 -O
2048)
182 dd if
=$(KDIR
)/uImage-armada-385-linksys-shelby bs
=6M conv
=sync
; \
183 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-385-linksys-shelby-squashfs-ubinized.bin \
185 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-385-linksys-shelby-squashfs-factory.img
192 # Marvell Armada 385 Access Point Development board (DB-88F6820-AP)
193 define Image
/Build
/Profile
/385-DB-AP
/squashfs
194 $(call Image
/Build
/UbinizeImage
,armada-385-db-ap
,,squashfs
, -p
256KiB
-m
4096)
196 dd if
=$(KDIR
)/uImage-armada-385-db-ap bs
=8M conv
=sync
; \
197 dd if
=$(KDIR
)/$(IMG_PREFIX
)-armada-385-db-ap-squashfs-ubinized.bin \
199 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-armada-385-db-ap-squashfs-factory.img
203 # The Default profile should build everything
204 $(eval
$(call MultiProfile
,Default
,$(PROFILES_LIST
)))
206 define Image
/BuildKernel
207 $(call Image
/BuildKernel
/Profile
/$(PROFILE
))
210 define Image
/Build
/squashfs
211 # Align the squashfs image size before calling the profiles,
212 # otherwise the size would keep growing
213 $(call prepare_generic_squashfs
,$(KDIR
)/root.squashfs
)
214 $(call Image
/Build
/Profile
/$(PROFILE
)/squashfs
)
218 $(call Image
/Build
/$(1))
219 $(call Image
/Build
/Profile
/$(PROFILE
)/BuildSysupgrade
,$(1))
220 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
221 $(call Image
/Build
/Profile
/$(PROFILE
)/Initramfs
)
225 $(eval
$(call BuildImage
))