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