mvebu: use ext4/f2fs overlay filesystem for solidrun clearfog
[openwrt/openwrt.git] / target / linux / mvebu / image / Makefile
1 #
2 # Copyright (C) 2012-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 JFFS2_BLOCKSIZE = 128k
9
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/image.mk
12
13 KERNEL_LOADADDR := 0x00008000
14
15 DEVICE_VARS += KERNEL_SIZE
16
17 define Build/dtb
18 $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$@.dtb)
19 endef
20
21 define Build/clearfog-bundle
22 rm -f $@.new
23 $(TAR) -cp --numeric-owner --owner=0 --group=0 --sort=name \
24 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
25 --file=$@.new -C $(TARGET_DIR)/ .
26 $(TAR) -rp --numeric-owner --owner=0 --group=0 --sort=name \
27 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
28 --file=$@.new -C $(dir $(IMAGE_KERNEL)) $(notdir $(IMAGE_KERNEL)) $(notdir $(IMAGE_KERNEL).dtb)
29 gzip -9n -c $@.new > $@
30 endef
31
32 # SD-Card Images:
33 # these values are optimized for a 4GB labeled sdcard that actually holds 7744512 sectors of 512 byte
34 # MBR: 2048 sectors
35 # Partition 1: 32768 sectors
36 # Partition 2: 98304 sectors (configurable)
37
38 define Build/boot-scr
39 rm -f $@.bootscript
40 mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d boot.script $@.bootscript
41 endef
42
43 define Build/boot-img
44 rm -f $@.boot
45 mkfs.fat -C $@.boot 16384
46 $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::$(dts).dtb)
47 mcopy -i $@.boot $(IMAGE_KERNEL) ::zImage
48 mcopy -i $@.boot $@.bootscript ::boot.scr
49 endef
50
51 define Build/sdcard-img
52 ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
53 ./gen_mvebu_sdcard_img.sh $@ \
54 "$(BIN_DIR)/uboot-mvebu-clearfog/openwrt-mvebu-clearfog-u-boot-spl.kwb" \
55 c 32768 $@.boot \
56 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
57 endef
58
59 define Device/Default
60 PROFILES := Default
61 DEVICE_DTS := $(1)
62 BOARD_NAME = $$(DEVICE_DTS)
63 KERNEL_NAME := zImage
64 KERNEL := kernel-bin | append-dtb | uImage none
65 endef
66
67 define Device/UBI
68 IMAGES := sysupgrade.bin
69 IMAGE/sysupgrade.bin := sysupgrade-tar
70 endef
71
72 define Device/UBI-factory
73 $(Device/UBI)
74 IMAGES += factory.img
75 IMAGE/factory.img := append-kernel $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
76 endef
77
78 define Device/NAND-128K
79 $(Device/UBI)
80 BLOCKSIZE := 128k
81 PAGESIZE := 2048
82 SUBPAGESIZE := 512
83 VID_HDR_OFFSET := 2048
84 endef
85
86 define Device/NAND-256K
87 $(Device/UBI)
88 BLOCKSIZE := 256k
89 PAGESIZE := 4096
90 endef
91
92 define Device/NAND-512K
93 $(Device/UBI)
94 BLOCKSIZE := 512k
95 PAGESIZE := 4096
96 endef
97
98 define Device/linksys
99 DEVICE_TITLE := Linksys $(1)
100 DEVICE_PACKAGES := kmod-mwlwifi wpad-mini swconfig
101 endef
102
103 define Device/armada-385-linksys
104 $(Device/NAND-128K)
105 $(Device/UBI-factory)
106 KERNEL_SIZE := 6144k
107 endef
108
109 define Device/linksys-wrt1200ac
110 $(call Device/linksys,WRT1200AC (Caiman))
111 $(Device/armada-385-linksys)
112 DEVICE_DTS := armada-385-linksys-caiman
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 endef
121 TARGET_DEVICES += linksys-wrt1900acv2
122
123 define Device/linksys-wrt1900acs
124 $(call Device/linksys,WRT1900ACS (Shelby))
125 $(Device/armada-385-linksys)
126 DEVICE_DTS := armada-385-linksys-shelby
127 endef
128 TARGET_DEVICES += linksys-wrt1900acs
129
130 define Device/linksys-wrt1900ac
131 $(call Device/linksys,WRT1900AC (Mamba))
132 DEVICE_DTS := armada-xp-linksys-mamba
133 $(Device/NAND-128K)
134 $(Device/UBI-factory)
135 KERNEL_SIZE := 3072k
136 endef
137 TARGET_DEVICES += linksys-wrt1900ac
138
139 define Device/openblocks-ax3
140 $(Device/UBI-factory)
141 DEVICE_DTS := armada-xp-openblocks-ax3-4
142 BLOCKSIZE := 128k
143 PAGESIZE := 1
144 IMAGE/factory.img := append-kernel $$$$(KERNEL_SIZE) | append-ubi
145 DEVICE_TITLE := Plat'Home OpenBlocks AX3
146 endef
147 TARGET_DEVICES += openblocks-ax3
148
149 define Device/armada-385-db-ap
150 $(Device/NAND-256K)
151 $(Device/UBI-factory)
152 KERNEL_SIZE := 8192k
153 DEVICE_TITLE := Marvell Armada 385 DB AP (DB-88F6820-AP)
154 endef
155 TARGET_DEVICES += armada-385-db-ap
156
157 define Device/marvell-nand
158 $(Device/NAND-512K)
159 DEVICE_TITLE := Marvell Armada $(1)
160 endef
161
162 Device/armada-370-db = $(call Device/marvell-nand,370 DB (DB-88F6710-BP-DDR3))
163 Device/armada-370-rd = $(call Device/marvell-nand,370 RD (RD-88F6710-A1))
164 Device/armada-xp-db = $(call Device/marvell-nand,XP DB (DB-78460-BP))
165 Device/armada-xp-gp = $(call Device/marvell-nand,XP GP (DB-MV784MP-GP))
166 TARGET_DEVICES += armada-370-db armada-370-rd armada-xp-db armada-xp-gp
167
168 define Device/armada-388-rd
169 DEVICE_TITLE := Marvell Armada 388 RD (RD-88F6820-AP)
170 IMAGES := firmware.bin
171 IMAGE/firmware.bin := append-kernel 256k | append-rootfs | pad-rootfs
172 endef
173 TARGET_DEVICES += armada-388-rd
174
175 define Device/armada-388-clearfog
176 KERNEL_INSTALL := 1
177 KERNEL := dtb | kernel-bin
178 DEVICE_TITLE := SolidRun ClearFog
179 DEVICE_PACKAGES := uboot-mvebu-clearfog mkf2fs e2fsprogs
180 IMAGES := bundle.tar.gz sdcard.img.gz
181 IMAGE/bundle.tar.gz := clearfog-bundle
182 IMAGE/sdcard.img.gz := boot-scr | boot-img | sdcard-img | gzip
183 IMAGE_NAME = $$(IMAGE_PREFIX)-$$(2)
184 endef
185 TARGET_DEVICES += armada-388-clearfog
186
187 define Device/globalscale-mirabox
188 $(Device/NAND-512K)
189 DEVICE_DTS := armada-370-mirabox
190 DEVICE_TITLE := Globalscale Mirabox
191 endef
192 TARGET_DEVICES += globalscale-mirabox
193
194 $(eval $(call BuildImage))