diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index 7c6a19e5a79..c419bcdbe33 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -278,6 +278,18 @@ define U-Boot/mt7981_cudy_tr3000-v1 DEPENDS:=+trusted-firmware-a-mt7981-cudy-tr3000-v1 endef +define U-Boot/mt7981_glinet_gl-mt2500 + NAME:=GL.iNet GL-MT2500 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=glinet_gl-mt2500 + UBOOT_CONFIG:=mt7981_glinet_gl-mt2500 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=emmc + BL2_SOC:=mt7981 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7981-emmc-ddr4 +endef + define U-Boot/mt7981_glinet_gl-x3000 NAME:=GL.iNet GL-X3000 BUILD_SUBTARGET:=filogic @@ -908,6 +920,7 @@ UBOOT_TARGETS := \ mt7981_cmcc_rax3000m-nand \ mt7981_cudy_tr3000-v1 \ mt7981_gatonetworks_gdsp \ + mt7981_glinet_gl-mt2500 \ mt7981_glinet_gl-x3000 \ mt7981_glinet_gl-xe3000 \ mt7981_h3c_magic-nx30-pro \ diff --git a/package/boot/uboot-mediatek/patches/464-add-GL.iNet-GL-MT2500-Brume2.patch b/package/boot/uboot-mediatek/patches/464-add-GL.iNet-GL-MT2500-Brume2.patch new file mode 100644 index 00000000000..4cc4648a9a8 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/464-add-GL.iNet-GL-MT2500-Brume2.patch @@ -0,0 +1,304 @@ +From d7ab46cf532c9ca8599cbe654e9b41ca96629905 Mon Sep 17 00:00:00 2001 +From: Enrico Mioso +Date: Sun, 15 Jun 2025 17:35:39 +0200 +Subject: [PATCH] add GL.iNet GL-MT2500 (Brume2) + +Signed-off-by: Enrico Mioso +--- + arch/arm/dts/mt7981-glinet-gl-mt2500.dts | 120 ++++++++++++++++++++++ + configs/mt7981_glinet_gl-mt2500_defconfig | 113 ++++++++++++++++++++ + defenvs/glinet_gl-mt2500_env | 38 +++++++ + 3 files changed, 271 insertions(+) + create mode 100644 arch/arm/dts/mt7981-glinet-gl-mt2500.dts + create mode 100644 configs/mt7981_glinet_gl-mt2500_defconfig + create mode 100644 defenvs/glinet_gl-mt2500_env + +--- /dev/null ++++ b/arch/arm/dts/mt7981-glinet-gl-mt2500.dts +@@ -0,0 +1,120 @@ ++// SPDX-License-Identifier: GPL-2.0 ++ ++/dts-v1/; ++#include "mt7981.dtsi" ++#include ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "GL.iNet GL-MT2500"; ++ compatible = "glinet,gl-mt2500", "mediatek,mt7981"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ memory@40000000 { ++ device_type = "memory"; ++ reg = <0x40000000 0x40000000>; ++ }; ++ ++ reg_3p3v: regulator-3p3v { ++ compatible = "regulator-fixed"; ++ regulator-name = "fixed-3.3V"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-boot-on; ++ regulator-always-on; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ ++ reset { ++ label = "reset"; ++ linux,code = ; ++ gpios = <&pio 1 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ led-vpn { ++ label = "white:vpn"; ++ gpios = <&pio 31 GPIO_ACTIVE_LOW>; ++ }; ++ ++ white { ++ label = "white:system"; ++ gpios = <&pio 30 GPIO_ACTIVE_LOW>; ++ }; ++ ++ blue { ++ label = "blue:system"; ++ gpios = <&pio 29 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <1>; ++ phy-mode = "gmii"; ++ phy-handle = <&phy0>; ++ ++ mdio { ++ phy0: ethernet-phy@0 { ++ compatible = "ethernet-phy-id03a2.9461"; ++ reg = <0x0>; ++ phy-mode = "gmii"; ++ }; ++ }; ++}; ++ ++&mmc0 { ++ status = "okay"; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc0_pins_default>; ++ bus-width = <8>; ++ max-frequency = <26000000>; ++ vmmc-supply = <®_3p3v>; ++ cap-mmc-hw-highspeed; ++ cap-mmc-hw-reset; ++ non-removable; ++}; ++ ++&pio { ++ mmc0_pins_default: mmc0-pins-default { ++ mux { ++ function = "flash"; ++ groups = "emmc_45"; ++ }; ++ conf-cmd-dat { ++ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO", ++ "SPI0_CS", "SPI0_HOLD", "SPI0_WP", ++ "SPI1_CLK", "SPI1_MOSI", "SPI1_MISO"; ++ input-enable; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ conf-clk { ++ pins = "SPI1_CS"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ conf-rst { ++ pins = "GPIO_WPS"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; +--- /dev/null ++++ b/configs/mt7981_glinet_gl-mt2500_defconfig +@@ -0,0 +1,113 @@ ++CONFIG_ARM=y ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_ENV_SIZE=0x80000 ++CONFIG_ENV_OFFSET=0x400000 ++CONFIG_DEFAULT_DEVICE_TREE="mt7981-glinet-gl-mt2500" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_TARGET_MT7981=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_ENV_VARS_UBOOT_CONFIG=y ++# CONFIG_EXPERT is not set ++# CONFIG_EFI_LOADER is not set ++CONFIG_FIT=y ++# CONFIG_BOOTSTD is not set ++# CONFIG_LEGACY_IMAGE_FORMAT is not set ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_USE_BOOTCOMMAND=y ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7981-glinet-gl-mt2500.dtb" ++CONFIG_SYS_CBSIZE=512 ++CONFIG_SYS_PBSIZE=1049 ++CONFIG_LOGLEVEL=7 ++CONFIG_CONSOLE_MUX=y ++CONFIG_SYS_CONSOLE_ENV_OVERWRITE=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="GL-MT2500> " ++CONFIG_CMD_CPU=y ++CONFIG_CMD_LICENSE=y ++# CONFIG_BOOTM_NETBSD is not set ++# CONFIG_BOOTM_PLAN9 is not set ++# CONFIG_BOOTM_RTEMS is not set ++# CONFIG_BOOTM_VXWORKS is not set ++CONFIG_CMD_BOOTMENU=y ++# CONFIG_CMD_ELF is not set ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_ERASEENV=y ++CONFIG_CMD_ENV_CALLBACK=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_CMD_STRINGS=y ++# CONFIG_CMD_UNLZ4 is not set ++# CONFIG_CMD_UNZIP is not set ++CONFIG_CMD_DM=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_GPT=y ++CONFIG_CMD_GPT_RENAME=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_READ=y ++CONFIG_CMD_USB=y ++CONFIG_CMD_WRITE=y ++CONFIG_CMD_SETEXPR_FMT=y ++CONFIG_CMD_XXD=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_LINK_LOCAL=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_WGET=y ++CONFIG_CMD_PXE=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_UUID=y ++CONFIG_CMD_HASH=y ++CONFIG_CMD_SMC=y ++CONFIG_CMD_FAT=y ++CONFIG_PARTITION_TYPE_GUID=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_MMC=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_DEFAULT_ENV_FILE="defenvs/glinet_gl-mt2500_env" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_NETCONSOLE=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_CLK=y ++CONFIG_GPIO_HOG=y ++CONFIG_LED=y ++CONFIG_LED_BLINK=y ++CONFIG_LED_GPIO=y ++CONFIG_MMC_HS200_SUPPORT=y ++CONFIG_MMC_MTK=y ++CONFIG_PHY_FIXED=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7981=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_SERIAL=y ++CONFIG_SERIAL_RX_BUFFER=y ++CONFIG_MTK_SERIAL=y ++CONFIG_USB=y ++CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_MTK=y ++CONFIG_USB_STORAGE=y ++CONFIG_HEXDUMP=y +--- /dev/null ++++ b/defenvs/glinet_gl-mt2500_env +@@ -0,0 +1,47 @@ ++bootcmd=run boot_system ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_tftp_forever ++bootdelay=0 ++bootfile_bl2=openwrt-mediatek-filogic-glinet_gl-mt2500-emmc-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-glinet_gl-mt2500-emmc-bl31-uboot.fip ++bootfile_firmware=openwrt-mediatek-filogic-glinet_gl-mt2500-squashfs-factory.bin ++bootfile=openwrt-mediatek-filogic-glinet_gl-mt2500-initramfs-kernel.bin ++boot_first=if button reset ; then run boot_tftp ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_1=Boot system from eMMC.=run boot_system ++bootmenu_2=Load Firmware via TFTP then write to eMMC.=run load_tftp_firmware ; run bootmenu_confirm_return ++bootmenu_3=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_4=Load BL31+U-Boot FIP via TFTP then write to eMMC.=run load_tftp_fip ; run bootmenu_confirm_return ++bootmenu_5=Load BL2 preloader via TFTP then write to eMMC.=run load_tftp_bl2 ; run bootmenu_confirm_return ++bootmenu_6=Reboot.=reset ++bootmenu_7=Reset all settings to factory defaults.=run reset_factory ; run bootmenu_confirm_return ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++boot_system=part start mmc 0 kernel part_addr && part size mmc 0 kernel part_size && run mmc_read_kernel && bootm ++boot_tftp_forever=while true ; do run boot_tftp ; sleep 1 ; done ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr ++country_code_factory=setexpr macoffs $loadaddr + 0x88 ; env readmem country_code $macoffs 0x2 ; setenv country_code_factory ; setenv macoffs ++ddns_factory=setexpr macoffs $loadaddr + 0x10 ; env readmem ddns $macoffs 0x10 ; setenv ddns_factory ; setenv macoffs ++emmc_write_bl2=run filesize_to_blk && test 0x$cnt -le 0x800 && mmc partconf 0 1 1 1 && mmc write $loadaddr 0x0 0x800 ; mmc partconf 0 1 1 0 ++emmc_write_fip=part start mmc 0 fip part_addr && part size mmc 0 fip part_size && run filesize_to_blk && test 0x$cnt -le 0x$part_size && mmc write $loadaddr $part_addr $cnt ++emmc_write_firmware=part start mmc 0 kernel part_addr && run filesize_to_blk && mmc write $loadaddr $part_addr $cnt ++env_cleanup=setenv load_factory_data ; setenv env_cleanup ++ethaddr_factory=setenv ethaddr $lan_mac ; setenv ethaddr_factory ++filesize_to_blk=setexpr cnt $filesize + 0x1ff && setexpr cnt $cnt / 0x200 ++ipaddr=192.168.1.1 ++lan_mac_factory=setexpr lan_mac_tmp gsub ":" "" 0x$wan_mac ; setexpr lan_mac_tmp $lan_mac_tmp + 1 ; setexpr lan_mac_tmp gsub "\\(..\\)" "\\\\1:" $lan_mac_tmp ; setexpr lan_mac fmt "%.17s" $lan_mac_tmp; setenv lan_mac_tmp ; setenv lan_mac_factory ++loadaddr=0x50000000 ++load_factory_data=mmc dev 0 2 ; mmc read $loadaddr 0x0 0x100 ; mmc dev 0 ++load_tftp_fip=tftpboot $loadaddr $bootfile_fip && run emmc_write_fip ++load_tftp_bl2=tftpboot $loadaddr $bootfile_bl2 && run emmc_write_bl2 ++load_tftp_firmware=tftpboot $loadaddr $bootfile_firmware && run emmc_write_firmware ++mmc_read_kernel=mmc read $loadaddr $part_addr 0x100 && imszb $loadaddr image_size && test 0x$image_size -le 0x$part_size && mmc read $loadaddr $part_addr $image_size ++reset_factory=eraseenv && reset ++serverip=192.168.1.10 ++sn_bak_factory=setexpr macoffs $loadaddr + 0x20 ; env readmem sn_bak $macoffs 0x10 ; setenv sn_bak_factory ; setenv macoffs ++sn_factory=setexpr macoffs $loadaddr + 0x30 ; env readmem sn $macoffs 0x10 ; setenv sn_factory ; setenv macoffs ++wan_mac_factory=setexpr macoffs $loadaddr + 0xa ; env readmem -b wan_mac $macoffs 0x6 ; setenv wan_mac_factory ; setenv macoffs ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" ++_firstboot=setenv _firstboot ; run _switch_to_menu ; run load_factory_data ; run wan_mac_factory ; run lan_mac_factory ; run ddns_factory ; run sn_factory ; run sn_bak_factory ; run country_code_factory ; run env_cleanup ; run ethaddr_factory ; run _init_env ; run boot_first ++_init_env=setenv _init_env ; saveenv ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 7c7d33098e2..89d17a82e1d 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -989,8 +989,12 @@ define Device/glinet_gl-mt2500 DEVICE_DTS_LOADADDR := 0x47000000 DEVICE_PACKAGES := -wpad-basic-mbedtls e2fsprogs f2fsck mkf2fs kmod-usb3 SUPPORTED_DEVICES += glinet,mt2500-emmc glinet,gl-mt2500-airoha - IMAGES := sysupgrade.bin + IMAGES := sysupgrade.bin factory.bin + IMAGE/factory.bin := append-kernel | pad-to 32M | append-rootfs IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata + ARTIFACTS := emmc-preloader.bin emmc-bl31-uboot.fip + ARTIFACT/emmc-preloader.bin := mt7981-bl2 emmc-ddr4 + ARTIFACT/emmc-bl31-uboot.fip := mt7981-bl31-uboot glinet_gl-mt2500 endef TARGET_DEVICES += glinet_gl-mt2500