OpenWrt support for Zyxel LTE5398-M904

For now I've put some black tape but it still lets some light filter through...

Too bad about this, I hope it will be implemented in the future

Thanks for the documentation which was invaluable to me in understanding why.

in the original firmware I find the command:

mtd_write 
Usage: mtd [<options> ...] <command> [<arguments> ...] <device>

The device is in the format of mtdX (eg: mtd4) or its label.
mtd recognizes these commands:
        unlock                  unlock the device
        erase                   erase all data on device
        write <imagefile>|-     write <imagefile> (use - for stdin) to device
        writeflash <imagefile> <n> <offset> <device> write <imagefile> to  n bytes from offset of <device>
        readflash  <imagefile> <n> <offset> <device> read n bytes from offset of <device> to <imagefile>
        erasesector <offset> <device> erase one sector from offset of <device>
Following options are available:
        -q                      quiet mode (once: no [w] on writing,
                                           twice: no status messages)
        -r                      reboot after successful command
        -e <device>             erase <device> before executing the command
        -v                      output writing info. (1 more -v would output HTML format.)
        -o <num>                file offset 
        -l <num>                length in file
        -w                      read after write action to check
Example: To write linux.trx to mtd4 labeled as linux and reboot afterwards
         mtd -r write linux.trx linux

which for the moment I am not able to use as it also asks me to read:

readflash <imagefile> <n> <offset> <device> read n bytes from offset of <device> to <imagefile>

that I don't know how to use

I wrote to add modem support earlier, so there would be time for work and testing. Once router support was added, users would be able to use packages as normal.

I need this information about the modem to get started:

  • VID and PID identifier on the USB bus
  • serial port used for communication with the modem ("diagnostic")

