mediatek: rework support for BananaPi BPi-R64
[openwrt/staging/jow.git] / target / linux / mediatek / image / mt7622.mk
1 DTS_DIR := $(DTS_DIR)/mediatek
2
3 ifdef CONFIG_LINUX_5_4
4 KERNEL_LOADADDR := 0x44080000
5 else
6 KERNEL_LOADADDR := 0x44000000
7 endif
8
9 define Build/mmc-header
10 dd if=$(STAGING_DIR_IMAGE)/mt7622-header_$1.bin bs=512 count=1 of=$@ conv=notrunc
11 endef
12
13 define Build/bl2
14 cat $(STAGING_DIR_IMAGE)/mt7622-$1-bl2.img >> $@
15 endef
16
17 define Build/bl31-uboot
18 cat $(STAGING_DIR_IMAGE)/mt7622_$1-u-boot.fip >> $@
19 endef
20
21 define Build/mt7622-gpt
22 ptgen -g -o $@ -h 4 -s 31 -a 1 -l 1024 -g \
23 -t 0xef \
24 $(if $(findstring sdmmc,$1), \
25 -N bl2 -r -p 512k@512k \
26 ) \
27 -N fip -r -p 1M@2M \
28 -N ubootenv -r -p 1M@4M \
29 -N recovery -r -p 32M@6M \
30 $(if $(findstring sdmmc,$1), \
31 -t 0x2e -N production -p 216M@40M \
32 ) \
33 $(if $(findstring emmc,$1), \
34 -t 0x2e -N production -p 980M@40M \
35 )
36 endef
37
38 define Device/bananapi_bpi-r64
39 DEVICE_VENDOR := Bananapi
40 DEVICE_MODEL := BPi-R64
41 DEVICE_DTS := mt7622-bananapi-bpi-r64
42 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \
43 kmod-mt7615e kmod-mt7615-firmware \
44 uboot-mt7622_bananapi_bpi-r64-emmc \
45 uboot-mt7622_bananapi_bpi-r64-sdmmc \
46 e2fsprogs mkf2fs f2fsck \
47 kmod-nls-cp437 kmod-nls-iso8859-1 kmod-vfat blockd
48 ARTIFACTS := boot-sdcard.img boot-emmc.img bl2-emmc.bin bl31-emmc.bin header-emmc.bin
49 IMAGES := sysupgrade.itb
50 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
51 ARTIFACT/boot-sdcard.img := mt7622-gpt sdmmc | mmc-header sdmmc | pad-to 512k | bl2 sdmmc-2ddr | pad-to 2M | bl31-uboot bananapi_bpi-r64-sdmmc | pad-to 6M
52 ARTIFACT/boot-emmc.img := mt7622-gpt emmc | mmc-header emmc | pad-to 2M | bl31-uboot bananapi_bpi-r64-emmc | pad-to 6M
53 ARTIFACT/header-emmc.bin := mt7622-gpt emmc | mmc-header emmc
54 ARTIFACT/bl31-emmc.bin := bl31-uboot bananapi_bpi-r64-emmc
55 ARTIFACT/bl2-emmc.bin := bl2 emmc-2ddr
56 KERNEL := kernel-bin | gzip
57 KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 128k
58 IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
59 endef
60 TARGET_DEVICES += bananapi_bpi-r64
61
62 define Device/elecom_wrc-2533gent
63 DEVICE_VENDOR := Elecom
64 DEVICE_MODEL := WRC-2533GENT
65 DEVICE_DTS := mt7622-elecom-wrc-2533gent
66 DEVICE_DTS_DIR := ../dts
67 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-mt7615e \
68 kmod-mt7615-firmware kmod-btmtkuart swconfig
69 endef
70 TARGET_DEVICES += elecom_wrc-2533gent
71
72 define Device/linksys_e8450
73 DEVICE_VENDOR := Linksys
74 DEVICE_MODEL := E8450
75 DEVICE_ALT0_VENDOR := Belkin
76 DEVICE_ALT0_MODEL := RT3200
77 DEVICE_DTS := mt7622-linksys-e8450
78 DEVICE_DTS_DIR := ../dts
79 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \
80 kmod-mt7615e kmod-mt7615-firmware kmod-mt7915e
81 endef
82 TARGET_DEVICES += linksys_e8450
83
84 define Device/linksys_e8450-ubi
85 DEVICE_VENDOR := Linksys
86 DEVICE_MODEL := E8450
87 DEVICE_VARIANT := UBI
88 DEVICE_ALT0_VENDOR := Belkin
89 DEVICE_ALT0_MODEL := RT3200
90 DEVICE_ALT0_VARIANT := UBI
91 DEVICE_DTS := mt7622-linksys-e8450-ubi
92 DEVICE_DTS_DIR := ../dts
93 UBINIZE_OPTS := -E 5
94 BLOCKSIZE := 128k
95 PAGESIZE := 2048
96 UBOOTENV_IN_UBI := 1
97 KERNEL_IN_UBI := 1
98 KERNEL := kernel-bin | gzip
99 # recovery can also be used with stock firmware web-ui, hence the padding...
100 KERNEL_INITRAMFS := kernel-bin | lzma | \
101 fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 128k
102 KERNEL_INITRAMFS_SUFFIX := -recovery.itb
103 IMAGES := sysupgrade.itb
104 IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
105 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk \
106 kmod-mt7615e kmod-mt7615-firmware kmod-mt7915e \
107 u-boot-mt7622_linksys_e8450 uboot-envtools
108 ARTIFACTS := preloader.bin bl31-uboot.fip
109 ARTIFACT/preloader.bin := bl2 snand-1ddr
110 ARTIFACT/bl31-uboot.fip := bl31-uboot linksys_e8450
111 endef
112 TARGET_DEVICES += linksys_e8450-ubi
113
114 define Device/mediatek_mt7622-rfb1
115 DEVICE_VENDOR := MediaTek
116 DEVICE_MODEL := MTK7622 rfb1 AP
117 DEVICE_DTS := mt7622-rfb1
118 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk
119 endef
120 TARGET_DEVICES += mediatek_mt7622-rfb1
121
122 define Device/mediatek_mt7622-ubi
123 DEVICE_VENDOR := MediaTek
124 DEVICE_MODEL := MTK7622 AP (UBI)
125 DEVICE_DTS := mt7622-rfb1-ubi
126 DEVICE_DTS_DIR := ../dts
127 UBINIZE_OPTS := -E 5
128 BLOCKSIZE := 128k
129 PAGESIZE := 2048
130 KERNEL_SIZE := 4194304
131 IMAGE_SIZE := 32768k
132 IMAGES += factory.bin
133 IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
134 check-size $$$$(IMAGE_SIZE)
135 IMAGE/sysupgrade.bin := sysupgrade-tar
136 DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-ahci-mtk
137 endef
138 TARGET_DEVICES += mediatek_mt7622-ubi
139
140 define Device/ubnt_unifi-6-lr
141 DEVICE_VENDOR := Ubiquiti
142 DEVICE_MODEL := UniFi 6 LR
143 DEVICE_DTS := mt7622-ubnt-unifi-6-lr
144 DEVICE_DTS_DIR := ../dts
145 DEVICE_PACKAGES := kmod-mt7915e
146 endef
147 TARGET_DEVICES += ubnt_unifi-6-lr