]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
econet: add ChinaMobile GS3101 23533/head
authorCaleb James DeLisle <cjd@cjdns.fr>
Wed, 22 Jul 2026 14:15:53 +0000 (14:15 +0000)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Wed, 22 Jul 2026 15:11:24 +0000 (17:11 +0200)
The ChinaMobile GS3101 has:
256MB RAM
256MB flash (TC58CVG1S3H)
1x MT7603 802.11 b/g/n - DISABLED
1x optical port
On-die MT7530 switch with:
- 1x gigabit ethernet port
- 3x 100Mb ethernet ports
1x USB 2.0 port
1x telephone VoIP port
3 controllable LEDs
1 GPIO button (reset), 1 WPS button (not detected in GPIOs)
UART header inside (solder required) 115200 baud
12v power (5.5mm x 2.1mm barrel connector)

Installation instructions: You will need a USB stick
1. Reformat the USB stick as VFAT with MBR partition table. This is important,
if it is GPT then it will silently fail to load.
2. Download openwrt-econet-en751221-chinamobile_gs3101-squashfs-tclinux.trx and
store it in the USB stick.
3. Start the device with the vendor OS
4. Connect a cable and request an IP address - it will issue in 192.168.1.0/24
5. Use telnet to connect to the modem on 192.168.1.1
6. Login as root@2024 / system
7. Plugin the USB stick
8. cp /mnt/usb1_1/openwrt-econet-en751221-chinamobile_gs3101-squashfs-tclinux.trx /tmp/openwrt.trx
9. mtd -r -f write /tmp/openwrt.trx tclinux
10. You will lose your shell, look at the power light on the device, it should
begin blinking and then go back to solid. You should NOT see any red light.
11. re-request an IP address
12. ssh root@192.168.1.1
13. You should be on OpenWrt now

MAC address matches that of vendor OS but it is not the address on the label
of the device. It is in a compressed xml file in the 'romfile' partition.
WAN is this mac, LAN is mac+1 and 2.4Ghz WLAN is mac+2, there is no 5Ghz WLAN.

Wifi Note: Of the devices tested, there were numerous upon which starting the
wlan chip caused the CPU to hang. In the interest of avoiding bricked boards,
the wlan is disabled in the DT.

Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
Link: https://github.com/openwrt/openwrt/pull/23533
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/econet/base-files/etc/board.d/02_network
target/linux/econet/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
target/linux/econet/base-files/lib/functions/econet.sh [new file with mode: 0644]
target/linux/econet/base-files/lib/upgrade/platform.sh [new file with mode: 0644]
target/linux/econet/base-files/sbin/en75_chboot
target/linux/econet/dts/en7526f_chinamobile_gs3101.dts [new file with mode: 0644]
target/linux/econet/image/Makefile
target/linux/econet/image/en751221.mk

index e27926df68f829feb68fd5a9072d2abd15985502..748154eb9be1b34f5636be7c962ff514dde5c827 100644 (file)
@@ -1,5 +1,6 @@
 . /lib/functions/system.sh
 . /lib/functions/uci-defaults.sh
+. /lib/functions/econet.sh
 
 econet_setup_interfaces()
 {
@@ -21,6 +22,10 @@ econet_setup_macs()
        local label_mac=""
 
        case "$board" in
+       chinamobile,gs3101)
+               wan_mac="$(get_mac_gs3101)"
+               [ -n "$wan_mac" ] && lan_mac="$(macaddr_add $wan_mac 1)"
+               ;;
        huawei,hg2821t-u)
                local conffile="/tmp/configuration_a/factory.conf"
                lan_mac=$(get_mac_ascii "$conffile" brmac)
index b479abe9778276ff488829e4f02597a279e50ca2..79dbc9b45cf5f62fcf9e86c23f1aa58901e1a663 100755 (executable)
@@ -5,10 +5,15 @@ PHYNBR=${DEVPATH##*/phy}
 [ -n "$PHYNBR" ] || exit 0
 
 . /lib/functions/system.sh
+. /lib/functions/econet.sh
 
 board=$(board_name)
 
 case "$board" in
+chinamobile,gs3101)
+       mac=$(get_mac_gs3101)
+       [ -n "$mac" ] && echo "$(macaddr_add $mac 2)" > /sys${DEVPATH}/macaddress
+       ;;
 huawei,hg2821t-u)
        conffile="/tmp/configuration_a/factory.conf"
        [ "$PHYNBR" -eq 0 ] && get_mac_ascii "$conffile" APMAC_5G > /sys${DEVPATH}/macaddress
