76b4e484bbed53617e7c628a66b1bb665467da73
[openwrt.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-image
15         if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) ]; then \
16                 echo '21001:6' > $(1).compat; \
17                 $(TAR) -cf $(1) --transform='s/^.*/compat/' $(1).compat; \
18                 \
19                 $(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp/' $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE); \
20                 md5sum --binary $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) | awk '{print $$1}'> $(1).md5; \
21                 $(TAR) -rf $(1) --transform='s/^.*/vmlinux.tmp.md5/' $(1).md5; \
22                 \
23                 echo "dummy" > $(1).rootfs; \
24                 $(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp/' $(1).rootfs; \
25                 \
26                 md5sum --binary $(1).rootfs | awk '{print $$1}'> $(1).md5; \
27                 $(TAR) -rf $(1) --transform='s/^.*/squashfs.tmp.md5/' $(1).md5; \
28                 \
29                 echo '$(BOARD) $(VERSION_CODE) $(VERSION_NUMBER)' > $(1).version; \
30                 $(TAR) -rf $(1) --transform='s/^.*/version.tmp/' $(1).version; \
31                 \
32                 $(CP) $(1) $(BIN_DIR)/; \
33         fi
34 endef
35
36 ifeq ($(SUBTARGET),mt7621)
37   TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt pbr-m1 re6500 sap-g3200u3 ubnt-erx witi wf-2881 zbt-wg2626
38 endif
39
40 define Device/mt7621
41   DTS := MT7621
42   IMAGE_SIZE := $(ralink_default_fw_size_4M)
43 endef
44
45 define Device/wsr-600
46   DTS := WSR-600
47   IMAGE_SIZE := $(ralink_default_fw_size_16M)
48 endef
49
50 define Device/re6500
51   DTS := RE6500
52 endef
53
54 define Device/wsr-1166
55   DTS := WSR-1166
56   IMAGE/sysupgrade.bin := trx | pad-rootfs
57   IMAGE_SIZE := $(ralink_default_fw_size_16M)
58 endef
59
60 define Device/dir-860l-b1
61   DTS := DIR-860L-B1
62   IMAGES += factory.bin
63   KERNEL := kernel-bin | patch-dtb | relocate-kernel | lzma | uImage lzma
64   IMAGE/sysupgrade.bin := \
65         append-kernel | pad-offset 65536 64 | append-rootfs | \
66         seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
67         pad-rootfs | check-size $$$$(IMAGE_SIZE)
68   IMAGE/factory.bin := \
69         append-kernel | pad-offset 65536 64 | append-rootfs | pad-rootfs -x 64 | \
70         seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
71         seama-seal -m "signature=wrgac13_dlink.2013gui_dir860lb" | \
72         check-size $$$$(IMAGE_SIZE)
73 endef
74
75 define Device/firewrt
76   DTS := FIREWRT
77   IMAGE_SIZE := $(ralink_default_fw_size_16M)
78 endef
79
80 define Device/pbr-m1
81   DTS := PBR-M1
82   IMAGE_SIZE := $(ralink_default_fw_size_16M)
83 endef
84
85 define Device/sap-g3200u3
86   DTS := SAP-G3200U3
87 endef
88
89 define Device/witi
90   DTS := WITI
91   IMAGE_SIZE := $(ralink_default_fw_size_16M)
92 endef
93
94 define Device/zbt-wg2626
95   DTS := ZBT-WG2626
96   IMAGE_SIZE := $(ralink_default_fw_size_16M)
97 endef
98
99 define Device/wf-2881
100   DTS := WF-2881
101   BLOCKSIZE := 128KiB
102   PAGESIZE := 2048
103   FILESYSTEMS := squashfs
104   IMAGE_SIZE := 132382720
105   KERNEL := $(KERNEL_DTB) | pad-offset 131072 64 | uImage lzma
106   IMAGE/sysupgrade.bin := append-kernel | append-ubi | check-size $$$$(IMAGE_SIZE)
107 endef
108
109 define Device/ubnt-erx
110   DTS := UBNT-ERX
111   FILESYSTEMS := squashfs
112   KERNEL_SIZE := 3145728
113   KERNEL := $(KERNEL_DTB) | uImage lzma
114   IMAGES := sysupgrade.tar
115   KERNEL_INITRAMFS := $$(KERNEL) | check-size $$(KERNEL_SIZE) | \
116                         ubnt-erx-factory-image $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.tar
117   IMAGE/sysupgrade.tar := sysupgrade-nand
118 endef
119
120 # FIXME: is this still needed?
121 define Image/Prepare
122 #define Build/Compile
123         rm -rf $(KDIR)/relocate
124         $(CP) ../../generic/image/relocate $(KDIR)
125         $(MAKE) -C $(KDIR)/relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
126         $(CP) $(KDIR)/relocate/loader.bin $(KDIR)/loader.bin
127 endef