mvebu: add support for Turris Omnia
[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
29 rm -f $@-boot.scr
30 mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $(DEVICE_NAME).bootscript $@-boot.scr
31 endef
32
33 define Build/boot-img
34 rm -f $@.boot
35 mkfs.fat -C $@.boot 16384
36 $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::$(dts).dtb;)
37 mcopy -i $@.boot $(IMAGE_KERNEL) ::zImage
38 -mcopy -i $@.boot $@-boot.scr ::boot.scr
39 endef
40
41 define Build/sdcard-img
42 if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
43 ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
44 SIGNATURE="$(SIGNATURE)" \
45 ./gen_mvebu_sdcard_img.sh $@ \
46 $$UBOOT \
47 c 32768 $@.boot \
48 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
49 endef
50
51 define Build/omnia-medkit-initramfs
52 $(TAR) -c -T /dev/null -f $@
53 rm -rf $(dir $(IMAGE_KERNEL))boot
54 mkdir -p $(dir $(IMAGE_KERNEL))boot/boot/
55 cp $(KDIR)/zImage-initramfs $(dir $(IMAGE_KERNEL))boot/boot/zImage
56 cp $(DTS_DIR)/$(DEVICE_DTS).dtb $(dir $(IMAGE_KERNEL))boot/boot/dtb
57 $(TAR) -rp --numeric-owner --owner=0 --group=0 --sort=name \
58 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
59 --file=$@ -C $(dir $(IMAGE_KERNEL))boot/ .
60 endef
61
62 define Device/Default
63 PROFILES := Default
64 DEVICE_DTS := $(1)
65 BOARD_NAME = $$(DEVICE_DTS)
66 KERNEL_NAME := zImage
67 KERNEL := kernel-bin | append-dtb | uImage none
68 SUPPORTED_DEVICES = $$(DEVICE_DTS)
69 endef
70
71 define Device/UBI
72 IMAGES := sysupgrade.bin
73 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
74 endef
75
76 define Device/UBI-factory
77 $(Device/UBI)
78 UBINIZE_OPTS := -E 5
79 IMAGES += factory.img
80 IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
81 endef
82
83 define Device/NAND-128K
84 $(Device/UBI)
85 BLOCKSIZE := 128k
86 PAGESIZE := 2048
87 SUBPAGESIZE := 512
88 VID_HDR_OFFSET := 2048
89 endef
90
91 define Device/NAND-256K
92 $(Device/UBI)
93 BLOCKSIZE := 256k
94 PAGESIZE := 4096
95 endef
96
97 define Device/NAND-512K
98 $(Device/UBI)
99 BLOCKSIZE := 512k
100 PAGESIZE := 4096
101 endef
102
103 define Device/linksys
104 DEVICE_TITLE := Linksys $(1)
105 DEVICE_PACKAGES := kmod-mwlwifi wpad-mini swconfig
106 endef
107
108 define Device/armada-385-linksys
109 $(Device/NAND-128K)
110 $(Device/UBI-factory)
111 KERNEL_SIZE := 6144k
112 endef
113
114 define Device/linksys-wrt1200ac
115 $(call Device/linksys,WRT1200AC (Caiman))
116 $(Device/armada-385-linksys)
117 DEVICE_DTS := armada-385-linksys-caiman
118 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
119 endef
120 TARGET_DEVICES += linksys-wrt1200ac
121
122 define Device/linksys-wrt1900acv2
123 $(call Device/linksys,WRT1900ACv2 (Cobra))
124 $(Device/armada-385-linksys)
125 DEVICE_DTS := armada-385-linksys-cobra
126 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
127 endef
128 TARGET_DEVICES += linksys-wrt1900acv2
129
130 define Device/linksys-wrt3200acm
131 $(call Device/linksys,WRT3200ACM (Rango))
132 $(Device/armada-385-linksys)
133 DEVICE_DTS := armada-385-linksys-rango
134 DEVICE_PACKAGES += kmod-btmrvl kmod-mwifiex-sdio mwlwifi-firmware-88w8964
135 endef
136 TARGET_DEVICES += linksys-wrt3200acm
137
138 define Device/linksys-wrt1900acs
139 $(call Device/linksys,WRT1900ACS (Shelby))
140 $(Device/armada-385-linksys)
141 DEVICE_DTS := armada-385-linksys-shelby
142 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
143 endef
144 TARGET_DEVICES += linksys-wrt1900acs
145
146 define Device/linksys-wrt1900ac
147 $(call Device/linksys,WRT1900AC (Mamba))
148 DEVICE_DTS := armada-xp-linksys-mamba
149 DEVICE_PACKAGES += mwlwifi-firmware-88w8864
150 $(Device/NAND-128K)
151 $(Device/UBI-factory)
152 KERNEL_SIZE := 3072k
153 endef
154 TARGET_DEVICES += linksys-wrt1900ac
155
156 define Device/openblocks-ax3-4
157 $(Device/UBI-factory)
158 DEVICE_DTS := armada-xp-openblocks-ax3-4
159 SUPPORTED_DEVICES := $(1)
160 BLOCKSIZE := 128k
161 PAGESIZE := 1
162 IMAGE/factory.img := append-kernel | pad-to $$(BLOCKSIZE) | append-ubi
163 DEVICE_TITLE := Plat'Home OpenBlocks AX3
164 endef
165 TARGET_DEVICES += openblocks-ax3-4
166
167 define Device/armada-385-db-ap
168 $(Device/NAND-256K)
169 $(Device/UBI-factory)
170 KERNEL_SIZE := 8192k
171 DEVICE_TITLE := Marvell Armada 385 DB AP (DB-88F6820-AP)
172 endef
173 TARGET_DEVICES += armada-385-db-ap
174
175 define Device/marvell-nand
176 $(Device/NAND-512K)
177 DEVICE_TITLE := Marvell Armada $(1)
178 endef
179
180 define Device/armada-370-db
181 $(call Device/marvell-nand,370 DB (DB-88F6710-BP-DDR3))
182 endef
183 TARGET_DEVICES += armada-370-db
184
185 define Device/armada-370-rd
186 $(call Device/marvell-nand,370 RD (RD-88F6710-A1))
187 endef
188 TARGET_DEVICES += armada-370-rd
189
190 define Device/armada-xp-db
191 $(call Device/marvell-nand,XP DB (DB-78460-BP))
192 endef
193 TARGET_DEVICES += armada-xp-db
194
195 define Device/armada-xp-gp
196 $(call Device/marvell-nand,XP GP (DB-MV784MP-GP))
197 endef
198 TARGET_DEVICES += armada-xp-gp
199
200 define Device/armada-388-rd
201 DEVICE_TITLE := Marvell Armada 388 RD (RD-88F6820-AP)
202 IMAGES := firmware.bin
203 IMAGE/firmware.bin := append-kernel | pad-to 256k | append-rootfs | pad-rootfs
204 endef
205 TARGET_DEVICES += armada-388-rd
206
207 define Device/armada-388-clearfog-pro
208 KERNEL_INSTALL := 1
209 KERNEL := kernel-bin
210 DEVICE_TITLE := SolidRun ClearFog Pro
211 DEVICE_PACKAGES := mkf2fs e2fsprogs swconfig kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
212 IMAGES := sdcard.img.gz
213 IMAGE/sdcard.img.gz := boot-scr | boot-img | sdcard-img | gzip | append-metadata
214 DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
215 SUPPORTED_DEVICES := armada-388-clearfog-pro armada-388-clearfog
216 UBOOT := clearfog-u-boot-spl.kwb
217 endef
218 TARGET_DEVICES += armada-388-clearfog-pro
219
220 define Device/armada-388-clearfog-base
221 KERNEL_INSTALL := 1
222 KERNEL := kernel-bin
223 DEVICE_TITLE := SolidRun ClearFog Base
224 DEVICE_PACKAGES := mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1
225 IMAGES := sdcard.img.gz
226 IMAGE/sdcard.img.gz := boot-scr | boot-img | sdcard-img | gzip | append-metadata
227 DEVICE_DTS := armada-388-clearfog-pro armada-388-clearfog-base
228 UBOOT := clearfog-u-boot-spl.kwb
229 endef
230 TARGET_DEVICES += armada-388-clearfog-base
231
232 define Device/globalscale-mirabox
233 $(Device/NAND-512K)
234 DEVICE_DTS := armada-370-mirabox
235 SUPPORTED_DEVICES := mirabox
236 DEVICE_TITLE := Globalscale Mirabox
237 endef
238 TARGET_DEVICES += globalscale-mirabox
239
240 define Device/turris-omnia
241 KERNEL_INSTALL := 1
242 KERNEL := kernel-bin
243 KERNEL_INITRAMFS := kernel-bin
244 DEVICE_TITLE := Turris Omnia
245 DEVICE_PACKAGES := \
246 mkf2fs e2fsprogs kmod-fs-vfat kmod-nls-cp437 kmod-nls-iso8859-1 \
247 wpad-mini kmod-ath9k kmod-ath10k ath10k-firmware-qca988x
248 IMAGES := $$(IMAGE_PREFIX)-sysupgrade.img.gz omnia-medkit-$$(IMAGE_PREFIX)-initramfs.tar.gz
249 IMAGE/$$(IMAGE_PREFIX)-sysupgrade.img.gz := boot-img | sdcard-img | gzip | append-metadata
250 IMAGE/omnia-medkit-$$(IMAGE_PREFIX)-initramfs.tar.gz := omnia-medkit-initramfs | gzip
251 IMAGE_NAME = $$(2)
252 DEVICE_DTS := armada-385-turris-omnia
253 UBOOT :=
254 endef
255 TARGET_DEVICES += turris-omnia
256
257 $(eval $(call BuildImage))