]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
gemini: add support for Teltonika RUT104 22045/head
authorLinus Walleij <linusw@kernel.org>
Fri, 13 Feb 2026 23:44:38 +0000 (00:44 +0100)
committerLinus Walleij <linusw@kernel.org>
Tue, 17 Feb 2026 10:27:22 +0000 (11:27 +0100)
Add support for Teltonika RUT104 3G HSUPA router.

This has been supported since about 20 years in the upstream Linux
kernel after initial contribution by Paulius Zaleckas from Teltonika.
It has some historical significance because I think it was one of the
first Teltonika Linux-based 3G routers.

Installation from scratch is done using the UART:

- UART soldering instructions with picture are available on the
  Link: (see bottom of committ message).
- First *diet down* your OpenWrt build as minimal as you can,
  I really mean this, delete everything you don't need. There
  is not much RAM to go around.
- Extract the "factory" firmare which is essentially just a tar.gz
  archive:
  tar xvfz openwrt-gemini-generic-teltonika_rut104-squashfs-factory.bin

From the RedBoot menu:

- Do NOT UNDER ANY CIRCUMSTANCE try to use the "upgrade firmare" (Z)
  alternative!
- Extract the three files zImage, rd.gz and hddapp.tgz from the archive.
- Put these three files in the root directory of your TFTP server
  (usually /var/lib/tftpboot)
