mvebu: armada-385-rd has been renamed to armada-388-rd upstream
[openwrt/staging/mkresin.git] / target / linux / mvebu / image / Makefile
1 #
2 # Copyright (C) 2012-2015 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 JFFS2_BLOCKSIZE = 128k
9
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/image.mk
12
13 LOADADDR:=0x00008000
14
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))
21 endef
22
23 # $(1): Profile Name
24 # $(2): DTB Name
25 # $(3): Erase Block Size
26 # $(4): Page Size
27 # $(5): Sub-Page Size (optional)
28 # $(6): VID offset (optional)
29 define NANDProfile
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)
34 endif
35 endef
36
37 define Image/Build/Profile/$(1)/BuildSysupgrade
38 $(call Image/Build/SysupgradeNAND,$(2),$$(1),$(KDIR)/uImage-$(2))
39 endef
40
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
44 endef
45
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)))
48 endef
49
50 PROFILES_LIST += $(1)
51 endef
52
53 # $(1): Profile Name
54 # $(2): DTB Name
55 # $(3): Erase Block Size
56 define UBINORProfile
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)
61 endif
62 endef
63
64 define Image/Build/Profile/$(1)/Initramfs
65 $(call Image/Build/DTB,$(2),-initramfs)
66 endef
67
68 define Image/Build/Profile/$(1)/squashfs
69 $(call Image/Build/UbinizeImage,$(2),,squashfs, -p $(3) -m 1)
70 endef
71
72 PROFILES_LIST += $(1)
73 endef
74
75 # $(1): Profile Name
76 # $(2): DTB Name
77 # $(3): Erase Block Size
78 define NORProfile
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)
83 endif
84 endef
85
86 define Image/Build/Profile/$(1)/Initramfs
87 $(call Image/Build/DTB,$(2),-initramfs)
88 endef
89
90 define Image/Build/Profile/$(1)/squashfs
91 ( \
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
95 endef
96
97 PROFILES_LIST += $(1)
98 endef
99
100 # $(1): Profile Name
101 # $(2): Sub Profiles list
102 define MultiProfile
103 define Image/BuildKernel/Profile/$(1)
104 $(foreach profile, $(2),
105 $(call Image/BuildKernel/Profile/$(profile)))
106 endef
107
108 define Image/Build/Profile/$(1)/BuildSysupgrade
109 $(foreach profile, $(2),
110 $(call Image/Build/Profile/$(profile)/BuildSysupgrade,$$(1)))
111 endef
112
113 define Image/Build/Profile/$(1)/Initramfs
114 $(foreach profile, $(2),
115 $(call Image/Build/Profile/$(profile)/Initramfs))
116 endef
117
118 define Image/Build/Profile/$(1)/squashfs
119 $(foreach profile, $(2),
120 $(call Image/Build/Profile/$(profile)/squashfs))
121 endef
122 endef
123
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))
131
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))
137
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))
140
141 # Boards with small NOR, where UBI doesn't make sense
142 $(eval $(call NORProfile,388-RD,armada-388-rd,256KiB))
143
144 ###
145 ### Linksys
146 ###
147
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)
151 ( \
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 \
154 bs=2048 conv=sync; \
155 ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-385-linksys-caiman-squashfs-factory.img
156 endef
157
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)
161 ( \
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 \
164 bs=2048 conv=sync; \
165 ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-385-linksys-cobra-squashfs-factory.img
166 endef
167
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)
171 ( \
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 \
174 bs=2048 conv=sync; \
175 ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-xp-linksys-mamba-squashfs-factory.img
176 endef
177
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)
181 ( \
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 \
184 bs=2048 conv=sync; \
185 ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-385-linksys-shelby-squashfs-factory.img
186 endef
187
188 ###
189 ### Marvell
190 ###
191
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)
195 ( \
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 \
198 bs=4096 conv=sync; \
199 ) > $(BIN_DIR)/$(IMG_PREFIX)-armada-385-db-ap-squashfs-factory.img
200 endef
201
202
203 # The Default profile should build everything
204 $(eval $(call MultiProfile,Default,$(PROFILES_LIST)))
205
206 define Image/BuildKernel
207 $(call Image/BuildKernel/Profile/$(PROFILE))
208 endef
209
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)
215 endef
216
217 define Image/Build
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)
222 endif
223 endef
224
225 $(eval $(call BuildImage))