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