745611f8637a972d3e83b4e092a5e83877b602e0
[openwrt/svn-archive/archive.git] / target / linux / ramips / image / mt7621.mk
1 #
2 # MT7621 Profiles
3 #
4
5 define Build/seama
6 $(STAGING_DIR_HOST)/bin/seama -i $@ $(1)
7 mv $@.seama $@
8 endef
9
10 define Build/seama-seal
11 $(call Build/seama,-s $@.seama $(1))
12 endef
13
14 define Build/ubnt-erx-factory-compat
15 echo '21001:6' > $@.compat
16 $(TAR) -cf $@ --transform='s/^.*/compat/' $@.compat
17 $(RM) $@.compat
18 endef
19
20 define Build/ubnt-erx-factory-kernel
21 if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) ]; then \
22 $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp/' $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \
23 \
24 md5sum --binary $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) | awk '{print $$1}'> $@.md5; \
25 $(TAR) -rf $@ --transform='s/^.*/vmlinux.tmp.md5/' $@.md5; \
26 $(RM) $@.md5; \
27 fi
28 endef
29
30 define Build/ubnt-erx-factory-rootfs
31 echo "dummy" > $@.rootfs
32 $(TAR) -rf $@ --transform='s/^.*/squashfs.tmp/' $@.rootfs
33
34 md5sum --binary $@.rootfs | awk '{print $$1}'> $@.md5
35 $(TAR) -rf $@ --transform='s/^.*/squashfs.tmp.md5/' $@.md5
36 $(RM) $@.md5
37 $(RM) $@.rootfs
38 endef
39
40 define Build/ubnt-erx-factory-version
41 echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $@.version
42 $(TAR) -rf $@ --transform='s/^.*/version.tmp/' $@.version
43 $(RM) $@.version
44 endef
45
46 # We need kernel+initrams fit into kernel partition
47 define Build/ubnt-erx-factory-check-size
48 @[ $$(($(subst k,* 1024,$(subst m, * 1024k,$(1))))) -ge "$$($(TAR) -xf $@ vmlinux.tmp -O | wc -c)" ] || { \
49 echo "WARNING: Initramfs kernel for image $@ is too big (kernel size: $$($(TAR) -xf $@ vmlinux.tmp -O | wc -c), max size $(1))" >&2; \
50 $(RM) -f $@; \
51 }
52
53 @[ "$$($(TAR) -xf $@ vmlinux.tmp -O | wc -c)" -gt 0 ] || { \
54 echo "WARNING: Kernel for image $@ not found" >&2; \
55 $(RM) -f $@; \
56 }
57 endef
58
59 ifeq ($(SUBTARGET),mt7621)
60 TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 sap-g3200u3 ubnt-erx witi wf-2881 zbt-wg2626
61 endif
62
63 define Device/mt7621
64 DTS := MT7621
65 IMAGE_SIZE := $(ralink_default_fw_size_4M)
66 endef
67
68 define Device/wsr-600
69 DTS := WSR-600
70 IMAGE_SIZE := $(ralink_default_fw_size_16M)
71 endef
72
73 define Device/re6500
74 DTS := RE6500
75 endef
76
77 define Device/wsr-1166
78 DTS := WSR-1166
79 IMAGE/sysupgrade.bin := trx | pad-rootfs
80 IMAGE_SIZE := $(ralink_default_fw_size_16M)
81 endef
82
83 define Device/dir-860l-b1
84 DTS := DIR-860L-B1
85 IMAGES += factory.bin
86 KERNEL := kernel-bin | patch-dtb | relocate-kernel | lzma | uImage lzma
87 IMAGE/sysupgrade.bin := \
88 append-kernel | pad-offset 65536 64 | append-rootfs | \
89 seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
90 pad-rootfs | check-size $$$$(IMAGE_SIZE)
91 IMAGE/factory.bin := \
92 append-kernel | pad-offset 65536 64 | append-rootfs | pad-rootfs -x 64 | \
93 seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
94 seama-seal -m "signature=wrgac13_dlink.2013gui_dir860lb" | \
95 check-size $$$$(IMAGE_SIZE)
96 endef
97
98 define Device/firewrt
99 DTS := FIREWRT
100 IMAGE_SIZE := $(ralink_default_fw_size_16M)
101 endef
102
103 define Device/pbr-m1
104 DTS := PBR-M1
105 IMAGE_SIZE := $(ralink_default_fw_size_16M)
106 endef
107
108 define Device/sap-g3200u3
109 DTS := SAP-G3200U3
110 endef
111
112 define Device/witi
113 DTS := WITI
114 IMAGE_SIZE := $(ralink_default_fw_size_16M)
115 endef
116
117 define Device/zbt-wg2626
118 DTS := ZBT-WG2626
119 IMAGE_SIZE := $(ralink_default_fw_size_16M)
120 endef
121
122 define Device/wf-2881
123 DTS := WF-2881
124 BLOCKSIZE := 128KiB
125 PAGESIZE := 2048
126 FILESYSTEMS := squashfs
127 IMAGE_SIZE := 132382720
128 KERNEL := $(KERNEL_DTB) | pad-offset 131072 64 | uImage lzma
129 IMAGE/sysupgrade.bin := append-kernel | append-ubi | check-size $$$$(IMAGE_SIZE)
130 endef
131
132 define Device/ubnt-erx
133 DTS := UBNT-ERX
134 FILESYSTEMS := squashfs
135 KERNEL_SIZE := 3145728
136 KERNEL := $(KERNEL_DTB) | uImage lzma
137 IMAGES := sysupgrade.tar $(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),factory-initramfs.tar)
138 IMAGE/factory-initramfs.tar := ubnt-erx-factory-compat | \
139 ubnt-erx-factory-kernel | \
140 ubnt-erx-factory-rootfs | \
141 ubnt-erx-factory-version | \
142 ubnt-erx-factory-check-size $$(KERNEL_SIZE)
143 IMAGE/sysupgrade.tar := sysupgrade-nand
144 endef
145
146 # FIXME: is this still needed?
147 define Image/Prepare
148 #define Build/Compile
149 rm -rf $(KDIR)/relocate
150 $(CP) ../../generic/image/relocate $(KDIR)
151 $(MAKE) -C $(KDIR)/relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
152 $(CP) $(KDIR)/relocate/loader.bin $(KDIR)/loader.bin
153 endef