mvebu: rework ClearFog bundle.tar.gz generation
[lede.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
33 define Device/Default
34   PROFILES := Default
35   DEVICE_DTS := $(1)
36   BOARD_NAME = $$(DEVICE_DTS)
37   KERNEL_NAME := zImage
38   KERNEL := kernel-bin | append-dtb | uImage none
39 endef
40
41 define Device/UBI
42   IMAGES := sysupgrade.bin
43   IMAGE/sysupgrade.bin := sysupgrade-tar
44 endef
45
46 define Device/UBI-factory
47   $(Device/UBI)
48   IMAGES += factory.img
49   IMAGE/factory.img := append-kernel $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
50 endef
51
52 define Device/NAND-128K
53   $(Device/UBI)
54   BLOCKSIZE := 128KiB
55   PAGESIZE := 2048
56   SUBPAGESIZE := 512
57   VID_HDR_OFFSET := 2048
58 endef
59
60 define Device/NAND-256K
61   $(Device/UBI)
62   BLOCKSIZE := 256KiB
63   PAGESIZE := 4096
64 endef
65
66 define Device/NAND-512K
67   $(Device/UBI)
68   BLOCKSIZE := 512KiB
69   PAGESIZE := 4096
70 endef
71
72 define Device/linksys
73   DEVICE_TITLE := Linksys $(1)
74   DEVICE_PACKAGES := kmod-mwlwifi wpad-mini swconfig
75 endef
76
77 define Device/armada-385-linksys
78   $(Device/NAND-128K)
79   $(Device/UBI-factory)
80   KERNEL_SIZE := 6144k
81 endef
82
83 define Device/linksys-wrt1200ac
84   $(call Device/linksys,WRT1200AC (Caiman))
85   $(Device/armada-385-linksys)
86   DEVICE_DTS := armada-385-linksys-caiman
87 endef
88 TARGET_DEVICES += linksys-wrt1200ac
89
90 define Device/linksys-wrt1900acv2
91   $(call Device/linksys,WRT1900ACv2 (Cobra))
92   $(Device/armada-385-linksys)
93   DEVICE_DTS := armada-385-linksys-cobra
94 endef
95 TARGET_DEVICES += linksys-wrt1900acv2
96
97 define Device/linksys-wrt1900acs
98   $(call Device/linksys,WRT1900ACS (Shelby))
99   $(Device/armada-385-linksys)
100   DEVICE_DTS := armada-385-linksys-shelby
101 endef
102 TARGET_DEVICES += linksys-wrt1900acs
103
104 define Device/linksys-wrt1900ac
105   $(call Device/linksys,WRT1900AC (Mamba))
106   DEVICE_DTS := armada-xp-linksys-mamba
107   $(Device/NAND-128K)
108   $(Device/UBI-factory)
109   KERNEL_SIZE := 3072k
110 endef
111 TARGET_DEVICES += linksys-wrt1900ac
112
113 define Device/openblocks-ax3
114   $(Device/UBI-factory)
115   DEVICE_DTS := armada-xp-openblocks-ax3-4
116   BLOCKSIZE := 128KiB
117   PAGESIZE := 1
118   IMAGE/factory.img := append-kernel $$$$(KERNEL_SIZE) | append-ubi
119   DEVICE_TITLE := Plat'Home OpenBlocks AX3
120 endef
121 TARGET_DEVICES += openblocks-ax3
122
123 define Device/armada-385-db-ap
124   $(Device/NAND-256K)
125   $(Device/UBI-factory)
126   KERNEL_SIZE := 8192k
127   DEVICE_TITLE := Marvell Armada 385 DB AP (DB-88F6820-AP)
128 endef
129 TARGET_DEVICES += armada-385-db-ap
130
131 define Device/marvell-nand
132   $(Device/NAND-512K)
133   DEVICE_TITLE := Marvell Armada $(1)
134 endef
135
136 Device/armada-370-db = $(call Device/marvell-nand,370 DB (DB-88F6710-BP-DDR3))
137 Device/armada-370-rd = $(call Device/marvell-nand,370 RD (RD-88F6710-A1))
138 Device/armada-xp-db = $(call Device/marvell-nand,XP DB (DB-78460-BP))
139 Device/armada-xp-gp = $(call Device/marvell-nand,XP GP (DB-MV784MP-GP))
140 TARGET_DEVICES += armada-370-db armada-370-rd armada-xp-db armada-xp-gp
141
142 define Device/armada-388-rd
143   DEVICE_TITLE := Marvell Armada 388 RD (RD-88F6820-AP)
144   IMAGES := firmware.bin
145   IMAGE/firmware.bin := append-kernel 256k | append-rootfs | pad-rootfs
146 endef
147 TARGET_DEVICES += armada-388-rd
148
149 define Device/armada-388-clearfog
150   KERNEL_INSTALL := 1
151   KERNEL := dtb | kernel-bin
152   DEVICE_TITLE := SolidRun ClearFog
153   IMAGES := bundle.tar.gz
154   IMAGE/bundle.tar.gz := clearfog-bundle
155   IMAGE_NAME = $$(IMAGE_PREFIX)-$$(2)
156 endef
157 TARGET_DEVICES += armada-388-clearfog
158
159 define Device/globalscale-mirabox
160   $(Device/NAND-512K)
161   DEVICE_DTS := armada-370-mirabox
162   DEVICE_TITLE := Globalscale Mirabox
163 endef
164 TARGET_DEVICES += globalscale-mirabox
165
166 $(eval $(call BuildImage))