From: Andreas Gnau Date: Tue, 7 Jan 2025 22:55:12 +0000 (+0100) Subject: ramips: Add support for Genexis / Inteno Pulse EX400 X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=3e7337feead8e0a0f5a05f5b91d7d0fd7f14ec56;p=openwrt%2Fstaging%2Fstintel.git ramips: Add support for Genexis / Inteno Pulse EX400 Add support for Genexis Pulse EX400 / Inteno Pulse EX400. A branded variant for the Finnish ISP DNA has already been added in fea2264d9fdd (ramips: mt7621: Add DNA Valokuitu Plus EX400, 2023-07-31). This commit adds support for the generic variants with Inteno and Genexis branding. Inteno changed its name to Genexis and both brandings exist. In terms of electronics, there is no difference between the DNA-branded version and other brandings. LED markings on the case are different, though. While the DNA-version has a "software-update" LED, the other versions have a WPS LED. To reduce user confusion, create a separate image. Add the different device-tree with the different LED and rename things to work the same way for both variants. Specifications: - Device: Genexis Pulse EX400 / Inteno Pulse EX400 - SoC: MT7621A - Flash: 256 MB NAND - RAM: 256 MB - Ethernet: Built-in, 2 x 1 GbE - Wifi: MT7603 2.4 GHz 2x2 MIMO, MT7615 5 GHz 4x4 MU-MIMO - USB: 1x 2.0 - LEDs (GPIO): green/red status, green WPS - LEDs (SX9512, unsupported): Broadband, Wi-Fi 2.4G, Wi-Fi 5G - Buttons (GPIO): Reset - Buttons (SX9512, unsupported): Wi-Fi 2.4G, Wi-Fi 5G, WPS MAC addresses: - LAN: U-Boot 'ethaddr' (label) - WAN: label + 1 - 2.4 GHz: label + 6 - 5 GHz: label + 7 Serial: There is a black block connector next to the red ethernet connector. It is accessible also through holes in the casing. Pinout (TTL 3.3V) +---+---+ |Tx |Rx | +---+---+ |Vcc|Gnd| +---+---+ Firmware: The vendor firmware is a fork of OpenWrt (Reboot) with a kernel version 4.4.93. The flash is arranged as below and there is a dual boot mechanism alternating between rootfs_0 and rootfs_1. +-------+------+------+-----------+-----------+ | | env1 | env2 | rootfs_0 | rootfs_1 | | +------+------+-----------+-----------+ | | UBI volumes | +-------+-------------------------------------+ |U-Boot | UBI | +-------+-------------------------------------+ |mtd0 | mtd1 | +-------+-------------------------------------+ | NAND | +---------------------------------------------+ In OpenWrt rootfs_0 will be used as a boot partition that will contain the kernel and the dtb. The squashfs rootfs and overlay are standard OpenWrt behaviour. +-------+------+------+-----------+--------+------------+ | | env1 | env2 | rootfs_0 | rootfs | rootfs_data| | +------+------+-----------+--------+------------+ | | UBI volumes | +-------+-----------------------------------------------+ |U-Boot | UBI | +-------+-----------------------------------------------+ |mtd0 | mtd1 | +-------+-----------------------------------------------+ | NAND | +-------------------------------------------------------+ U-boot: With proper serial access, booting can be halted to U-boot by pressing any key. TFTP and flash writes are available, but only the first one has been tested. NOTE: Recovery mode can be accessed by holding down the reset button while powering on the device. The led 'Update' will show a solid green light once ready. A web server will be running at 192.168.1.1:80 and it will allow flashing a firmware package. You can cycle between rootfs_0 and rootfs_1 by pressing the reset button once. Root password: With the vendor web UI create a backup of your settings and download the archive to your computer. Within the archive in the file /etc/shadow replace the password hash for root with that of a password you know. Restore the configuration with the vendor web UI and you will have changed the root password. SSH access: You might need to enable the SSH service for LAN interface as by default it's enabled for WAN only. Installing OpenWrt: With the vendor web UI, or from the U-Boot recovery UI, install the OpenWrt factory image. Alternatively, ssh to the device and use sysupgrade -n from cli. Finalize by installing the OpenWrt sysupgrade image to get a fully functioning system. Reverting to the vendor firmware: Boot with OpenWrt initramfs image - Remove volumes rootfs_0, rootfs and rootfs_data and create vendor volumes. ubirmvol /dev/ubi0 -n 2 ubirmvol /dev/ubi0 -n 3 ubirmvol /dev/ubi0 -n 4 ubimkvol /dev/ubi0 -N rootfs_0 -S 990 ubimkvol /dev/ubi0 -N rootfs_1 -S 990 Power off and enter to the U-boot recovery to install the vendor firmware. Signed-off-by: Andreas Gnau Link: https://github.com/openwrt/openwrt/pull/17551 Signed-off-by: Hauke Mehrtens --- diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index c1633e2cac..326524fba7 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -149,7 +149,8 @@ xiaomi,mi-router-cr6608|\ xiaomi,mi-router-cr6609) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x20000" ;; -dna,valokuitu-plus-ex400) +dna,valokuitu-plus-ex400|\ +genexis,pulse-ex400) ubootenv_add_uci_config "/dev/ubi0_0" "0x0" "0x1f000" "0x1f000" "1" ubootenv_add_uci_config "/dev/ubi0_1" "0x0" "0x1f000" "0x1f000" "1" ;; diff --git a/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts b/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts index 9bbe91beef..e06da71d76 100644 --- a/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts +++ b/target/linux/ramips/dts/mt7621_dna_valokuitu-plus-ex400.dts @@ -5,4 +5,19 @@ / { compatible = "dna,valokuitu-plus-ex400", "mediatek,mt7621-soc"; model = "DNA Valokuitu Plus EX400"; + + aliases { + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_update_green; + }; +}; + +&leds { + led_update_green: led-2 { + color = ; + function = LED_FUNCTION_PROGRAMMING; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; }; diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi index dddc381fe8..a3bc70e8ce 100644 --- a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400-common.dtsi @@ -10,10 +10,6 @@ aliases { ethernet0 = &gmac0; label-mac-device = &gmac0; - led-boot = &led_status_red; - led-failsafe = &led_status_red; - led-running = &led_status_green; - led-upgrade = &led_update_green; }; chosen { @@ -30,7 +26,7 @@ }; }; - leds { + leds: leds { compatible = "gpio-leds"; led_status_green: led-0 { @@ -44,12 +40,6 @@ function = LED_FUNCTION_STATUS; gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; }; - - led_update_green: led-2 { - color = ; - function = LED_FUNCTION_PROGRAMMING; - gpios = <&gpio 12 GPIO_ACTIVE_LOW>; - }; }; }; diff --git a/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts new file mode 100644 index 0000000000..2ec6498322 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_genexis_pulse-ex400.dts @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_genexis_pulse-ex400-common.dtsi" + +/ { + compatible = "genexis,pulse-ex400", "mediatek,mt7621-soc"; + model = "Genexis/Inteno Pulse EX400"; + + aliases { + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_green; + led-upgrade = &led_status_red; + }; +}; + +&leds { + led_wps_green: led-2 { + color = ; + function = LED_FUNCTION_WPS; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 1f04dbdef6..370b20a783 100755 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -51,7 +51,7 @@ define Build/arcadyan-trx rm $@.hsqs $@.tail endef -define Build/dna-header +define Build/inteno-y3-header BC='$(STAGING_DIR_HOST)/bin/bc' ;\ ubifsofs="1024" ;\ ubifs="$$(stat -c%s $@)" ;\ @@ -91,7 +91,7 @@ define Build/dna-header mv $@.tmp $@ endef -define Build/dna-bootfs +define Build/inteno-bootfs mkdir -p $@.ubifs-dir/boot # populate the boot fs with the dtb and the kernel image @@ -1085,23 +1085,11 @@ define Device/d-team_pbr-m1 endef TARGET_DEVICES += d-team_pbr-m1 +# Branded version of Genexis / Inteno EX400 (difference is one LED) define Device/dna_valokuitu-plus-ex400 - $(Device/dsa-migration) - IMAGE_SIZE := 117m - PAGESIZE := 2048 - MKUBIFS_OPTS := --min-io-size=$$(PAGESIZE) --leb-size=124KiB --max-leb-cnt=96 \ - --log-lebs=2 --space-fixup --squash-uids + $(Device/genexis_pulse-ex400/common) DEVICE_VENDOR := DNA DEVICE_MODEL := Valokuitu Plus EX400 - KERNEL := kernel-bin | lzma | uImage lzma - KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma - IMAGES += factory.bin - IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ - dna-bootfs | dna-header | append-md5sum-ascii-salted - IMAGE/sysupgrade.bin := append-kernel | dna-bootfs | \ - sysupgrade-tar kernel=$$$$@ | check-size | append-metadata - DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) - DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 endef TARGET_DEVICES += dna_valokuitu-plus-ex400 @@ -1406,6 +1394,33 @@ define Device/gemtek_wvrtm-130acn endef TARGET_DEVICES += gemtek_wvrtm-130acn +# Common definitions shared between genexis_pulse-ex400 and dna_valokuitu-plus-ex400 +define Device/genexis_pulse-ex400/common + $(Device/dsa-migration) + IMAGE_SIZE := 117m + PAGESIZE := 2048 + MKUBIFS_OPTS := --min-io-size=$$(PAGESIZE) --leb-size=124KiB --max-leb-cnt=96 \ + --log-lebs=2 --space-fixup --squash-uids + KERNEL := kernel-bin | lzma | uImage lzma + KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma + IMAGES += factory.bin + IMAGE/factory.bin := append-image-stage initramfs-kernel.bin | \ + inteno-bootfs | inteno-y3-header | append-md5sum-ascii-salted + IMAGE/sysupgrade.bin := append-kernel | inteno-bootfs | \ + sysupgrade-tar kernel=$$$$@ | check-size | append-metadata + DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(2) + DEVICE_PACKAGES := kmod-mt7603 kmod-mt7615-firmware kmod-usb3 +endef + +define Device/genexis_pulse-ex400 + $(Device/genexis_pulse-ex400/common) + DEVICE_VENDOR := Genexis + DEVICE_MODEL := Pulse EX400 + DEVICE_ALT0_VENDOR := Inteno + DEVICE_ALT0_MODEL := Pulse EX400 +endef +TARGET_DEVICES += genexis_pulse-ex400 + define Device/glinet_gl-mt1300 $(Device/dsa-migration) IMAGE_SIZE := 32448k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index dfb139db4e..2374d5f60a 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -73,6 +73,7 @@ ramips_setup_interfaces() cudy,m1300-v2|\ cudy,m1800|\ dna,valokuitu-plus-ex400|\ + genexis,pulse-ex400|\ humax,e10|\ keenetic,kn-3510|\ meig,slt866|\ diff --git a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount index b83223e7dd..2c88d68051 100755 --- a/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount +++ b/target/linux/ramips/mt7621/base-files/etc/init.d/bootcount @@ -32,7 +32,8 @@ boot() { samknows,whitebox-v8) fw_setenv bootcount 0 ;; - dna,valokuitu-plus-ex400) + dna,valokuitu-plus-ex400|\ + genexis,pulse-ex400) fw_setenv boot_cnt_primary 0 fw_setenv boot_cnt_alt 0 ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/dna.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/dna.sh deleted file mode 100644 index d699516ff6..0000000000 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/dna.sh +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright (C) 2023 Mauri Sandberg -# - -# The vendor UBI is split in volumes 0-3. Volumes 0 and 1 contain U-Boot -# environments env1 and env2, respectively. The vendor root file systems -# are in volumes 2 (rootfs_0) and 3 (rootfs_1). Drop the two roots and -# explicitly use rootfs_0 as a boot partition that contains the dtb and the -# OpenWrt kernel. This is because the vendor U-Boot expects to find them there. -# Then continue upgrade with the default method - a SquashFS rootfs will be -# installed and the rest of UBI will be used as an overlay. - -# The 'kernel' inside the sysupgrage.tar is an UBIFS image that contains -# /boot/dtb and /boot/kernel. The 'root' is an OpenWrt SquashFS root - -. /lib/functions.sh -. /lib/upgrade/nand.sh - -dna_do_upgrade () { - tar -xaf $1 - - # get the size of the new bootfs - local _bootfs_size=$(wc -c < ./sysupgrade-dna_valokuitu-plus-ex400/kernel) - [ -n "$_bootfs_size" -a "$_bootfs_size" -gt "0" ] || nand_do_upgrade_failed - - # remove existing rootfses and recreate rootfs_0 - ubirmvol /dev/ubi0 --name=rootfs_0 > /dev/null 2>&1 - ubirmvol /dev/ubi0 --name=rootfs_1 > /dev/null 2>&1 - ubirmvol /dev/ubi0 --name=rootfs > /dev/null 2>&1 - ubirmvol /dev/ubi0 --name=rootfs_data > /dev/null 2>&1 - ubimkvol /dev/ubi0 --type=static --size=${_bootfs_size} --name=rootfs_0 - - # update the rootfs_0 contents - local _kern_ubivol=$( nand_find_volume "ubi0" "rootfs_0" ) - ubiupdatevol /dev/${_kern_ubivol} sysupgrade-dna_valokuitu-plus-ex400/kernel - - fw_setenv root_vol rootfs_0 - fw_setenv boot_cnt_primary 0 - fw_setenv boot_cnt_alt 0 - - # proceed to upgrade the default way - CI_KERNPART=none - nand_do_upgrade "$1" -} diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/inteno.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/inteno.sh new file mode 100644 index 0000000000..677000f6b1 --- /dev/null +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/inteno.sh @@ -0,0 +1,49 @@ +# +# Copyright (C) 2023 Mauri Sandberg +# + +# The vendor UBI is split in volumes 0-3. Volumes 0 and 1 contain U-Boot +# environments env1 and env2, respectively. The vendor root file systems +# are in volumes 2 (rootfs_0) and 3 (rootfs_1). Drop the two roots and +# explicitly use rootfs_0 as a boot partition that contains the dtb and the +# OpenWrt kernel. This is because the vendor U-Boot expects to find them there. +# Then continue upgrade with the default method - a SquashFS rootfs will be +# installed and the rest of UBI will be used as an overlay. + +# The 'kernel' inside the sysupgrage.tar is an UBIFS image that contains +# /boot/dtb and /boot/kernel. The 'root' is an OpenWrt SquashFS root + +. /lib/functions.sh +. /lib/upgrade/nand.sh + +inteno_do_upgrade () { + local tar_file=$1 + local cmd=cat + # WARNING: This fails if tar contains more than one 'sysupgrade-*' directory. + local board_dir="$(tar tf "$tar_file" | grep -m 1 '^sysupgrade-.*/$')" + board_dir="${board_dir%/}" + tar -xaf "$tar_file" + + # get the size of the new bootfs + local _bootfs_size=$(wc -c < "$board_dir/kernel") + [ -n "$_bootfs_size" -a "$_bootfs_size" -gt "0" ] || nand_do_upgrade_failed + + # remove existing rootfses and recreate rootfs_0 + ubirmvol /dev/ubi0 --name=rootfs_0 > /dev/null 2>&1 + ubirmvol /dev/ubi0 --name=rootfs_1 > /dev/null 2>&1 + ubirmvol /dev/ubi0 --name=rootfs > /dev/null 2>&1 + ubirmvol /dev/ubi0 --name=rootfs_data > /dev/null 2>&1 + ubimkvol /dev/ubi0 --type=static --size=${_bootfs_size} --name=rootfs_0 + + # update the rootfs_0 contents + local _kern_ubivol=$( nand_find_volume "ubi0" "rootfs_0" ) + ubiupdatevol "/dev/$_kern_ubivol" "$board_dir/kernel" + + fw_setenv root_vol rootfs_0 + fw_setenv boot_cnt_primary 0 + fw_setenv boot_cnt_alt 0 + + # proceed to upgrade the default way + CI_KERNPART=none + nand_do_upgrade "$1" +} diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index f2325c8325..fabaa6ccfb 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -157,8 +157,9 @@ platform_do_upgrade() { buffalo,wsr-2533dhpls) buffalo_do_upgrade "$1" ;; - dna,valokuitu-plus-ex400) - dna_do_upgrade "$1" + dna,valokuitu-plus-ex400|\ + genexis,pulse-ex400) + inteno_do_upgrade "$1" ;; elecom,wrc-x1800gs) [ "$(fw_printenv -n bootmenu_delay)" != "0" ] || \