mvebu: fix partition type and signature for sdcard
[openwrt/openwrt.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 ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
48 SIGNATURE="$(SIGNATURE)" \
49 ./gen_mvebu_sdcard_img.sh $@ \
50 "$(STAGING_DIR_IMAGE)/clearfog-u-boot-spl.kwb" \
51 c 32768 $@.boot \
52 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
53 endef
54
55 define Device/Default
56 PROFILES := Default
57 DEVICE_DTS := $(1)
58 BOARD_NAME = $$(DEVICE_DTS)
59 KERNEL_NAME := zImage
60 KERNEL := kernel-bin | append-dtb | uImage none
61 SUPPORTED_DEVICES = $$(DEVICE_DTS)
62 endef
63
64 define Device/UBI
65 IMAGES := sysupgrade.bin
66 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
67 endef
68
69 define Device/UBI-factory
70 $(Device/UBI)
71 UBINIZE_OPTS := -E 5
72 IMAGES += factory.img
73 IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
74 endef
75
76 define Device/NAND-128K
77 $(Device/UBI)
78 BLOCKSIZE := 128k
79 PAGESIZE := 2048
80 SUBPAGESIZE := 512
81 VID_HDR_OFFSET := 2048
82 endef
83
84 define Device/NAND-256K
85 $(Device/UBI)
86 BLOCKSIZE := 256k
87 PAGESIZE := 4096
88 endef
89
90 define Device/NAND-512K
91 $(Device/UBI)
92 BLOCKSIZE := 512k
93 PAGESIZE := 4096
94 endef
95
96 define Device/linksys
97 DEVICE_TITLE := Linksys $(1)
98 DEVICE_PACKAGES := kmod-mwlwifi wpad-mini swconfig
99 endef
100
101 define Device/armada-385-linksys
102 $(Device/NAND-128K)
103 $(Device/UBI-factory)
104 KERNEL_SIZE := 6144k
105 endef
106
107 define Device/linksys-wrt1200ac
108 $(call Device/linksys,WRT1200AC (Caiman))
109 $(Device/armada-385-linksys)
110 DEVICE_DTS := armada-385-linksys-caiman
111 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
112 endef
113 TARGET_DEVICES += linksys-wrt1200ac
114
115 define Device/linksys-wrt1900acv2
116 $(call Device/linksys,WRT1900ACv2 (Cobra))
117 $(Device/armada-385-linksys)
118 DEVICE_DTS := armada-385-linksys-cobra
119 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
120 endef
121 TARGET_DEVICES += linksys-wrt1900acv2
122
123 define Device/linksys-wrt3200acm
124 $(call Device/linksys,WRT3200ACM (Rango))
125 $(Device/armada-385-linksys)
126 DEVICE_DTS := armada-385-linksys-rango
127 DEVICE_PACKAGES += kmod-btmrvl kmod-mwifiex-sdio mwlwifi-firmware-88w8964
128 endef
129 TARGET_DEVICES += linksys-wrt3200acm
130
131 define Device/linksys-wrt1900acs
132 $(call Device/linksys,WRT1900ACS (Shelby))
133 $(Device/armada-385-linksys)
134 DEVICE_DTS := armada-385-linksys-shelby
135 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
136 endef
137 TARGET_DEVICES += linksys-wrt1900acs
138
139 define Device/linksys-wrt1900ac
140 $(call Device/linksys,WRT1900AC (Mamba))
141 DEVICE_DTS := armada-xp-linksys-mamba
142 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
143 $(Device/NAND-128K)
144 $(Device/UBI-factory)
145 KERNEL_SIZE := 3072k
146 endef
147 TARGET_DEVICES += linksys-wrt1900ac
148
149 define Device/openblocks-ax3-4
150 $(Device/UBI-factory)
151 DEVICE_DTS := armada-xp-openblocks-ax3-4
152 SUPPORTED_DEVICES := $(1)
153 BLOCKSIZE := 128k
154 PAGESIZE := 1
155 IMAGE/factory.img := append-kernel | pad-to $$(BLOCKSIZE) | append-ubi
156 DEVICE_TITLE := Plat'Home OpenBlocks AX3
157 endef
158 TARGET_DEVICES += openblocks-ax3-4
159
160 define Device/armada-385-db-ap
161 $(Device/NAND-256K)
162 $(Device/UBI-factory)
163 KERNEL_SIZE := 8192k
164 DEVICE_TITLE := Marvell Armada 385 DB AP (DB-88F6820-AP)
165 endef
166 TARGET_DEVICES += armada-385-db-ap
167
168 define Device/marvell-nand
169 $(Device/NAND-512K)
170 DEVICE_TITLE := Marvell Armada $(1)
171 endef
172
173 define Device/armada-370-db
174 $(call Device/marvell-nand,370 DB (DB-88F6710-BP-DDR3))
175 endef
176 TARGET_DEVICES += armada-370-db
177
178 define Device/armada-370-rd
179 $(call Device/marvell-nand,370 RD (RD-88F6710-A1))
180 endef
181 TARGET_DEVICES += armada-370-rd
182
183 define Device/armada-xp-db
184 $(call Device/marvell-nand,XP DB (DB-78460-BP))
185 endef
186 TARGET_DEVICES += armada-xp-db
187
188 define Device/armada-xp-gp
189 $(call Device/marvell-nand,XP GP (DB-MV784MP-GP))
190 endef
191 TARGET_DEVICES += armada-xp-gp
192
193 define Device/armada-388-rd
194 DEVICE_TITLE := Marvell Armada 388 RD (RD-88F6820-AP)
195 IMAGES := firmware.bin
196 IMAGE/firmware.bin := append-kernel | pad-to 256k | append-rootfs | pad-rootfs
197 endef
198 TARGET_DEVICES += armada-388-rd
199
200 define Device/armada-388-clearfog-pro
201 KERNEL_INSTALL := 1
202 KERNEL := kernel-bin
203 DEVICE_TITLE := SolidRun ClearFog Pro
204 DEVICE_PACKAGES := mkf2fs e2fsprogs swconfig kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
205 IMAGES := sdcard.img.gz
206 IMAGE/sdcard.img.gz := boot-scr-cfpro | boot-img | sdcard-img | gzip | append-metadata
207 DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
208 SUPPORTED_DEVICES := armada-388-clearfog-pro armada-388-clearfog
209 endef
210 TARGET_DEVICES += armada-388-clearfog-pro
211
212 define Device/armada-388-clearfog-base
213 KERNEL_INSTALL := 1
214 KERNEL := kernel-bin
215 DEVICE_TITLE := SolidRun ClearFog Base
216 DEVICE_PACKAGES := mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
217 IMAGES := sdcard.img.gz
218 IMAGE/sdcard.img.gz := boot-scr-cfbase | boot-img | sdcard-img | gzip | append-metadata
219 DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
220 endef
221 TARGET_DEVICES += armada-388-clearfog-base
222
223 define Device/globalscale-mirabox
224 $(Device/NAND-512K)
225 DEVICE_DTS := armada-370-mirabox
226 SUPPORTED_DEVICES := mirabox
227 DEVICE_TITLE := Globalscale Mirabox
228 endef
229 TARGET_DEVICES += globalscale-mirabox
230
231 $(eval $(call BuildImage))