diff --git a/target/linux/econet/base-files/lib/functions/econet.sh b/target/linux/econet/base-files/lib/functions/econet.sh
new file mode 100644 (file)
index 0000000..4811505
--- /dev/null
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-2.0
+
+get_mac_gs3101() {
+       local part_name="romfile"
+       local idx;
+
+       idx=$(find_mtd_index "$part_name")
+       if [ -z "$idx" ]; then
+               echo "get_mac_gs3101: partition $part_name not found" >&2
+               return 1
+       fi
+
+       # <Entry0 Mac="5ac876db9bf0" newHwUpBytes="0" newHwDownBytes="0"
+       dd if="/dev/mtd${idx}" 2>/dev/null | \
+               gunzip 2>/dev/null | \
+               strings | \
+               sed -n -e 's/^.*Mac="\([a-f0-9]\{12\}\)".*$/\1/p' | \
+               while read mac; do
+                       mac=$(macaddr_canonicalize "$mac")
+                       [ "$mac" = "" ] && continue
+                       # For some reason, GS3101 stores 5a:c8:76:...
+                       # But the MAC address is 58:c8:76:...
+                       echo "$(macaddr_unsetbit "$mac" 7)"
+                       break
+               done | \
+               grep '[a-f0-9:]\{17\}' && return 0
+
+       echo "get_mac_gs3101: could not find mac address" >&2
+       return 1
+}
diff --git a/target/linux/econet/base-files/lib/upgrade/platform.sh b/target/linux/econet/base-files/lib/upgrade/platform.sh
new file mode 100644 (file)
index 0000000..f847865
--- /dev/null
@@ -0,0 +1,22 @@
+platform_check_image() {
+       local board=$(board_name)
+
+       case "$board" in
+       chinamobile,gs3101)
+               return 0
+               ;;
+       esac
+
+       return 1
+}
+
+platform_do_upgrade() {
+       local board=$(board_name)
+
+       case "$board" in
+       chinamobile,gs3101)
+               CI_KERNPART="tclinux_kernel"
+               nand_do_upgrade "$1"
+               ;;
+       esac
+}
index 1d711e465cfba785673dca8d2c2bb2996a492427..42eefcd53b6fc66a12e70e418763ea55d7210fa7 100755 (executable)
@@ -164,6 +164,17 @@ main() {
         code_openwrt=0000
         code_factory=0101
         ;;
+    chinamobile,gs3101)
+        part=$(part_named '"reservearea"')
+        offset_blocks=12
+        block_size=$((1024 * 128))
+        code_offset=0
+        code_openwrt=31
+        code_factory=30
+        # Slot B is never used on this platform so switching will brick
+        echo "GS3101 does not support A/B partitioning"
+        exit 1
+        ;;
     *)
         echo "Unsupported machine: $machine"
         exit 1