I would try these:

  • imagefile - /tmp/mtd4-Kernel.img
  • n - either 0 to see if it would copy the entire partition, or partition size which is 32243712 ((0x1EC0000) for Kernel
  • offset - 0
  • device - Kernel or mtd4
1 Like
  • 2c7c:0512
  • /dev/ttyUSB2
2 Likes
mtd_write readflash /tmp/mtd4-Kernel.img 0 0 Kernel

the output file is empty

and

mtd_write readflash /tmp/mtd4-Kernel.img 32243712 0 Kernel
mtd[readflash]:device=Kernel mtklen=32243712 mtkoffset=0
Unlocking Kernel ...
Reading from Kernel to /tmp/mtd4-Kernel.img ... 
ls -la /tmp/mtd4-Kernel.img 
-r-S--x---    1 root     root      32243712 Oct 14 16:52 mtd4-Kernel.img
md5sum mtd4-Kernel.img 
104ccf1763aedd8dfe8d5b307a302cd7  mtd4-Kernel.img

the file output = file output generate whit dd command

md5sum zyxel-copy-mtd/copy_dd_mtd4.bin 
104ccf1763aedd8dfe8d5b307a302cd7  zyxel-copy-mtd/copy_dd_mtd4.bin

@mkrle Please show the command output for this modem:

cat /sys/kernel/debug/usb/devices

(Replace the serial number with a random one).

For some reason the KerneI and Kernel2 dumps I made with busybox nanddump are 128k shorter than the partition itself I'm not sure why. But I'm not too worried as the OEM firmware can be downloaded from ZyXEL and it matches what I have in my dumps.

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=5000 MxCh= 0
D:  Ver= 3.10 Cls=00(>ifc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
P:  Vendor=2c7c ProdID=0512 Rev= 3.18
S:  Manufacturer=Quectel
S:  Product=EG18-EA
S:  SerialNumber=0123456789ABCDEF
C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=896mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=84(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=86(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E:  Ad=88(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=8e(I) Atr=02(Bulk) MxPS=1024 Ivl=0ms
E:  Ad=0f(O) Atr=02(Bulk) MxPS=1024 Ivl=0ms

I didn't change the serial :wink:

2 Likes

Hi @mkrle ,
Modem has been added. Possible useful packages:

  • luci-app-3ginfo-lite
  • luci-app-modemband
  • luci-app-sms-tool-js
  • luci-app-lite-watchdog
2 Likes

How do I get a SNAPSHOT image to try? Or I have to build all up?

1 Like

The PR hasn’t been reviewed yet. I was told it can take a while.

Only if/when the PR is merged will the router show up in the official (snapshot) images.

Until then you can build it yourself or I can share my compiled images. However I’m AFK, and I can’t help before 2023-10-28T22:00:00Z.

If you build from my repo please keep in mind you need the changes in firmware-utils as well.

I've done it all but in the very end I get a compile error :sob:
I compile using this make -j$(nproc) V=s defconfig download clean world abd this is the final erorr:

Enabling urandom_seed
Enabling urngd
Enabling wpad
sed -i "s/Installed-Time: .*/Installed-Time: 1697700708/" /opt/openwrt/build_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/opkg/status
rm -rf /opt/openwrt/build_dir/target-mipsel_24kc_musl/root-ramips/boot /opt/openwrt/build_dir/target-mipsel_24kc_musl/root-ramips/tmp/* /opt/openwrt/build_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/opkg/info/*.postinst* /opt/openwrt/build_dir/target-mipsel_24kc_musl/root-ramips/usr/lib/opkg/lists/* /opt/openwrt/build_dir/target-mipsel_24kc_musl/root-ramips/var/lock/*.lock
find /opt/openwrt/build_dir/target-mipsel_24kc_musl/root-ramips/ -mindepth 1 -execdir touch -hcd "@1697700708" "{}" +
find: The relative path 'Files' is included in the PATH environment variable, which is insecure in combination with the -execdir action of find.  Please remove that entry from $PATH
make[2]: *** [package/Makefile:73: package/install] Error 1
make[2]: Leaving directory '/opt/openwrt'
make[1]: *** [package/Makefile:115: /opt/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.package_install] Error 2
make[1]: Leaving directory '/opt/openwrt'
make: *** [/opt/openwrt/include/toplevel.mk:232: world] Error 2

What's your build environment?

I use debian 12 on WSL2 instance on Win11. I followed all the steps, got a ramips standard .config and started building with the patches of mkrle.
Could someone share a binary maybe? I would like to test IceG packages...

But I don't have spaces:

xxx@yyy:/opt/openwrt$ git remote -v
origin  https://github.com/mkrle/openwrt.git (fetch)
origin  https://github.com/mkrle/openwrt.git (push)
xxx@yyy:/opt/openwrt$

What should I do? Thank you in advance

post echo $PATH output.

This is it:

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files (x86)/VMware/VMware Workstation/bin/:/mnt/c/Program Files/Microsoft/jdk-11.0.20.101-hotspot/bin:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Azure Data Studio/bin:/mnt/c/Program Files/usbipd-win/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft Network Monitor 3/:/mnt/c/Program Files/Microsoft VS Code/bin:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Program Files/Tailscale/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/CMake/bin:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/mnt/c/Program Files (x86)/Windows Kits/10/Microsoft Application Virtualization/Sequencer/:/mnt/c/Program Files/FileBot/:/mnt/c/Program Files/Calibre2/:/mnt/c/Program Files (x86)/Microsoft SQL Server/160/DTS/Binn/:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Users/mziliani.LIFTINGITALIA/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files (x86)/Nmap:/mnt/c/Users/mziliani.LIFTINGITALIA/.dotnet/tools:/mnt/c/Users/mziliani.LIFTINGITALIA/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/mziliani.LIFTINGITALIA/.dotnet/tools:/mnt/c/Users/mziliani.LIFTINGITALIA/AppData/Local/GitHubDesktop/bin:/mnt/c/Users/mziliani.LIFTINGITALIA/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0/LocalCache/local-packages/Python310/Scripts

OK ........

Ahhh lol ok you are right, no spaces in the full path variable...I was thinking just in the path of openwrt. Thank you for your help.

well, you should have read the whole post :wink:

anyway, you can always get a free cloud host at one of the big cloud providers, and run the image generation job there.