- Hit 6 and set up the IP address for your device (e.g. 169.254.1.2 if
  you're using local link).
- Hit Y to "Upgrade Kernel", enter TFTP and your hosts IP number and
  type zImage. The kernel should upload and flash.
- Hit R to "Upgrade Ramdisk", enter TFTP and your hosts IP number and
  type rd.gz. The "ramdisk" (i.e. the second part of the kernel)
  should upload and flash.
- Hit A to "Upgrade Application", enter TFTP and your hosts IP number
  and type hddapp.tgz. The "application" (i.e. the root filesystem)
  should upload and flash.

This has a 1024KB Kernel partition, just extend the existing Make
functions to handle also this. The initramfs is 0x500000 instead
of 0x600000 for this one so add a parameter explicitly parameterizing
the initramfs size.

Mark non-default due to the small RAM and flash on this device.

I currently have no idea how to actually talk to the modem on this
thing but it is probably using the high-speed "modem UART" of the
Gemini. I'd be willing to help whoever wants to experiment with
it.

Link: https://dflund.se/~triad/krad/teltonika/
Link: https://github.com/openwrt/openwrt/pull/22045
Signed-off-by: Linus Walleij <linusw@kernel.org>
target/linux/gemini/image/ImageInfo-teltonika_rut104 [new file with mode: 0644]
target/linux/gemini/image/Makefile
target/linux/gemini/image/copy-kernel/Makefile
target/linux/gemini/image/copy-kernel/copy-kernel-1024k.S [new file with mode: 0644]
target/linux/gemini/patches-6.12/0004-ARM-dts-gemini-Correct-the-RUT1xx.patch [new file with mode: 0644]
target/linux/gemini/patches-6.12/308-gemini-augment-RUT1xx-DTS-with-botched-partitions.patch [new file with mode: 0644]

diff --git a/target/linux/gemini/image/ImageInfo-teltonika_rut104 b/target/linux/gemini/image/ImageInfo-teltonika_rut104
new file mode 100644 (file)
index 0000000..26a43f2
--- /dev/null
@@ -0,0 +1,18 @@
+UpgradeImages="zImage rd.gz hddapp.tgz"
+Procduction="SL3512"
+BOOT_VER="1.0.5"
+FIRMWARE_VER="firmware-openwrt-DATESTR"
+INTERNAL_FIRMWARE_VER="firmware-openwrt-DATESTR"
+CONFIGURATION_VER="firmware-openwrt"
+DESCRIPTION="Teltonika RUT104"
+TSS="enabled"
+DIRECT_MODE="disabled"
+DEFAULT_LAN_IPADDR="192.168.1.1"
+DEFAULT_LAN_NETMASK="255.255.255.0"
+DEFAULT_LAN_BOOTPROTO="none"
+DEFAULT_WAN_BOOTPROTO="dhcp"
+DEFAULT_WAN_ENABLED="yes"
+DEFAULT_WLAN_DEVICENAME="eth0"
+VER_zImage="DATESTR"
+VER_Ramdisk="DATESTR"
+VER_hddapp="DATESTR"
index 49d42ac26a195c593d5b0071303fdb9fc5c16eca..e6ba8a1f55617c594ba08acc79724ccdb80a07b5 100644 (file)
@@ -112,8 +112,8 @@ define CreateStorlinkFactoryfile
        dd if=$(IMAGE_ROOTFS) >> $@-ramdisk
        $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 128 >> $@-ramdisk
        # Now rd.gz is too big so split off rd.gz and the tail into "hddapp.gz"
-       dd if=$@-ramdisk of=$@.tmp/rd.gz bs=1 count=6144k conv=sync
-       dd if=$@-ramdisk of=$@.tmp/hddapp.tgz bs=1 skip=6144k count=6144k conv=sync
+       dd if=$@-ramdisk of=$@.tmp/rd.gz bs=1 count=$(4) conv=sync
+       dd if=$@-ramdisk of=$@.tmp/hddapp.tgz bs=1 skip=$(4) count=$(5) conv=sync
        rm -f $@-ramdisk
        # Taglabel
        cp ./ImageInfo-$(1) $@.tmp/ImageInfo
@@ -137,18 +137,27 @@ define CreateStorlinkSysupgradefile
        $(STAGING_DIR_HOST)/bin/padjffs2 $(IMAGE_ROOTFS) -c 128 >> $@
 endef
 
-# 2048k "Kern" partition
+# 1024k "Kern" partition, 5120k "Ramdisk" partition
+define Build/storlink-1024k-factory-image
+       $(call CreateStorlinkFactoryfile,$(1),1024k,1048064,5120k,1664k)
+endef
+
+define Build/storlink-1024k-sysupgrade-image
+       $(call CreateStorlinkSysupgradefile,$(1),1024k)
+endef
+
+# 2048k "Kern" partition, 6144k "Ramdisk" partition
 define Build/storlink-2048k-factory-image
-       $(call CreateStorlinkFactoryfile,$(1),2048k,2096640)
+       $(call CreateStorlinkFactoryfile,$(1),2048k,2096640,6144k,6144k)
 endef
 
 define Build/storlink-2048k-sysupgrade-image
        $(call CreateStorlinkSysupgradefile,$(1),2048k)
 endef
 
-# 3072k "Kern" partition
+# 3072k "Kern" partition, 6144k "Ramdisk" partition
 define Build/storlink-3072k-factory-image
-       $(call CreateStorlinkFactoryfile,$(1),3072k,3145216)
+       $(call CreateStorlinkFactoryfile,$(1),3072k,3145216,6144k,6144k)
 endef
 
 define Build/storlink-3072k-sysupgrade-image
@@ -228,7 +237,6 @@ define Device/storlink-reference
        COMPILE/copy-kernel-$(1).bin := copy-kernel.bin
        IMAGES := factory.bin sysupgrade.bin
        FILESYSTEMS := squashfs
-       DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
 endef
 
 define Device/itian_sq201
@@ -239,7 +247,8 @@ define Device/itian_sq201
        IMAGE/factory.bin := storlink-2048k-factory-image $(1)
        IMAGE/sysupgrade.bin := storlink-2048k-sysupgrade-image $(1) |\
                                append-metadata
-       DEVICE_PACKAGES += kmod-rt61-pci kmod-usb2-pci kmod-dsa-vsc73xx-spi
+       DEVICE_PACKAGES += $(GEMINI_NAS_PACKAGES) kmod-rt61-pci \
+               kmod-usb2-pci kmod-dsa-vsc73xx-spi
 endef
 TARGET_DEVICES += itian_sq201
 
@@ -251,6 +260,7 @@ define Device/raidsonic_ib-4210-b
        IMAGE/factory.bin := storlink-3072k-factory-image $(1)
        IMAGE/sysupgrade.bin := storlink-3072k-sysupgrade-image $(1) |\
                        append-metadata
+       DEVICE_PACKAGES += $(GEMINI_NAS_PACKAGES)
 endef
 TARGET_DEVICES += raidsonic_ib-4210-b
 
@@ -262,6 +272,7 @@ define Device/raidsonic_ib-4220-b
        IMAGE/factory.bin := storlink-3072k-factory-image $(1)
        IMAGE/sysupgrade.bin := storlink-3072k-sysupgrade-image $(1) |\
                        append-metadata
+       DEVICE_PACKAGES += $(GEMINI_NAS_PACKAGES)
 endef
 TARGET_DEVICES += raidsonic_ib-4220-b
 
@@ -273,10 +284,24 @@ define Device/storlink_sl93512r
        IMAGE/factory.bin := storlink-3072k-factory-image $(1)
        IMAGE/sysupgrade.bin := storlink-3072k-sysupgrade-image $(1) |\
                        append-metadata
-       DEVICE_PACKAGES += kmod-dsa-vsc73xx-spi
+       DEVICE_PACKAGES += $(GEMINI_NAS_PACKAGES) kmod-dsa-vsc73xx-spi
 endef
 TARGET_DEVICES += storlink_sl93512r
 
+define Device/teltonika_rut104
+       $(Device/storlink-reference)
+       # Only 32 MB of RAM and 8MB flash so not building by default
+        DEFAULT := n
+       DEVICE_VENDOR := Teltonika
+       DEVICE_MODEL := RUT104
+       DEVICE_DTS := gemini-rut1xx
+       IMAGE/factory.bin := storlink-1024k-factory-image $(1)
+       IMAGE/sysupgrade.bin := storlink-1024k-sysupgrade-image $(1) |\
+                       append-metadata
+       DEVICE_PACKAGES += kmod-phy-micrel kmod-ath5k
+endef
+TARGET_DEVICES += teltonika_rut104
+
 define Device/verbatim_s08v1901_d1
        $(Device/storlink-reference)
        DEVICE_VENDOR := Verbatim
@@ -285,6 +310,7 @@ define Device/verbatim_s08v1901_d1
        IMAGE/factory.bin := storlink-3072k-factory-image $(1)
        IMAGE/sysupgrade.bin := storlink-3072k-sysupgrade-image $(1) |\
                        append-metadata
+       DEVICE_PACKAGES += $(GEMINI_NAS_PACKAGES)
 endef
 TARGET_DEVICES += verbatim_s08v1901_d1
 
index befac6912ade6b4fe8ad5eede62a63b59edc2fef..c819f1fd1f47e653b490797c995ed9a21b4e0e1f 100644 (file)
@@ -16,7 +16,7 @@ BIN_FLAGS     := -O binary -S
 SRC_DIR                := $(CURDIR)/
 OUT_DIR                := $(if $(O),$(if $(patsubst %/,,$(O)),$(O)/,$(O)),$(SRC_DIR))
 
-all: $(OUT_DIR)copy-kernel-2048k.bin $(OUT_DIR)copy-kernel-3072k.bin
+all: $(OUT_DIR)copy-kernel-1024k.bin $(OUT_DIR)copy-kernel-2048k.bin $(OUT_DIR)copy-kernel-3072k.bin
 
 # Don't build dependencies, this may die if $(CC) isn't gcc
 dep:
@@ -35,5 +35,6 @@ $(OUT_DIR)%.bin: $(OUT_DIR)%.o
 mrproper: clean
 
 clean:
+       rm -f $(OUT_DIR)copy-kernel-1024k.bin $(OUT_DIR)copy-kernel-1024k.o
        rm -f $(OUT_DIR)copy-kernel-2048k.bin $(OUT_DIR)copy-kernel-2048k.o
        rm -f $(OUT_DIR)copy-kernel-3072k.bin $(OUT_DIR)copy-kernel-3072k.o
diff --git a/target/linux/gemini/image/copy-kernel/copy-kernel-1024k.S b/target/linux/gemini/image/copy-kernel/copy-kernel-1024k.S
new file mode 100644 (file)
index 0000000..cde68de
--- /dev/null
@@ -0,0 +1,45 @@
+       // Arm assembly to copy the Gemini kernel on Storlink reference
+       // designs and derived devices with the same flash layout and
+       // boot loader.
+       //
+       // This will execute at 0x01600000
+       //
+       // Copies the kernel from two fragments (originally zImage
+       // and initramdisk) to 0x00400000 making space for a kernel
+       // image of up to 8 MB except for these 512 bytes used for
+       // this bootstrap.
+       //
+       // 0x01600200 .. 0x016fffff -> 0x00400000 .. 0x004ffdff
+       // 0x00800000 .. 0x00cfffff -> 0x004ffe00 .. 0x009ffdff
+
+       // Memory used for this bootstrap
+       .equ BOOT_HEADROOM,     0x200
+
+       .global _start // Stand-alone assembly code
+_start:
+       mov r1, #0x01600000
+       mov r2, #0x00400000
+       mov r3, #0x00100000
+       add r1, r1, #BOOT_HEADROOM
+       sub r3, r3, #BOOT_HEADROOM
+copyloop1:
+       ldr r0, [r1]
+       str r0, [r2]
+       add r1, r1, #4
+       add r2, r2, #4
+       sub r3, r3, #4
+       cmp r3, #0
+       bne copyloop1
+       mov r1, #0x00800000
+       mov r3, #0x00500000
+copyloop2:
+       ldr r0, [r1]
+       str r0, [r2]
+       add r1, r1, #4
+       add r2, r2, #4
+       sub r3, r3, #4
+       cmp r3, #0
+       bne copyloop2
+       mov r0, #0x00400000
+       // Let's go
+       mov pc, r0
diff --git a/target/linux/gemini/patches-6.12/0004-ARM-dts-gemini-Correct-the-RUT1xx.patch b/target/linux/gemini/patches-6.12/0004-ARM-dts-gemini-Correct-the-RUT1xx.patch
new file mode 100644 (file)
index 0000000..f958437
--- /dev/null
@@ -0,0 +1,60 @@
+From 1cf93e2435f0d7a7e8c9fd0d4355e6a521f72fc1 Mon Sep 17 00:00:00 2001
+From: Linus Walleij <linusw@kernel.org>
+Date: Sat, 14 Feb 2026 00:12:51 +0100
+Subject: [PATCH 1/2] ARM: dts: gemini: Correct the RUT1xx
+
+Fix two problems with the RUT1xx device tree:
+- The memory is 32MB not 128MB
+- The console is 19200 BPS
+- Activate the PCI
+- Disable the unused USB ports
+
+Signed-off-by: Linus Walleij <linusw@kernel.org>
+---
+ arch/arm/boot/dts/gemini/gemini-rut1xx.dts | 18 +++++++-----------
+ 1 file changed, 7 insertions(+), 11 deletions(-)
+
+--- a/arch/arm/boot/dts/gemini/gemini-rut1xx.dts
++++ b/arch/arm/boot/dts/gemini/gemini-rut1xx.dts
+@@ -14,13 +14,13 @@
+       #address-cells = <1>;
+       #size-cells = <1>;
+-      memory@0 { /* 128 MB */
++      memory@0 { /* 32 MB */
+               device_type = "memory";
+-              reg = <0x00000000 0x8000000>;
++              reg = <0x00000000 0x2000000>;
+       };
+       chosen {
+-              bootargs = "console=ttyS0,115200n8";
++              bootargs = "console=ttyS0,19200n8";
+               stdout-path = &uart0;
+       };
+@@ -113,6 +113,10 @@
+                       pinctrl-0 = <&gpio1_default_pins>;
+               };
++              pci@50000000 {
++                      status = "okay";
++              };
++
+               ethernet@60000000 {
+                       status = "okay";
+@@ -124,13 +128,5 @@
+                               /* Not used in this platform */
+                       };
+               };
+-
+-              usb@68000000 {
+-                      status = "okay";
+-              };
+-
+-              usb@69000000 {
+-                      status = "okay";
+-              };
+       };
+ };
diff --git a/target/linux/gemini/patches-6.12/308-gemini-augment-RUT1xx-DTS-with-botched-partitions.patch b/target/linux/gemini/patches-6.12/308-gemini-augment-RUT1xx-DTS-with-botched-partitions.patch
new file mode 100644 (file)
index 0000000..9a6b749
--- /dev/null
@@ -0,0 +1,58 @@
+From 0b6bed71689664080e1e9ec95aecf45279dde6ee Mon Sep 17 00:00:00 2001
+From: Linus Walleij <linusw@kernel.org>
+Date: Sat, 14 Feb 2026 00:21:13 +0100
+Subject: [PATCH 2/2] gemini: augment RUT1xx DTS with botched partitions
+
+Same botched partitions as the Raidsonic IB-4220-B.
+
+Signed-off-by: Linus Walleij <linusw@kernel.org>
+---
+ arch/arm/boot/dts/gemini/gemini-rut1xx.dts | 37 +++++++++++++++++++++-
+ 1 file changed, 36 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/boot/dts/gemini/gemini-rut1xx.dts
++++ b/arch/arm/boot/dts/gemini/gemini-rut1xx.dts
+@@ -74,7 +74,42 @@
+                       status = "okay";
+                       /* 8MB of flash */
+                       reg = <0x30000000 0x00800000>;
+-                      /* TODO: add flash partitions here */
++                      /*
++                       * Override the RedBoot partition table with fixed partitions
++                       * in order to create a coherent "firmware" partition so that
++                       * we can have optimal flash usage with OpenWrt in a big
++                       * MTD-splitted "firmware" partition.
++                       */
++                      partitions {
++                              compatible = "fixed-partitions";
++                              #address-cells = <1>;
++                              #size-cells = <1>;
++                              partition@0 {
++                                      label = "BOOT";
++                                      reg = <0x00000000 0x00020000>;
++                                      read-only;
++                              };
++                              partition@1 {
++                                      compatible = "openwrt,executable-prolog";
++                                      label = "firmware";
++                                      reg = <0x00020000 0x007a0000>;
++                              };
++                              partition@2 {
++                                      label = "VCTL";
++                                      reg = <0x007c0000 0x00010000>;
++                                      read-only;
++                              };
++                              partition@3 {
++                                      label = "cfg";
++                                      reg = <0x007d0000 0x00020000>;
++                                      read-only;
++                              };
++                              partition@4 {
++                                      label = "FIS directory";
++                                      reg = <0x007f0000 0x00010000>;
++                                      read-only;
++                              };
++                      };
+               };
+               syscon: syscon@40000000 {