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