2022-07-06 12:06:30 +00:00
|
|
|
DTS_DIR := $(DTS_DIR)/mediatek
|
|
|
|
|
|
|
|
define Image/Prepare
|
|
|
|
# For UBI we want only one extra block
|
|
|
|
rm -f $(KDIR)/ubi_mark
|
|
|
|
echo -ne '\xde\xad\xc0\xde' > $(KDIR)/ubi_mark
|
|
|
|
endef
|
|
|
|
|
2023-04-25 15:06:20 +00:00
|
|
|
define Build/mt7981-bl2
|
|
|
|
cat $(STAGING_DIR_IMAGE)/mt7981-$1-bl2.img >> $@
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/mt7981-bl31-uboot
|
|
|
|
cat $(STAGING_DIR_IMAGE)/mt7981_$1-u-boot.fip >> $@
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/mt7986-bl2
|
2022-07-13 03:30:32 +00:00
|
|
|
cat $(STAGING_DIR_IMAGE)/mt7986-$1-bl2.img >> $@
|
|
|
|
endef
|
|
|
|
|
2023-04-25 15:06:20 +00:00
|
|
|
define Build/mt7986-bl31-uboot
|
2022-07-13 03:30:32 +00:00
|
|
|
cat $(STAGING_DIR_IMAGE)/mt7986_$1-u-boot.fip >> $@
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/mt7986-gpt
|
|
|
|
cp $@ $@.tmp 2>/dev/null || true
|
|
|
|
ptgen -g -o $@.tmp -a 1 -l 1024 \
|
|
|
|
$(if $(findstring sdmmc,$1), \
|
|
|
|
-H \
|
|
|
|
-t 0x83 -N bl2 -r -p 4079k@17k \
|
|
|
|
) \
|
|
|
|
-t 0x83 -N ubootenv -r -p 512k@4M \
|
|
|
|
-t 0x83 -N factory -r -p 2M@4608k \
|
|
|
|
-t 0xef -N fip -r -p 4M@6656k \
|
|
|
|
-N recovery -r -p 32M@12M \
|
|
|
|
$(if $(findstring sdmmc,$1), \
|
|
|
|
-N install -r -p 20M@44M \
|
|
|
|
-t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@64M \
|
|
|
|
) \
|
|
|
|
$(if $(findstring emmc,$1), \
|
|
|
|
-t 0x2e -N production -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)M@64M \
|
|
|
|
)
|
|
|
|
cat $@.tmp >> $@
|
|
|
|
rm $@.tmp
|
|
|
|
endef
|
|
|
|
|
2023-03-11 03:56:35 +00:00
|
|
|
metadata_gl_json = \
|
|
|
|
'{ $(if $(IMAGE_METADATA),$(IMAGE_METADATA)$(comma)) \
|
|
|
|
"metadata_version": "1.1", \
|
|
|
|
"compat_version": "$(call json_quote,$(compat_version))", \
|
|
|
|
$(if $(DEVICE_COMPAT_MESSAGE),"compat_message": "$(call json_quote,$(DEVICE_COMPAT_MESSAGE))"$(comma)) \
|
|
|
|
$(if $(filter-out 1.0,$(compat_version)),"new_supported_devices": \
|
|
|
|
[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma) \
|
|
|
|
"supported_devices": ["$(call json_quote,$(legacy_supported_message))"]$(comma)) \
|
|
|
|
$(if $(filter 1.0,$(compat_version)),"supported_devices":[$(call metadata_devices,$(SUPPORTED_DEVICES))]$(comma)) \
|
|
|
|
"version": { \
|
|
|
|
"release": "$(call json_quote,$(VERSION_NUMBER))", \
|
|
|
|
"date": "$(shell TZ='Asia/Chongqing' date '+%Y%m%d%H%M%S')", \
|
|
|
|
"dist": "$(call json_quote,$(VERSION_DIST))", \
|
|
|
|
"version": "$(call json_quote,$(VERSION_NUMBER))", \
|
|
|
|
"revision": "$(call json_quote,$(REVISION))", \
|
|
|
|
"target": "$(call json_quote,$(TARGETID))", \
|
|
|
|
"board": "$(call json_quote,$(if $(BOARD_NAME),$(BOARD_NAME),$(DEVICE_NAME)))" \
|
2023-05-18 10:21:48 +00:00
|
|
|
} \
|
2023-03-11 03:56:35 +00:00
|
|
|
}'
|
|
|
|
|
|
|
|
define Build/append-gl-metadata
|
|
|
|
$(if $(SUPPORTED_DEVICES),-echo $(call metadata_gl_json,$(SUPPORTED_DEVICES)) | fwtool -I - $@)
|
2023-05-19 08:31:36 +00:00
|
|
|
sha256sum "$@" | cut -d" " -f1 > "$@.sha256sum"
|
|
|
|
[ ! -s "$(BUILD_KEY)" -o ! -s "$(BUILD_KEY).ucert" -o ! -s "$@" ] || { \
|
|
|
|
cp "$(BUILD_KEY).ucert" "$@.ucert" ;\
|
2023-03-11 03:56:35 +00:00
|
|
|
usign -S -m "$@" -s "$(BUILD_KEY)" -x "$@.sig" ;\
|
2023-05-19 08:31:36 +00:00
|
|
|
ucert -A -c "$@.ucert" -x "$@.sig" ;\
|
|
|
|
fwtool -S "$@.ucert" "$@" ;\
|
2023-03-11 03:56:35 +00:00
|
|
|
}
|
|
|
|
endef
|
|
|
|
|
2023-07-15 16:10:31 +00:00
|
|
|
define Build/zyxel-nwa-fit-filogic
|
|
|
|
$(TOPDIR)/scripts/mkits-zyxel-fit-filogic.sh \
|
|
|
|
$@.its $@ "80 e1 ff ff ff ff ff ff ff ff"
|
|
|
|
PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage -f $@.its $@.new
|
|
|
|
@mv $@.new $@
|
|
|
|
endef
|
|
|
|
|
2023-01-26 16:39:43 +00:00
|
|
|
define Device/asus_tuf-ax4200
|
|
|
|
DEVICE_VENDOR := ASUS
|
|
|
|
DEVICE_MODEL := TUF-AX4200
|
|
|
|
DEVICE_DTS := mt7986a-asus-tuf-ax4200
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
DEVICE_DTS_LOADADDR := 0x47000000
|
2023-03-29 07:48:30 +00:00
|
|
|
DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
|
2023-01-26 16:39:43 +00:00
|
|
|
IMAGES := sysupgrade.bin
|
2023-04-04 00:08:32 +00:00
|
|
|
KERNEL := kernel-bin | lzma | \
|
2023-01-26 16:39:43 +00:00
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += asus_tuf-ax4200
|
|
|
|
|
2022-07-13 03:30:32 +00:00
|
|
|
define Device/bananapi_bpi-r3
|
|
|
|
DEVICE_VENDOR := Bananapi
|
|
|
|
DEVICE_MODEL := BPi-R3
|
|
|
|
DEVICE_DTS := mt7986a-bananapi-bpi-r3
|
|
|
|
DEVICE_DTS_CONFIG := config-mt7986a-bananapi-bpi-r3
|
2023-06-04 14:56:15 +00:00
|
|
|
DEVICE_DTS_OVERLAY:= mt7986a-bananapi-bpi-r3-emmc mt7986a-bananapi-bpi-r3-nand mt7986a-bananapi-bpi-r3-nor mt7986a-bananapi-bpi-r3-sd
|
|
|
|
DEVICE_DTS_DIR := $(DTS_DIR)/
|
2023-03-10 20:05:18 +00:00
|
|
|
DEVICE_PACKAGES := kmod-hwmon-pwmfan kmod-i2c-gpio kmod-mt7986-firmware kmod-sfp kmod-usb3 e2fsprogs f2fsck mkf2fs mt7986-wo-firmware
|
2022-07-13 03:30:32 +00:00
|
|
|
IMAGES := sysupgrade.itb
|
2023-04-05 15:56:54 +00:00
|
|
|
KERNEL_LOADADDR := 0x44000000
|
2022-07-13 03:30:32 +00:00
|
|
|
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
|
|
|
ARTIFACTS := \
|
|
|
|
emmc-preloader.bin emmc-bl31-uboot.fip \
|
|
|
|
nor-preloader.bin nor-bl31-uboot.fip \
|
|
|
|
sdcard.img.gz \
|
|
|
|
snand-preloader.bin snand-bl31-uboot.fip
|
2023-04-25 15:06:20 +00:00
|
|
|
ARTIFACT/emmc-preloader.bin := mt7986-bl2 emmc-ddr4
|
|
|
|
ARTIFACT/emmc-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-emmc
|
|
|
|
ARTIFACT/nor-preloader.bin := mt7986-bl2 nor-ddr4
|
|
|
|
ARTIFACT/nor-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-nor
|
|
|
|
ARTIFACT/snand-preloader.bin := mt7986-bl2 spim-nand-ddr4
|
|
|
|
ARTIFACT/snand-bl31-uboot.fip := mt7986-bl31-uboot bananapi_bpi-r3-snand
|
2022-07-13 03:30:32 +00:00
|
|
|
ARTIFACT/sdcard.img.gz := mt7986-gpt sdmmc |\
|
2023-04-25 15:06:20 +00:00
|
|
|
pad-to 17k | mt7986-bl2 sdmmc-ddr4 |\
|
|
|
|
pad-to 6656k | mt7986-bl31-uboot bananapi_bpi-r3-sdmmc |\
|
2022-09-08 01:34:28 +00:00
|
|
|
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),\
|
|
|
|
pad-to 12M | append-image-stage initramfs-recovery.itb | check-size 44m |\
|
|
|
|
) \
|
2023-04-25 15:06:20 +00:00
|
|
|
pad-to 44M | mt7986-bl2 spim-nand-ddr4 |\
|
|
|
|
pad-to 45M | mt7986-bl31-uboot bananapi_bpi-r3-snand |\
|
|
|
|
pad-to 49M | mt7986-bl2 nor-ddr4 |\
|
|
|
|
pad-to 50M | mt7986-bl31-uboot bananapi_bpi-r3-nor |\
|
|
|
|
pad-to 51M | mt7986-bl2 emmc-ddr4 |\
|
|
|
|
pad-to 52M | mt7986-bl31-uboot bananapi_bpi-r3-emmc |\
|
2022-07-13 03:30:32 +00:00
|
|
|
pad-to 56M | mt7986-gpt emmc |\
|
2022-09-08 01:34:28 +00:00
|
|
|
$(if $(CONFIG_TARGET_ROOTFS_SQUASHFS),\
|
2023-05-26 09:26:49 +00:00
|
|
|
pad-to 64M | append-image squashfs-sysupgrade.itb | check-size |\
|
|
|
|
) \
|
|
|
|
gzip
|
2022-09-08 01:34:28 +00:00
|
|
|
IMAGE_SIZE := $$(shell expr 64 + $$(CONFIG_TARGET_ROOTFS_PARTSIZE))m
|
2022-07-13 03:30:32 +00:00
|
|
|
KERNEL := kernel-bin | gzip
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
|
|
IMAGE/sysupgrade.itb := append-kernel | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | pad-rootfs | append-metadata
|
2023-06-06 12:05:50 +00:00
|
|
|
DEVICE_DTC_FLAGS := --pad 4096
|
2023-06-04 14:56:15 +00:00
|
|
|
DEVICE_COMPAT_VERSION := 1.1
|
|
|
|
DEVICE_COMPAT_MESSAGE := Device tree overlay mechanism needs bootloader update
|
2022-07-13 03:30:32 +00:00
|
|
|
endef
|
|
|
|
TARGET_DEVICES += bananapi_bpi-r3
|
|
|
|
|
2023-05-17 13:55:42 +00:00
|
|
|
define Device/cudy_wr3000-v1
|
|
|
|
DEVICE_VENDOR := Cudy
|
|
|
|
DEVICE_MODEL := WR3000
|
|
|
|
DEVICE_VARIANT := v1
|
|
|
|
DEVICE_DTS := mt7981b-cudy-wr3000-v1
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
DEVICE_DTS_LOADADDR := 0x47000000
|
|
|
|
IMAGES := sysupgrade.bin
|
|
|
|
IMAGE_SIZE := 15424k
|
|
|
|
SUPPORTED_DEVICES += R31
|
|
|
|
KERNEL := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
|
|
IMAGE/sysupgrade.bin := append-kernel | pad-to 128k | append-rootfs | pad-rootfs | check-size | append-metadata
|
|
|
|
DEVICE_PACKAGES := kmod-mt7981-firmware
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += cudy_wr3000-v1
|
|
|
|
|
2023-03-11 03:56:35 +00:00
|
|
|
define Device/glinet_gl-mt3000
|
|
|
|
DEVICE_VENDOR := GL.iNet
|
|
|
|
DEVICE_MODEL := GL-MT3000
|
|
|
|
DEVICE_DTS := mt7981b-glinet-gl-mt3000
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
SUPPORTED_DEVICES += glinet,mt3000-snand
|
|
|
|
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware kmod-hwmon-pwmfan kmod-usb3
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
IMAGE_SIZE := 246272k
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += glinet_gl-mt3000
|
|
|
|
|
2023-05-21 15:00:16 +00:00
|
|
|
define Device/h3c_magic-nx30-pro
|
|
|
|
DEVICE_VENDOR := H3C
|
|
|
|
DEVICE_MODEL := Magic NX30 Pro
|
|
|
|
DEVICE_DTS := mt7981b-h3c-magic-nx30-pro
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
UBOOTENV_IN_UBI := 1
|
|
|
|
IMAGE_SIZE := 65536k
|
|
|
|
IMAGES := sysupgrade.itb
|
|
|
|
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
|
|
|
KERNEL := kernel-bin | gzip
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
|
|
IMAGE/sysupgrade.itb := append-kernel | \
|
|
|
|
fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
|
|
|
|
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
|
|
|
|
ARTIFACTS := preloader.bin bl31-uboot.fip
|
|
|
|
ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
|
|
|
|
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot h3c_magic-nx30-pro
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += h3c_magic-nx30-pro
|
|
|
|
|
2023-04-10 21:36:59 +00:00
|
|
|
define Device/netgear_wax220
|
|
|
|
DEVICE_VENDOR := Netgear
|
|
|
|
DEVICE_MODEL := WAX220
|
|
|
|
DEVICE_DTS := mt7986b-netgear-wax220
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
|
|
|
|
IMAGES := sysupgrade.bin
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
KERNEL := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += netgear_wax220
|
|
|
|
|
2022-10-29 21:03:08 +00:00
|
|
|
define Device/mediatek_mt7986a-rfb-nand
|
2022-07-06 12:06:30 +00:00
|
|
|
DEVICE_VENDOR := MediaTek
|
2022-10-29 21:03:08 +00:00
|
|
|
DEVICE_MODEL := MT7986 rfba AP (NAND)
|
|
|
|
DEVICE_DTS := mt7986a-rfb-spim-nand
|
2022-07-06 12:06:30 +00:00
|
|
|
DEVICE_DTS_DIR := $(DTS_DIR)/
|
2023-03-10 20:05:18 +00:00
|
|
|
DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
|
2022-10-29 21:03:08 +00:00
|
|
|
SUPPORTED_DEVICES := mediatek,mt7986a-rfb-snand
|
2022-07-06 12:06:30 +00:00
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
IMAGE_SIZE := 65536k
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
IMAGES += factory.bin
|
|
|
|
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
KERNEL = kernel-bin | lzma | \
|
2022-10-29 21:03:08 +00:00
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
|
2022-07-06 12:06:30 +00:00
|
|
|
KERNEL_INITRAMFS = kernel-bin | lzma | \
|
2022-10-29 21:03:08 +00:00
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
|
2022-07-06 12:06:30 +00:00
|
|
|
endef
|
2022-10-29 21:03:08 +00:00
|
|
|
TARGET_DEVICES += mediatek_mt7986a-rfb-nand
|
2022-07-06 12:06:30 +00:00
|
|
|
|
|
|
|
define Device/mediatek_mt7986b-rfb
|
|
|
|
DEVICE_VENDOR := MediaTek
|
|
|
|
DEVICE_MODEL := MTK7986 rfbb AP
|
|
|
|
DEVICE_DTS := mt7986b-rfb
|
|
|
|
DEVICE_DTS_DIR := $(DTS_DIR)/
|
2023-03-10 20:05:18 +00:00
|
|
|
DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
|
2022-07-06 12:06:30 +00:00
|
|
|
SUPPORTED_DEVICES := mediatek,mt7986b-rfb
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
IMAGE_SIZE := 65536k
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
IMAGES += factory.bin
|
|
|
|
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += mediatek_mt7986b-rfb
|
mediatek: add Xiaomi Redmi Router AX6000 support
Hardware specification:
SoC: MediaTek MT7986A 4x A53
Flash: ESMT F50L1G41LB 128 MB
RAM: K4A4G165WF-BCWE 512 MB
Ethernet: 4x 10/100/1000 Mbps
WiFi1: MT7976GN 2.4GHz ax 4x4
WiFi2: MT7976AN 5GHz ax 4x4
Button: Mesh, Reset
Flash instructions:
1. Gain ssh and serial port access, see the link below:
https://openwrt.org/toh/xiaomi/redmi_ax6000#installation
2. Use ssh or serial port to log in to the router, and
execute the following command:
nvram set boot_wait=on
nvram set flag_boot_rootfs=0
nvram set flag_boot_success=1
nvram set flag_last_success=1
nvram set flag_try_sys1_failed=8
nvram set flag_try_sys2_failed=8
nvram commit
3. Set a static ip on the ethernet interface of your computer
(e.g. default: ip 192.168.31.100, gateway 192.168.31.1)
4. Download the initramfs image, rename it to initramfs.bin,
and host it with the tftp server.
5. Interrupt U-Boot and run these commands:
setenv mtdparts nmbm0:1024k(bl2),256k(Nvram),256k(Bdata),2048k(factory),2048k(fip),256k(crash),256k(crash_log),112640k(ubi)
saveenv
tftpboot initramfs.bin
bootm
6. After openwrt boots up, use scp or luci web
to upload sysupgrade.bin to upgrade.
Revert to stock firmware:
Restore mtdparts back to default, then use the
vendor's recovery tool (Windows only).
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2022-09-18 15:16:18 +00:00
|
|
|
|
2023-02-19 02:18:36 +00:00
|
|
|
define Device/mediatek_mt7988a-rfb-nand
|
|
|
|
DEVICE_VENDOR := MediaTek
|
|
|
|
DEVICE_MODEL := MT7988a nand rfb
|
|
|
|
DEVICE_DTS := mt7988a-dsa-10g-spim-nand
|
|
|
|
DEVICE_DTS_DIR := $(DTS_DIR)/
|
|
|
|
KERNEL_LOADADDR := 0x48000000
|
|
|
|
SUPPORTED_DEVICES := mediatek,mt7988a-rfb
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
IMAGE_SIZE := 65536k
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
IMAGES += factory.bin
|
|
|
|
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += mediatek_mt7988a-rfb-nand
|
|
|
|
|
mediatek: add support for Mercusys MR90X v1
This commit adds support for Mercusys MR90X(EU) v1 router.
Device specification
--------------------
SoC Type: MediaTek MT7986BLA, Cortex-A53, 64-bit
RAM: MediaTek MT7986BLA (512MB)
Flash: SPI NAND GigaDevice GD5F1GQ5UEYIGY (128 MB)
Ethernet: MediaTek MT7531AE + 2.5GbE MaxLinear GPY211C0VC (SLNW8)
Ethernet: 1x2.5Gbe (WAN/LAN 2.5Gbps), 3xGbE (WAN/LAN 1Gbps, LAN1, LAN2)
WLAN 2g: MediaTek MT7975N, b/g/n/ax, MIMO 4x4
WLAN 5g: MediaTek MT7975P(N), a/n/ac/ax, MIMO 4x4
LEDs: 1 orange and 1 green status LEDs, 4 green gpio-controlled
LEDs on ethernet ports
Button: 1 (Reset)
USB ports: No
Power: 12 VDC, 2 A
Connector: Barrel
Bootloader: Main U-Boot - U-Boot 2022.01-rc4. Additionally, both UBI
slots contain "seconduboot" (also U-Boot 2022.01-rc4)
Serial console (UART)
---------------------
V
+-------+-------+-------+-------+
| +3.3V | GND | TX | RX |
+---+---+-------+-------+-------+
|
+--- Don't connect
The R3 (TX line) and R6 (RX line) are absent on the PCB. You should
solder them or solder the jumpers.
Installation (UART)
-------------------
1. Place OpenWrt initramfs image on tftp server with IP 192.168.1.2
2. Attach UART, switch on the router and interrupt the boot process by
pressing 'Ctrl-C'
3. Load and run OpenWrt initramfs image:
tftpboot initramfs-kernel.bin
bootm
4. Once inside OpenWrt, set / update env variables:
fw_setenv baudrate 115200
fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit"
fw_setenv fdtcontroladdr 5ffc0e70
fw_setenv ipaddr 192.168.1.1
fw_setenv loadaddr 0x46000000
fw_setenv mtdids "spi-nand0=spi-nand0"
fw_setenv mtdparts "spi-nand0:2M(boot),1M(u-boot-env),50M(ubi0),50M(ubi1),8M(userconfig),4M(tp_data)"
fw_setenv netmask 255.255.255.0
fw_setenv serverip 192.168.1.2
fw_setenv stderr serial@11002000
fw_setenv stdin serial@11002000
fw_setenv stdout serial@11002000
fw_setenv tp_boot_idx 0
5. Run 'sysupgrade -n' with the sysupgrade OpenWrt image
Installation (without UART)
---------------------------
1. Login as root via SSH (router IP, port 20001, password - your web
interface password)
2. Open for editing /etc/hotplug.d/iface/65-iptv (e.g., using WinSCP and
SSH settings from the p.1)
3. Add a newline after "#!/bin/sh":
telnetd -l /bin/login.sh
4. Save "65-iptv" file
5. Toggle "IPTV/VLAN Enable" checkbox in the router web interface and
save
6. Make sure that telnetd is running:
netstat -ltunp | grep 23
7. Login via telnet to router IP, port 23 (no username and password are
required)
8 Upload OpenWrt "initramfs-kernel.bin" to the "/tmp" folder of the
router (e.g., using WinSCP and SSH settings from the p.1)
9. Stock busybox doesn't contain ubiupdatevol command. Hence, we need to
download and upload the full version of busybox to the router. For
example, from here:
https://github.com/xerta555/Busybox-Binaries/raw/master/busybox-arm64
Upload busybox-arm64 to the /tmp dir of the router and run:
in the telnet shell:
cd /tmp
chmod a+x busybox-arm64
10. Check "initramfs-kernel.bin" size:
du -h initramfs-kernel.bin
11. Delete old and create new "kernel" volume with appropriate size
(greater than "initramfs-kernel.bin" size):
ubirmvol /dev/ubi0 -N kernel
ubimkvol /dev/ubi0 -n 1 -N kernel -s 9MiB
12. Write OpenWrt "initramfs-kernel.bin" to the flash:
./busybox-arm64 ubiupdatevol /dev/ubi0_1 /tmp/initramfs-kernel.bin
13. u-boot-env can be empty so lets create it (or overwrite it if it
already exists) with the necessary values:
fw_setenv baudrate 115200
fw_setenv bootargs "ubi.mtd=ubi0 console=ttyS0,115200n1 loglevel=8 earlycon=uart8250,mmio32,0x11002000 init=/etc/preinit"
fw_setenv fdtcontroladdr 5ffc0e70
fw_setenv ipaddr 192.168.1.1
fw_setenv loadaddr 0x46000000
fw_setenv mtdids "spi-nand0=spi-nand0"
fw_setenv mtdparts "spi-nand0:2M(boot),1M(u-boot-env),50M(ubi0),50M(ubi1),8M(userconfig),4M(tp_data)"
fw_setenv netmask 255.255.255.0
fw_setenv serverip 192.168.1.2
fw_setenv stderr serial@11002000
fw_setenv stdin serial@11002000
fw_setenv stdout serial@11002000
fw_setenv tp_boot_idx 0
14. Reboot to OpenWrt initramfs:
reboot
15. Login as root via SSH (IP 192.168.1.1, port 22)
16. Upload OpenWrt sysupgrade.bin image to the /tmp dir of the router
17. Run sysupgrade:
sysupgrade -n /tmp/sysupgrade.bin
Recovery
--------
1. Press Reset button and power on the router
2. Navigate to U-Boot recovery web server (http://192.168.1.1/) and
upload the OEM firmware
Recovery (UART)
---------------
1. Place OpenWrt initramfs image on tftp server with IP 192.168.1.2
2. Attach UART, switch on the router and interrupt the boot process by
pressing 'Ctrl-C'
3. Load and run OpenWrt initramfs image:
tftpboot initramfs-kernel.bin
bootm
4. Do what you need (restore partitions from a backup, install OpenWrt
etc.)
Stock layout
------------
0x000000000000-0x000000200000 : "boot"
0x000000200000-0x000000300000 : "u-boot-env"
0x000000300000-0x000003500000 : "ubi0"
0x000003500000-0x000006700000 : "ubi1"
0x000006700000-0x000006f00000 : "userconfig"
0x000006f00000-0x000007300000 : "tp_data"
ubi0/ubi1 format
----------------
U-Boot at boot checks that all volumes are in place:
+-------------------------------+
| Volume Name: uboot Vol ID: 0|
| Volume Name: kernel Vol ID: 1|
| Volume Name: rootfs Vol ID: 2|
+-------------------------------+
MAC addresses
-------------
+---------+-------------------+-----------+
| | MAC | Algorithm |
+---------+-------------------+-----------+
| label | 00:eb:xx:xx:xx:be | label |
| LAN | 00:eb:xx:xx:xx:be | label |
| WAN | 00:eb:xx:xx:xx:bf | label+1 |
| WLAN 2g | 00:eb:xx:xx:xx:be | label |
| WLAN 5g | 00:eb:xx:xx:xx:bd | label-1 |
+---------+-------------------+-----------+
label MAC address was found in UBI partition "tp_data", file
"default-mac". OEM wireless eeprom is also there (file
"MT7986_EEPROM.bin").
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
2023-05-13 13:51:45 +00:00
|
|
|
define Device/mercusys_mr90x-v1
|
|
|
|
DEVICE_VENDOR := Mercusys
|
|
|
|
DEVICE_MODEL := MR90X v1
|
|
|
|
DEVICE_DTS := mt7986b-mercusys-mr90x-v1
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
IMAGE_SIZE := 51200k
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += mercusys_mr90x-v1
|
|
|
|
|
mediatek: filogic: add Qihoo 360T7 support
Hardware specification:
SoC: MediaTek MT7981B 2x A53
Flash: ESMT F50L1G41LB 128MB
RAM: MT5CC128M16JR-EK 256MB
Ethernet: 4x 10/100/1000 Mbps
Switch: MediaTek MT7531AE
WiFi: MediaTek MT7976C
Button: Reset, WPS
Power: DC 12V 1A
Flash instructions:
1. Attach UART, boot the stock firmware until
the message about failsafe mode appears.
2. Enter failsafe mode by pressing "f" and "Enter"
3. Type "mount_root", then run
"fw_setenv bootmenu_delay 3"
4. Back up all mtd partitions before flashing.
5. Reboot, U-Boot now presents a menu.
6. Connect to your PC via the Gigabit port of the router,
set a static ip on the ethernet interface of your PC.
(ip 192.168.1.254, gateway 192.168.1.1)
7. Select "Upgrade ATF BL2", then use this file:
openwrt-mediatek-filogic-qihoo_360t7-preloader.bin
8. Select "Upgrade ATF FIP", then use this file:
openwrt-mediatek-filogic-qihoo_360t7-bl31-uboot.fip
9. Download the initramfs image, and type "reset",
waiting for tftp recovery to complete.
a. After openwrt boots up, perform sysupgrade.
Note:
1. Since NMBM is disabled, we must back up all partitions.
2. Flash instructions is based on commit 28df7f7.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
2023-04-29 15:08:26 +00:00
|
|
|
define Device/qihoo_360t7
|
|
|
|
DEVICE_VENDOR := Qihoo
|
|
|
|
DEVICE_MODEL := 360T7
|
|
|
|
DEVICE_DTS := mt7981b-qihoo-360t7
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
UBOOTENV_IN_UBI := 1
|
|
|
|
IMAGES := sysupgrade.itb
|
|
|
|
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
|
|
|
KERNEL := kernel-bin | gzip
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
|
|
IMAGE/sysupgrade.itb := append-kernel | \
|
|
|
|
fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
|
|
|
|
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware
|
|
|
|
ARTIFACTS := preloader.bin bl31-uboot.fip
|
|
|
|
ARTIFACT/preloader.bin := mt7981-bl2 spim-nand-ddr3
|
|
|
|
ARTIFACT/bl31-uboot.fip := mt7981-bl31-uboot qihoo_360t7
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += qihoo_360t7
|
|
|
|
|
mediatek: add support for TP-Link TL-XDR4288/608x
Hardware specification:
SoC: MediaTek MT7986A 4x A53
Flash: ESMT F50L1G41LB 128MB
RAM: ESMT M15T4G16256A 512MB
Ethernet (Max Speed):
XDR4288: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
XDR6086: 1x 2.5G Wan, 1x 2.5G Lan, 1x 1G Lan
XDR6088: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
WiFi:
XDR4288: MT7976DAN (2.4G 2T2R, 5G 3T3R)
XDR6086/XDR6088:
WiFi1: MT7976GN 2.4GHz 4T4R
WiFi2: MT7976AN 5GHz 4T4R
Button: Reset, WPS, Turbo
USB: 1 x USB 3.0
Power: DC 12V 4A
Flash instructions:
1. Execute the following operation to open nc shell:
https://openwrt.org/inbox/toh/tp-link/xdr-6086#rooting
2. Replace the stock bootloader to OpenWrt's:
dd bs=131072 conv=sync of=/dev/mtdblock9 if=/tmp/xxx-preloader.bin
dd bs=131072 conv=sync of=/dev/mtdblock9 seek=28 if=/tmp/xxx-bl31-uboot.fip
3. Connect to your PC via the Gigabit port of the router,
set a static ip on the ethernet interface of your PC.
(ip 192.168.1.254, gateway 192.168.1.1)
4. Download the initramfs image, and restart the router,
waiting for tftp recovery to complete.
5. After openwrt boots up, perform sysupgrade.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
[Add uboot build, fit and sysupgrade support, fix RealTek PHYs]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-02-10 15:08:25 +00:00
|
|
|
define Device/tplink_tl-xdr-common
|
|
|
|
DEVICE_VENDOR := TP-Link
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
UBOOTENV_IN_UBI := 1
|
|
|
|
IMAGES := sysupgrade.itb
|
|
|
|
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
|
|
|
KERNEL := kernel-bin | gzip
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
|
|
IMAGE/sysupgrade.itb := append-kernel | \
|
|
|
|
fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
|
|
|
|
DEVICE_PACKAGES := kmod-usb3 kmod-mt7986-firmware mt7986-wo-firmware
|
|
|
|
ARTIFACTS := preloader.bin bl31-uboot.fip
|
2023-05-27 20:49:55 +00:00
|
|
|
ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr3
|
mediatek: add support for TP-Link TL-XDR4288/608x
Hardware specification:
SoC: MediaTek MT7986A 4x A53
Flash: ESMT F50L1G41LB 128MB
RAM: ESMT M15T4G16256A 512MB
Ethernet (Max Speed):
XDR4288: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
XDR6086: 1x 2.5G Wan, 1x 2.5G Lan, 1x 1G Lan
XDR6088: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
WiFi:
XDR4288: MT7976DAN (2.4G 2T2R, 5G 3T3R)
XDR6086/XDR6088:
WiFi1: MT7976GN 2.4GHz 4T4R
WiFi2: MT7976AN 5GHz 4T4R
Button: Reset, WPS, Turbo
USB: 1 x USB 3.0
Power: DC 12V 4A
Flash instructions:
1. Execute the following operation to open nc shell:
https://openwrt.org/inbox/toh/tp-link/xdr-6086#rooting
2. Replace the stock bootloader to OpenWrt's:
dd bs=131072 conv=sync of=/dev/mtdblock9 if=/tmp/xxx-preloader.bin
dd bs=131072 conv=sync of=/dev/mtdblock9 seek=28 if=/tmp/xxx-bl31-uboot.fip
3. Connect to your PC via the Gigabit port of the router,
set a static ip on the ethernet interface of your PC.
(ip 192.168.1.254, gateway 192.168.1.1)
4. Download the initramfs image, and restart the router,
waiting for tftp recovery to complete.
5. After openwrt boots up, perform sysupgrade.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
[Add uboot build, fit and sysupgrade support, fix RealTek PHYs]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-02-10 15:08:25 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Device/tplink_tl-xdr4288
|
|
|
|
DEVICE_MODEL := TL-XDR4288
|
|
|
|
DEVICE_DTS := mt7986a-tplink-tl-xdr4288
|
2023-05-27 20:49:55 +00:00
|
|
|
ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr4288
|
mediatek: add support for TP-Link TL-XDR4288/608x
Hardware specification:
SoC: MediaTek MT7986A 4x A53
Flash: ESMT F50L1G41LB 128MB
RAM: ESMT M15T4G16256A 512MB
Ethernet (Max Speed):
XDR4288: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
XDR6086: 1x 2.5G Wan, 1x 2.5G Lan, 1x 1G Lan
XDR6088: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
WiFi:
XDR4288: MT7976DAN (2.4G 2T2R, 5G 3T3R)
XDR6086/XDR6088:
WiFi1: MT7976GN 2.4GHz 4T4R
WiFi2: MT7976AN 5GHz 4T4R
Button: Reset, WPS, Turbo
USB: 1 x USB 3.0
Power: DC 12V 4A
Flash instructions:
1. Execute the following operation to open nc shell:
https://openwrt.org/inbox/toh/tp-link/xdr-6086#rooting
2. Replace the stock bootloader to OpenWrt's:
dd bs=131072 conv=sync of=/dev/mtdblock9 if=/tmp/xxx-preloader.bin
dd bs=131072 conv=sync of=/dev/mtdblock9 seek=28 if=/tmp/xxx-bl31-uboot.fip
3. Connect to your PC via the Gigabit port of the router,
set a static ip on the ethernet interface of your PC.
(ip 192.168.1.254, gateway 192.168.1.1)
4. Download the initramfs image, and restart the router,
waiting for tftp recovery to complete.
5. After openwrt boots up, perform sysupgrade.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
[Add uboot build, fit and sysupgrade support, fix RealTek PHYs]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-02-10 15:08:25 +00:00
|
|
|
$(call Device/tplink_tl-xdr-common)
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += tplink_tl-xdr4288
|
|
|
|
|
|
|
|
define Device/tplink_tl-xdr6086
|
|
|
|
DEVICE_MODEL := TL-XDR6086
|
|
|
|
DEVICE_DTS := mt7986a-tplink-tl-xdr6086
|
2023-05-27 20:49:55 +00:00
|
|
|
ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr6086
|
mediatek: add support for TP-Link TL-XDR4288/608x
Hardware specification:
SoC: MediaTek MT7986A 4x A53
Flash: ESMT F50L1G41LB 128MB
RAM: ESMT M15T4G16256A 512MB
Ethernet (Max Speed):
XDR4288: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
XDR6086: 1x 2.5G Wan, 1x 2.5G Lan, 1x 1G Lan
XDR6088: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
WiFi:
XDR4288: MT7976DAN (2.4G 2T2R, 5G 3T3R)
XDR6086/XDR6088:
WiFi1: MT7976GN 2.4GHz 4T4R
WiFi2: MT7976AN 5GHz 4T4R
Button: Reset, WPS, Turbo
USB: 1 x USB 3.0
Power: DC 12V 4A
Flash instructions:
1. Execute the following operation to open nc shell:
https://openwrt.org/inbox/toh/tp-link/xdr-6086#rooting
2. Replace the stock bootloader to OpenWrt's:
dd bs=131072 conv=sync of=/dev/mtdblock9 if=/tmp/xxx-preloader.bin
dd bs=131072 conv=sync of=/dev/mtdblock9 seek=28 if=/tmp/xxx-bl31-uboot.fip
3. Connect to your PC via the Gigabit port of the router,
set a static ip on the ethernet interface of your PC.
(ip 192.168.1.254, gateway 192.168.1.1)
4. Download the initramfs image, and restart the router,
waiting for tftp recovery to complete.
5. After openwrt boots up, perform sysupgrade.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
[Add uboot build, fit and sysupgrade support, fix RealTek PHYs]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-02-10 15:08:25 +00:00
|
|
|
$(call Device/tplink_tl-xdr-common)
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += tplink_tl-xdr6086
|
|
|
|
|
|
|
|
define Device/tplink_tl-xdr6088
|
|
|
|
DEVICE_MODEL := TL-XDR6088
|
|
|
|
DEVICE_DTS := mt7986a-tplink-tl-xdr6088
|
2023-05-27 20:49:55 +00:00
|
|
|
ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot tplink_tl-xdr6088
|
mediatek: add support for TP-Link TL-XDR4288/608x
Hardware specification:
SoC: MediaTek MT7986A 4x A53
Flash: ESMT F50L1G41LB 128MB
RAM: ESMT M15T4G16256A 512MB
Ethernet (Max Speed):
XDR4288: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
XDR6086: 1x 2.5G Wan, 1x 2.5G Lan, 1x 1G Lan
XDR6088: 1x 2.5G Wan, 1x 2.5G Lan, 4x 1G Lan
WiFi:
XDR4288: MT7976DAN (2.4G 2T2R, 5G 3T3R)
XDR6086/XDR6088:
WiFi1: MT7976GN 2.4GHz 4T4R
WiFi2: MT7976AN 5GHz 4T4R
Button: Reset, WPS, Turbo
USB: 1 x USB 3.0
Power: DC 12V 4A
Flash instructions:
1. Execute the following operation to open nc shell:
https://openwrt.org/inbox/toh/tp-link/xdr-6086#rooting
2. Replace the stock bootloader to OpenWrt's:
dd bs=131072 conv=sync of=/dev/mtdblock9 if=/tmp/xxx-preloader.bin
dd bs=131072 conv=sync of=/dev/mtdblock9 seek=28 if=/tmp/xxx-bl31-uboot.fip
3. Connect to your PC via the Gigabit port of the router,
set a static ip on the ethernet interface of your PC.
(ip 192.168.1.254, gateway 192.168.1.1)
4. Download the initramfs image, and restart the router,
waiting for tftp recovery to complete.
5. After openwrt boots up, perform sysupgrade.
Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
[Add uboot build, fit and sysupgrade support, fix RealTek PHYs]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2023-02-10 15:08:25 +00:00
|
|
|
$(call Device/tplink_tl-xdr-common)
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += tplink_tl-xdr6088
|
|
|
|
|
mediatek: add alternative stock layout for Xiaomi Redmi Router AX6000
In this implementation, the flash partition layout is adjusted to avoid
modifying the uboot environment of mtdparts. This ensures that the 30M
ubi_kernel partition remains aligned with the stock ubi partition, and
the kernel volume is placed in it. This allows the stock uboot to boot
from it without changing the mtdparts, which is useful for reverting back
to the stock firmware using Xiaomi Firmware Tools. In actual testing,
modifying mtdparts has been found to break Xiaomi Firmware Tools.
1. use ARTIFACTS to generate initramfs-factory.ubi for easy installation.
2. The NAND flash layout is changed to allow for reverting back to the
stock firmware.
3. Before performing sysupgrade, do some cleanup in platform_pre_upgrade
to ensure a clean installation of OpenWRT.
4. Setup the uboot env to ensure that the system always boot, which can
be helpful for users who may forget to do this before sysupgrade in
the initramfs.
New flash instructions:
1. Gain ssh access. Please refer to:
https://openwrt.org/toh/xiaomi/redmi_ax6000#installation)
2. Check which system current u-boot is loading from:
COMMAND: `cat /proc/cmdline`
sample OUTPUT: `console=ttyS0,115200n1 loglevel=8 firmware=1 uart_en=1`
if firmware=1, current system is ubi1
if firmware=0, current system is ubi0
3. Setup nvram and write the firmware:
If the current system is ubi1, please set it up so that the next time
it will boot from ubi, and write the firmware to ubi:
```
nvram set boot_wait=on
nvram set uart_en=1
nvram set flag_boot_rootfs=0
nvram set flag_last_success=0
nvram set flag_boot_success=1
nvram set flag_try_sys1_failed=0
nvram set flag_try_sys2_failed=0
nvram commit
ubiformat /dev/mtd8 -y -f /tmp/initramfs-factory.ubi
```
If the current system is ubi, please set it up so that the next time
it will boot from ubi1, and write the firmware to ubi1:
```
nvram set boot_wait=on
nvram set uart_en=1
nvram set flag_boot_rootfs=1
nvram set flag_last_success=1
nvram set flag_boot_success=1
nvram set flag_try_sys1_failed=0
nvram set flag_try_sys2_failed=0
nvram commit
ubiformat /dev/mtd9 -y -f /tmp/initramfs-factory.ubi
```
4. After rebooting, the system should now boot into the openwrt initramfs.
Flash the squashfs-sysupgrade.bin via using ssh or luci.
```
sysupgrade -n /tmp/squashfs-sysupgrade.bin
```
Done.
For existing users of the Redmi AX6000 running OpenWrt, here are the steps to
switch to this new layout:
1. Flash initramfs-factory.ubi
```
mtd -r -e ubi write /tmp/initramfs-factory.ubi ubi
```
2. After rebooting, the system will boot into the new openwrt-initramfs.
Log in and perform a sysupgrade to complete the process.
```
sysupgrade -n /tmp/squashfs-sysupgrade.bin
```
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2022-09-13 05:46:20 +00:00
|
|
|
define Device/xiaomi_redmi-router-ax6000-stock
|
|
|
|
DEVICE_VENDOR := Xiaomi
|
|
|
|
DEVICE_MODEL := Redmi Router AX6000 (stock layout)
|
|
|
|
DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000-stock
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
2023-03-10 20:05:18 +00:00
|
|
|
DEVICE_PACKAGES := kmod-leds-ws2812b kmod-mt7986-firmware mt7986-wo-firmware
|
mediatek: add alternative stock layout for Xiaomi Redmi Router AX6000
In this implementation, the flash partition layout is adjusted to avoid
modifying the uboot environment of mtdparts. This ensures that the 30M
ubi_kernel partition remains aligned with the stock ubi partition, and
the kernel volume is placed in it. This allows the stock uboot to boot
from it without changing the mtdparts, which is useful for reverting back
to the stock firmware using Xiaomi Firmware Tools. In actual testing,
modifying mtdparts has been found to break Xiaomi Firmware Tools.
1. use ARTIFACTS to generate initramfs-factory.ubi for easy installation.
2. The NAND flash layout is changed to allow for reverting back to the
stock firmware.
3. Before performing sysupgrade, do some cleanup in platform_pre_upgrade
to ensure a clean installation of OpenWRT.
4. Setup the uboot env to ensure that the system always boot, which can
be helpful for users who may forget to do this before sysupgrade in
the initramfs.
New flash instructions:
1. Gain ssh access. Please refer to:
https://openwrt.org/toh/xiaomi/redmi_ax6000#installation)
2. Check which system current u-boot is loading from:
COMMAND: `cat /proc/cmdline`
sample OUTPUT: `console=ttyS0,115200n1 loglevel=8 firmware=1 uart_en=1`
if firmware=1, current system is ubi1
if firmware=0, current system is ubi0
3. Setup nvram and write the firmware:
If the current system is ubi1, please set it up so that the next time
it will boot from ubi, and write the firmware to ubi:
```
nvram set boot_wait=on
nvram set uart_en=1
nvram set flag_boot_rootfs=0
nvram set flag_last_success=0
nvram set flag_boot_success=1
nvram set flag_try_sys1_failed=0
nvram set flag_try_sys2_failed=0
nvram commit
ubiformat /dev/mtd8 -y -f /tmp/initramfs-factory.ubi
```
If the current system is ubi, please set it up so that the next time
it will boot from ubi1, and write the firmware to ubi1:
```
nvram set boot_wait=on
nvram set uart_en=1
nvram set flag_boot_rootfs=1
nvram set flag_last_success=1
nvram set flag_boot_success=1
nvram set flag_try_sys1_failed=0
nvram set flag_try_sys2_failed=0
nvram commit
ubiformat /dev/mtd9 -y -f /tmp/initramfs-factory.ubi
```
4. After rebooting, the system should now boot into the openwrt initramfs.
Flash the squashfs-sysupgrade.bin via using ssh or luci.
```
sysupgrade -n /tmp/squashfs-sysupgrade.bin
```
Done.
For existing users of the Redmi AX6000 running OpenWrt, here are the steps to
switch to this new layout:
1. Flash initramfs-factory.ubi
```
mtd -r -e ubi write /tmp/initramfs-factory.ubi ubi
```
2. After rebooting, the system will boot into the new openwrt-initramfs.
Log in and perform a sysupgrade to complete the process.
```
sysupgrade -n /tmp/squashfs-sysupgrade.bin
```
Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2022-09-13 05:46:20 +00:00
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
|
|
|
|
ARTIFACTS := initramfs-factory.ubi
|
|
|
|
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-kernel.bin | ubinize-kernel
|
|
|
|
endif
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += xiaomi_redmi-router-ax6000-stock
|
2022-12-22 02:40:26 +00:00
|
|
|
|
|
|
|
define Device/xiaomi_redmi-router-ax6000-ubootmod
|
|
|
|
DEVICE_VENDOR := Xiaomi
|
|
|
|
DEVICE_MODEL := Redmi Router AX6000 (OpenWrt U-Boot layout)
|
|
|
|
DEVICE_DTS := mt7986a-xiaomi-redmi-router-ax6000-ubootmod
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
2023-03-10 20:05:18 +00:00
|
|
|
DEVICE_PACKAGES := kmod-leds-ws2812b kmod-mt7986-firmware mt7986-wo-firmware
|
2022-12-22 02:40:26 +00:00
|
|
|
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
|
|
|
|
IMAGES := sysupgrade.itb
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
UBOOTENV_IN_UBI := 1
|
|
|
|
KERNEL := kernel-bin | gzip
|
|
|
|
KERNEL_INITRAMFS := kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
|
|
|
|
IMAGE/sysupgrade.itb := append-kernel | \
|
|
|
|
fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb external-static-with-rootfs | append-metadata
|
|
|
|
ARTIFACTS := preloader.bin bl31-uboot.fip
|
2023-05-27 20:49:55 +00:00
|
|
|
ARTIFACT/preloader.bin := mt7986-bl2 spim-nand-ddr4
|
|
|
|
ARTIFACT/bl31-uboot.fip := mt7986-bl31-uboot xiaomi_redmi-router-ax6000
|
2022-12-22 02:40:26 +00:00
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
|
|
|
|
ARTIFACTS += initramfs-factory.ubi
|
|
|
|
ARTIFACT/initramfs-factory.ubi := append-image-stage initramfs-recovery.itb | ubinize-kernel
|
|
|
|
endif
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += xiaomi_redmi-router-ax6000-ubootmod
|
mediatek: add support for Zyxel EX5601-T0 router
Zyxel EX5601-T0 specifics
--------------
The operator specific firmware running on the Zyxel branded
EX5601-T0 includes U-Boot modifications affecting the OpenWrt
installation.
Partition Table
| dev | size | erasesize | name |
| ---- | -------- | --------- | ------------- |
| mtd0 | 20000000 | 00040000 | "spi0.1" |
| mtd1 | 00100000 | 00040000 | "BL2" |
| mtd2 | 00080000 | 00040000 | "u-boot-env" |
| mtd3 | 00200000 | 00040000 | "Factory" |
| mtd4 | 001c0000 | 00040000 | "FIP" |
| mtd5 | 00040000 | 00040000 | "zloader" |
| mtd6 | 04000000 | 00040000 | "ubi" |
| mtd7 | 04000000 | 00040000 | "ubi2" |
| mtd8 | 15a80000 | 00040000 | "zyubi" |
The router boots BL2 which than loads FIP (u-boot).
U-boot has hardcoded a command to always launch Zloader "mtd read zloader 0x46000000" and than "bootm". Bootargs are deactivated.
Zloader is the zyxel booloader which allow to dual-boot ubi or ubi2, by default access to zloader is blocked.
Too zloader checks that the firmware contains a particolar file called zyfwinfo.
Additional details regarding Zloader can be found here:
https://hack-gpon.github.io/zyxel/
https://forum.openwrt.org/t/adding-openwrt-support-for-zyxel-ex5601-t0/155914
Hardware
--------
SOC: MediaTek MT7986a
CPU: 4 core cortex-a53 (2000MHz)
RAM: 1GB DDR4
FLASH: 512MB SPI-NAND (Micron xxx)
WIFI: Wifi6 Mediatek MT7976 802.11ax 5 GHz 4x4 + 2.4GHZ 4x4
ETH: MediaTek MT7531 Switch + SoC
3 x builtin 1G phy (lan1, lan2, lan3)
1 x MaxLinear GPY211B 2.5 N-Base-T phy5 (lan4)
1 x MaxLinear GPY211B 2.5Gbit xor SFP/N-Base-T phy6 (wan)
USB: 1 x USB 3.2 Enhanced SuperSpeed port
UART: 3V3 115200 8N1 (Pinout: GND KEY RX TX VCC)
VOIP: 2 FXS ports for analog phones
MAC Address Table
-----------------
eth0/lan Factory 0x002a
eth1/wan Factory 0x0024
wifi 2.4Ghz Factory 0x0004
wifi 5Ghz Factory 0x0004 + 1
Serial console (UART)
---------------------
+-------+-------+-------+-------+-------+
| +3.3V | RX | TX | KEY | GND |
+---+---+-------+-------+-------+-------+
|
+--- Don't connect
Installation
------------
Keep in mind that openwrt can only run on the UBI partition, the openwrt firmware is not able to understand the zloader bootargs.
The procedure allows restoring the UBI partition with the Zyxel firmware and retains all the OEM functionalities.
1. Unlock Zloader (this will allow to swap manually between partitions UBI and UBI2):
- Attach a usb-ttl adapter to your computer and boot the router.
- While the router is booting at some point you will read the following: `Please press Enter to activate this console.`
- As soon as you read that press enter, type root and than press enter again (just do it, don't care about the logs scrolling).
- Most likely the router is still printing the boot log, leave it boot until it stops.
- If everything went ok you should have full root access "root@EX5601-T0:/#".
- Type the following command and press enter: "fw_setenv EngDebugFlag 0x1".
- Reboot the router.
- As soon as you read `Hit any key to stop autoboot:` press Enter.
- If everything went ok you should have the following prompt: "ZHAL>".
- You have successfully unlocked zloader access, this procedure must be done only once.
2. Check the current active partition:
- Boot the router and repeat the steps above to gain root access.
- Type the following command to check the current active image: "cat /proc/cmdline".
- If `rootubi=ubi` it means that the active partition is `mtd6`
- If `rootubi=ubi2` it means that the active partition is `mtd7`
- As mentioned earlier we need to flash openwrt into ubi/mtd6 and never overwrite ubi2/mtd7 to be able to fully roll-back.
- To activate and boot from mtd7 (ubi2) enter into ZHAL> command prompt and type the following commands:
atbt 1 # unlock write
atsw # swap boot partition
atsr # reboot the router
- After rebooting check again with "cat /proc/cmdline" that you are correctly booting from mtd7/ubi2
- If yes proceed with the installation guide. If not probably you don't have a firmware into ubi2 or you did something wrong.
3. Flashing:
- Download the sysupgrade file for the router from openwrt, than we need to add the zyfwinfo file into the sysupgrade tar.
Zloader only checks for the magic (which is a fixed value 'EXYZ') and the crc of the file itself (256bytes).
I created a script to create a valid zyfwinfo file but you can use anything that does exactly the same:
https://raw.githubusercontent.com/pameruoso/OpenWRT-Zyxel-EX5601-T0/main/gen_zyfwinfo.sh
- Add the zyfwinfo file into the sysupgrade tar.
- Enter via telnet or ssh into the router with admin credentials
- Enter the following commands to disable the firmware and model checks
"zycli fwidcheck off" and "zycli modelcheck off"
- Open the router web interface and in the update firmware page select the "restore default settings option"
- Select the sysupgrade file and click on upload.
- The router will flash and reboot itself into openwrt from UBI
4. Restoring and going back to Zyxel firmware.
- Use the ZHAL> command line to manually swap the boot parition to UBI2 with the following:
atbt 1 # unlock write
atsw # swap boot partition
atsr # reboot the router
- You will boot again the Zyxel firmware you have into UBI2 and you can flash the zyxel firmware to overwrite the UBI partition and openwrt.
Working features
----------------
3 gbit lan ports
Wifi
Zyxel partitioning for coexistance with Zloader and dual boot.
WAN SFP port (only after exporting pins 57 and 10. gpiobase411)
leds
reset button
serial interface
usb port
lan ethernet 2.5 gbit port (autosense)
wan ethernet 2.5 gbit port (autosense)
Not working
----------------
voip (missing drivers or proper zyxel platform software)
Swapping the wan ethernet/sfp xor port
----------------
The way to swap the wan port between sfp and ethernet is the following:
export the pins 57 and 10.
Pin 57 is used to probe if an sfp is present.
If pin 57 value is 0 it means that an sfp is present into the cage (cat /sys/class/gpio/gpio468/value).
If pin 57 value is 1 it means that no sfp is inserted into the cage.
In conclusion by default both 57 an 10 pins are by default 1, which means that the active port is the ethernet one.
After inserting an SFP pin 57 will become 0 and you have to manually change the value of pin 10 to 0 too.
This is totally scriptable of course.
Leds description
------------
All the leds are working out of the box but the leds managed by the 2 maxlinear phy (phy 5 lan, phy6 wan).
To activate the phy5 led (rj45 ethernet port led on the back of the router) you have to use mdio-tools.
To activate the phy6 led (led on the front of the router for 2.5gbit link) you have to use mdio-tools.
Example:
Set lan5 led to fast blink on 2500/1000, slow blink on 10/100:
mdio mdio-bus mmd 5:30 raw 0x0001 0x33FC
Set wan 2.5gbit led to constant on when wan is 2.5gbit:
mdio mdio-bus mmd 6:30 raw 0x0001 0x0080
Signed-off-by: Pietro Ameruoso <p.ameruoso@live.it>
2023-05-22 07:52:47 +00:00
|
|
|
|
|
|
|
define Device/zyxel_ex5601-t0-stock
|
|
|
|
DEVICE_VENDOR := Zyxel
|
|
|
|
DEVICE_MODEL := EX5601-T0 (stock layout)
|
|
|
|
DEVICE_DTS := mt7986a-zyxel-ex5601-t0-stock
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
|
|
|
|
SUPPORTED_DEVICES := mediatek,mt7986a-rfb-snand
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 256k
|
|
|
|
PAGESIZE := 4096
|
|
|
|
IMAGE_SIZE := 65536k
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
IMAGES += factory.bin
|
|
|
|
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE)
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
KERNEL = kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
|
|
|
|
KERNEL_INITRAMFS = kernel-bin | lzma | \
|
|
|
|
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += zyxel_ex5601-t0-stock
|
2023-07-15 16:10:31 +00:00
|
|
|
|
|
|
|
define Device/zyxel_nwa50ax-pro
|
|
|
|
DEVICE_VENDOR := ZyXEL
|
|
|
|
DEVICE_MODEL := NWA50AX Pro
|
|
|
|
DEVICE_DTS := mt7981b-zyxel-nwa50ax-pro
|
|
|
|
DEVICE_DTS_DIR := ../dts
|
|
|
|
DEVICE_PACKAGES := kmod-mt7981-firmware mt7981-wo-firmware zyxel-bootconfig
|
|
|
|
DEVICE_DTS_LOADADDR := 0x44000000
|
|
|
|
UBINIZE_OPTS := -E 5
|
|
|
|
BLOCKSIZE := 128k
|
|
|
|
PAGESIZE := 2048
|
|
|
|
IMAGE_SIZE := 51200k
|
|
|
|
KERNEL_IN_UBI := 1
|
|
|
|
IMAGES += factory.bin
|
|
|
|
IMAGE/factory.bin := append-ubi | check-size $$$$(IMAGE_SIZE) | zyxel-nwa-fit-filogic
|
|
|
|
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
|
|
|
endef
|
|
|
|
TARGET_DEVICES += zyxel_nwa50ax-pro
|