diff --git a/target/linux/econet/dts/en7526f_chinamobile_gs3101.dts b/target/linux/econet/dts/en7526f_chinamobile_gs3101.dts
new file mode 100644 (file)
index 0000000..29cf07b
--- /dev/null
@@ -0,0 +1,189 @@
+// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+#include "en7526f.dtsi"
+
+/ {
+       model = "ChinaMobile GS3101";
+       compatible = "chinamobile,gs3101", "econet,en7526f", "econet,en751221";
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x00000000 0x10000000>;
+       };
+
+       chosen {
+               stdout-path = "/serial@1fbf0000:115200";
+       };
+
+       keys {
+               compatible = "gpio-keys-polled";
+               poll-interval = <100>;
+
+               key-reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       aliases {
+               led-boot = &led_power_green;
+               led-failsafe = &led_signal_red;
+               led-running = &led_power_green;
+               led-upgrade = &led_registered_green;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power_green: led-0 {
+                       /* Written "电源" (Power supply) */
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_POWER;
+                       gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
+               };
+
+               led_registered_green: led-1 {
+                       /* Written "注册" (Registered) */
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_WAN;
+                       gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
+               };
+
+               led_signal_red: led-2 {
+                       /* Written "光信号" (Optical signal) */
+                       color = <LED_COLOR_ID_RED>;
+                       function = "signal";
+                       gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       virtual_flash {
+               compatible = "mtd-concat";
+               devices = <&rootA &rootB &root2>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "ubi";
+                               reg = <0x0 0x0>;
+                       };
+               };
+       };
+};
+
+&nand {
+       status = "okay";
+       econet,bmt;
+       econet,bbt-table-size = <250>;
+
+       partitions {
+               compatible = "fixed-partitions";
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               partition@0 {
+                       label = "bootloader";
+                       reg = <0x0 0x40000>;
+                       read-only;
+               };
+
+               partition@40000 {
+                       label = "romfile";
+                       reg = <0x40000 0x40000>;
+               };
+
+               partition@80000 {
+                       label = "tclinux";
+                       reg = <0x80000 0x1000000>;
+                       econet,enable-remap;
+               };
+
+               partition1@80000 {
+                       label = "tclinux_kernel";
+                       reg = <0x80000 0x400000>;
+                       econet,enable-remap;
+               };
+
+               rootA: partition1@480000 {
+                       label = "tclinux_rootfs";
+                       reg = <0x480000 0xc00000>;
+               };
+
+               partition@1080000 {
+                       label = "tclinux_alt";
+                       reg = <0x1080000 0x1000000>;
+                       econet,enable-remap;
+               };
+
+               partition1@1080000 {
+                       label = "tclinux_alt_kernel";
+                       reg = <0x1080000 0x400000>;
+                       econet,enable-remap;
+               };
+
+               rootB: partition1@1480000 {
+                       label = "tclinux_alt_rootfs";
+                       reg = <0x1480000 0xc00000>;
+               };
+
+               root2: partition@2080000 {
+                       label = "common_rootfs";
+                       reg = <0x2080000 0xbdc0000>;
+               };
+
+               partition@de40000 {
+                       label = "reservearea";
+                       reg = <0xde40000 0x1c0000>;
+
+                       nvmem-layout {
+                               compatible = "fixed-layout";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               eeprom_reserve_140000: eeprom@140000 {
+                                       /* MT7592 */
+                                       reg = <0x140000 0x200>;
+                               };
+                       };
+               };
+       };
+};
+
+&gmac0 {
+       status = "okay";
+       /*
+        * MAC address used in factory OS is found in an XML-like file
+        * in a tar.gz which is written to partition romfile.
+        * This address does not match the address on the device label
+        * and can only be extracted by a script.
+        */
+};
+
+/*
+ * There is an MT7592 (MT7603 compatible) chip on this board, but on a large
+ * fraction of devices it is apparently defective and attempting to start it
+ * causes a board hang. In the interest of not causing bricked devices, this
+ * is commented out.
+ * Adventurous users may uncomment this and try to re-flash at their own risk.
+
+&pcie0 {
+       status = "okay";
+};
+&slot0 {
+       wifi@0,0 {
+               compatible = "mediatek,mt76";
+               reg = <0x0000 0 0 0 0>;
+               nvmem-cells = <&eeprom_reserve_140000>;
+               nvmem-cell-names = "eeprom";
+       };
+};
+*/
index a496a0891eeec2d55ab8c17b842c57f2091d58ff..d819673ff19b52e6f47e7034215e9b97c99b4e44 100644 (file)
@@ -13,6 +13,14 @@ define Build/tclinux-trx
        mv $@.new $@
 endef
 
+# Build TRX without rootfs, for use with UBI root
+define Build/kernel-trx
+  ./tclinux-trx.sh --kernel $@ \
+    --version $(VERSION_DIST)-$(REVISION) --endian $(TRX_ENDIAN) \
+    $(if $(TRX_MODEL),--model $(TRX_MODEL)) > $@.new
+       mv $@.new $@
+endef
+
 # If TCSUPPORT_FREE_BOOTBASE is enabled, bootloader will decompress the kernel
 # at 0x80002000 instead of 0x80020000.
 #
index 13b8de4ddc6b680769a072df6f82d831c5bdeb23..ec96a5ac20afb3db9c97c1cbdb34b5eda5261da5 100644 (file)
@@ -1,5 +1,20 @@
 TRX_ENDIAN := be
 
+define Device/chinamobile_gs3101
+  DEVICE_VENDOR := ChinaMobile
+  DEVICE_MODEL := GS3101
+  DEVICE_DTS := en7526f_chinamobile_gs3101
+  KERNEL_SIZE := 4096k
+  NAND_SIZE := 256m
+  KERNEL := kernel-bin | append-dtb | lzma | kernel-trx
+  KERNEL_INITRAMFS := kernel-bin | append-dtb
+  IMAGES := tclinux.trx sysupgrade.bin
+  IMAGE/tclinux.trx := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  DEVICE_PACKAGES := kmod-usb3 kmod-mt7603
+endef
+TARGET_DEVICES += chinamobile_gs3101
+
 define Device/en751221_generic
   DEVICE_VENDOR := EN751221 Family
   DEVICE_MODEL := Initramfs Image