mvebu: make sdcard bootloader option configurable
[openwrt/staging/wigyori.git] / target / linux / mvebu / image / Makefile
1 #
2 # Copyright (C) 2012-2016 OpenWrt.org
3 # Copyright (C) 2016 LEDE-project.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 JFFS2_BLOCKSIZE = 128k
10
11 include $(TOPDIR)/rules.mk
12 include $(INCLUDE_DIR)/image.mk
13
14 KERNEL_LOADADDR := 0x00008000
15
16 SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
17
18 define Build/dtb
19 $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$@.dtb)
20 endef
21
22 # SD-Card Images:
23 # these values are optimized for a 4GB labeled sdcard that actually holds 7744512 sectors of 512 byte
24 # MBR: 2048 sectors
25 # Partition 1: 32768 sectors
26 # Partition 2: 98304 sectors (configurable)
27
28 define Build/boot-scr-cfpro
29 rm -f $@.bootscript
30 mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d cfpro-boot.script $@.bootscript
31 endef
32
33 define Build/boot-scr-cfbase
34 rm -f $@.bootscript
35 mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d cfbase-boot.script $@.bootscript
36 endef
37
38 define Build/boot-img
39 rm -f $@.boot
40 mkfs.fat -C $@.boot 16384
41 $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::$(dts).dtb;)
42 mcopy -i $@.boot $(IMAGE_KERNEL) ::zImage
43 mcopy -i $@.boot $@.bootscript ::boot.scr
44 endef
45
46 define Build/sdcard-img
47 if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
48 ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
49 SIGNATURE="$(SIGNATURE)" \
50 ./gen_mvebu_sdcard_img.sh $@ \
51 $$UBOOT \
52 c 32768 $@.boot \
53 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
54 endef
55
56 define Device/Default
57 PROFILES := Default
58 DEVICE_DTS := $(1)
59 BOARD_NAME = $$(DEVICE_DTS)
60 KERNEL_NAME := zImage
61 KERNEL := kernel-bin | append-dtb | uImage none
62 SUPPORTED_DEVICES = $$(DEVICE_DTS)
63 endef
64
65 define Device/UBI
66 IMAGES := sysupgrade.bin
67 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
68 endef
69
70 define Device/UBI-factory
71 $(Device/UBI)
72 UBINIZE_OPTS := -E 5
73 IMAGES += factory.img
74 IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
75 endef
76
77 define Device/NAND-128K
78 $(Device/UBI)
79 BLOCKSIZE := 128k
80 PAGESIZE := 2048
81 SUBPAGESIZE := 512
82 VID_HDR_OFFSET := 2048
83 endef
84
85 define Device/NAND-256K
86 $(Device/UBI)
87 BLOCKSIZE := 256k
88 PAGESIZE := 4096
89 endef
90
91 define Device/NAND-512K
92 $(Device/UBI)
93 BLOCKSIZE := 512k
94 PAGESIZE := 4096
95 endef
96
97 define Device/linksys
98 DEVICE_TITLE := Linksys $(1)
99 DEVICE_PACKAGES := kmod-mwlwifi wpad-mini swconfig
100 endef
101
102 define Device/armada-385-linksys
103 $(Device/NAND-128K)
104 $(Device/UBI-factory)
105 KERNEL_SIZE := 6144k
106 endef
107
108 define Device/linksys-wrt1200ac
109 $(call Device/linksys,WRT1200AC (Caiman))
110 $(Device/armada-385-linksys)
111 DEVICE_DTS := armada-385-linksys-caiman
112 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
113 endef
114 TARGET_DEVICES += linksys-wrt1200ac
115
116 define Device/linksys-wrt1900acv2
117 $(call Device/linksys,WRT1900ACv2 (Cobra))
118 $(Device/armada-385-linksys)
119 DEVICE_DTS := armada-385-linksys-cobra
120 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
121 endef
122 TARGET_DEVICES += linksys-wrt1900acv2
123
124 define Device/linksys-wrt3200acm
125 $(call Device/linksys,WRT3200ACM (Rango))
126 $(Device/armada-385-linksys)
127 DEVICE_DTS := armada-385-linksys-rango
128 DEVICE_PACKAGES += kmod-btmrvl kmod-mwifiex-sdio mwlwifi-firmware-88w8964
129 endef
130 TARGET_DEVICES += linksys-wrt3200acm
131
132 define Device/linksys-wrt1900acs
133 $(call Device/linksys,WRT1900ACS (Shelby))
134 $(Device/armada-385-linksys)
135 DEVICE_DTS := armada-385-linksys-shelby
136 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
137 endef
138 TARGET_DEVICES += linksys-wrt1900acs
139
140 define Device/linksys-wrt1900ac
141 $(call Device/linksys,WRT1900AC (Mamba))
142 DEVICE_DTS := armada-xp-linksys-mamba
143 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
144 $(Device/NAND-128K)
145 $(Device/UBI-factory)
146 KERNEL_SIZE := 3072k
147 endef
148 TARGET_DEVICES += linksys-wrt1900ac
149
150 define Device/openblocks-ax3-4
151 $(Device/UBI-factory)
152 DEVICE_DTS := armada-xp-openblocks-ax3-4
153 SUPPORTED_DEVICES := $(1)
154 BLOCKSIZE := 128k
155 PAGESIZE := 1
156 IMAGE/factory.img := append-kernel | pad-to $$(BLOCKSIZE) | append-ubi
157 DEVICE_TITLE := Plat'Home OpenBlocks AX3
158 endef
159 TARGET_DEVICES += openblocks-ax3-4
160
161 define Device/armada-385-db-ap
162 $(Device/NAND-256K)
163 $(Device/UBI-factory)
164 KERNEL_SIZE := 8192k
165 DEVICE_TITLE := Marvell Armada 385 DB AP (DB-88F6820-AP)
166 endef
167 TARGET_DEVICES += armada-385-db-ap
168
169 define Device/marvell-nand
170 $(Device/NAND-512K)
171 DEVICE_TITLE := Marvell Armada $(1)
172 endef
173
174 define Device/armada-370-db
175 $(call Device/marvell-nand,370 DB (DB-88F6710-BP-DDR3))
176 endef
177 TARGET_DEVICES += armada-370-db
178
179 define Device/armada-370-rd
180 $(call Device/marvell-nand,370 RD (RD-88F6710-A1))
181 endef
182 TARGET_DEVICES += armada-370-rd
183
184 define Device/armada-xp-db
185 $(call Device/marvell-nand,XP DB (DB-78460-BP))
186 endef
187 TARGET_DEVICES += armada-xp-db
188
189 define Device/armada-xp-gp
190 $(call Device/marvell-nand,XP GP (DB-MV784MP-GP))
191 endef
192 TARGET_DEVICES += armada-xp-gp
193
194 define Device/armada-388-rd
195 DEVICE_TITLE := Marvell Armada 388 RD (RD-88F6820-AP)
196 IMAGES := firmware.bin
197 IMAGE/firmware.bin := append-kernel | pad-to 256k | append-rootfs | pad-rootfs
198 endef
199 TARGET_DEVICES += armada-388-rd
200
201 define Device/armada-388-clearfog-pro
202 KERNEL_INSTALL := 1
203 KERNEL := kernel-bin
204 DEVICE_TITLE := SolidRun ClearFog Pro
205 DEVICE_PACKAGES := mkf2fs e2fsprogs swconfig kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
206 IMAGES := sdcard.img.gz
207 IMAGE/sdcard.img.gz := boot-scr-cfpro | boot-img | sdcard-img | gzip | append-metadata
208 DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
209 SUPPORTED_DEVICES := armada-388-clearfog-pro armada-388-clearfog
210 UBOOT := clearfog-u-boot-spl.kwb
211 endef
212 TARGET_DEVICES += armada-388-clearfog-pro
213
214 define Device/armada-388-clearfog-base
215 KERNEL_INSTALL := 1
216 KERNEL := kernel-bin
217 DEVICE_TITLE := SolidRun ClearFog Base
218 DEVICE_PACKAGES := mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
219 IMAGES := sdcard.img.gz
220 IMAGE/sdcard.img.gz := boot-scr-cfbase | boot-img | sdcard-img | gzip | append-metadata
221 DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
222 UBOOT := clearfog-u-boot-spl.kwb
223 endef
224 TARGET_DEVICES += armada-388-clearfog-base
225
226 define Device/globalscale-mirabox
227 $(Device/NAND-512K)
228 DEVICE_DTS := armada-370-mirabox
229 SUPPORTED_DEVICES := mirabox
230 DEVICE_TITLE := Globalscale Mirabox
231 endef
232 TARGET_DEVICES += globalscale-mirabox
233
234 $(eval $(call BuildImage))