Zyxel EX5601-T0 OpenWrt UART-Free Installer, Layout Converter, and OEM Restore

I did run the script from the /tmp folder :man_shrugging:

I forgot I saved a log of the boot after running the script. Does this reveal anything about what specifically went wrong?

Hit any key to stop autoboot:  0
ubi0: attaching mtd8
ubi0: scanning is finished
ubi0: attached mtd8 (name "ubi2", size 64 MiB)
ubi0: PEB size: 262144 bytes (256 KiB), LEB size: 253952 bytes
ubi0: min./max. I/O unit sizes: 4096/4096, sub-page size 4096
ubi0: VID header offset: 4096 (aligned 4096), data offset: 8192
ubi0: good PEBs: 256, bad PEBs: 0, corrupted PEBs: 0
ubi0: user volume: 5, internal volumes: 1, max. volumes count: 128
ubi0: max/mean erase counter: 11/4, WL threshold: 4096, image sequence number: 1367161348
ubi0: available PEBs: 0, total reserved PEBs: 256, PEBs reserved for bad PEB handling: 38
Reading from volume 'kernel' to 0x46000000, size 0x0 ... OK
## Loading fdt from FIT Image at 46000000 ...
   Using 'config-1' configuration
   Trying 'fdt-1' fdt subimage
     Description:  ARM64 OpenWrt zyxel_ex5601-t0-ubootmod device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x479ecbac
     Data Size:    25110 Bytes = 24.5 KiB
     Architecture: AArch64
     Hash algo:    crc32
     Hash value:   7b4d807e
     Hash algo:    sha1
     Hash value:   bd51558f8ac7f00129cae57860bad6bd9ecbfe85
   Verifying Hash Integrity ... crc32+ sha1+ OK
ubi0: detaching mtd8
ubi0: mtd8 is detached
bootargs in fdt not found

!!! Fail to booting kernel !!!
Reset your board! system halt...

@aikamoinen
this log you show here is unique, let me explain what was the previous issue which is fixed now.

The problem was that after writing to NAND, the router was not booting from the new partition. It was using a fixed offset to edit the zyfwinfo file. Now, the checksum is calculated dynamically, and the boot switch works with all firmware.

If you understand what was wrong you can get this error, it tells that

  1. Zloader could read the FIT.
  2. Zloader could verify the DTB.
  3. But zloader could not find bootargs inside that DTB.
  4. So zloader refused to boot it.

this happens becasue the ex5601-t0 flash script wrote a ubootmod initramfs image into the stock zloader boot bank. why it happens?The script first wrote opposite boot bank for stock or ubootmod layout, everything was fine only boot switch was not working, so what heppend when you wrote again for different conversion, the bootarg got invalid.

i have fix the issue in new update, so it should work fine and will switch boot after flashing

1 Like

Cool, I’m glad to hear that you were able to see what went wrong :tada:

1 Like

Hi, thank you for the reply. I've tried to load the newer bundle, and the error I previously met is gone. However upon reboot I still have no openwrt. Here I will attach the videos of both ubootmod and stock layout processes.

https://transfer.it/t/jVHAympj3TKL

Lets see what is going on with your router, I need you to compile some code after making a few edits, then run the loader and send me the log (in private, if you prefer not to share it here, as it may contain information about your device).

Here’s the process:

  1. Clone the Git repository:

    git clone https://github.com/majad00/ex5601_openwrt_loader.git
    cd ex5601_openwrt_loader/tools
    
  2. Delete the existing bundle tar:

    rm openwrt_chroot_rootfs.tar.gz
    
  3. Navigate to the directory:

    cd ../source/rootfs/etc
    
  4. Locate the file called matrix_flash_inactive.sh. At the top of this file, find the code:

    set -eu
    
    FW_ARG="${1:-}"
    WORK="/tmp/matrix_fw"
    LOCKDIR="/tmp/matrix_flash.lock"
    
    ZYFWINFO_MODE="${ZYFWINFO_MODE:-minimal}"
    
    # NO_REBOOT=1 for testing.
    NO_REBOOT="${NO_REBOOT:-0}"
    
  5. Replace it with this updated code:

    set -eu
    
    FW_ARG="${1:-}"
    WORK="/tmp/matrix_fw"
    LOCKDIR="/tmp/matrix_flash.lock"
    LOG="${LOG:-/tmp/matrix_flash.log}"
    exec > "$LOG" 2>&1
    ZYFWINFO_MODE="${ZYFWINFO_MODE:-minimal}"
    NO_REBOOT="${NO_REBOOT:-1}"
    
  6. Also, comment out the line that says "reboot" at the end, making it look like this:

    #reboot
    
  7. Next, you need to pack the bundle into a tar.gz file. Go back to the rootfs directory:

    cd ..
    
  8. Then run the command:

    tar -cpzf ../../tools/openwrt_chroot_rootfs.tar.gz . 
    cd ../../tools
    

After running these commands, you will have a new openwrt_chroot_rootfs.tar.gz file with the modified code. Copy this file to your router and run loader.sh again. Select the stock layout conversion. Once finished, return to the Unix shell and use the command to display the log:

cat /tmp/matrix_flash.log

Please send me the log. You can message me directly, also run small dignosis which i send you in private msg,

one thing to remember that you are running a "V5.70(ACEA.0)T56C_b10_0818" which looks like Odido / T-Mobile EX5601-T1 firmware, not the EX5601-T0 ACDZ firmware that this tool is tested with, if your router is EX5601-T1 then you need to provide logs and partition layout so we can make this tool works on T1 as well.

Thank @1alessandro1 @aikamoinen you for providing all the dumps. In the latest update, support has now been added for all generic ACDZ firmware versions and most ISP-specific ACEA, ACQQ, and ACID firmwares. Please let me know if it does not work on any other device; I will study and add support for those as well ( provided you share the error and router dump with me)

3 Likes

Thanks to the awesome adaptation from @krys1 to the latest firmware revision running on ODIDO's T56, with their latest firmware V5.70(ACEA.0)T56C_b10_0818, I was able to use his matrix installer to flash openwrt (STOCK LAYOUT) via the usual procedure:

ssh admin@192.168.1.1 with the password present in the router's back side, in the ZySH > shell I run:

z sys atsh

then:

z sys atwz MAC 0 1

then

sys atck

And I got the supervisor password, then I logged in with ssh root@192.168.1.1 using the supervisor password gained above to get a root shell. After that I used:

scp -O openwrt_chroot_rootfs.tar.gz loader.sh root@192.168.1.1:/tmp/

cd /tmp
chmod +x loader.sh
./loader.sh

Then went to matrix installer present in http://192.168.1.1:8080/cgi-bin/luci/admin/system/matrix and it worked!

2 Likes

Going to try this today or tomorrow with, presumably, an Elisa EX5601-T0 from tori.fi

Will update if it worked and add some info after, firmware version, confirmed vendor, etc.

2 Likes

First things first

  • Firmware is V5.70(ACDZ.2)C0
  • The router is from Elisa.
  • I am doing this on Windows 10.
  • Plug router into wall, establish connection.

  • Login into the router @192.168.1.1 with the credentials on the back:
    "User name"
    "Login Password"

    • Turn on SSH from the top-right corner (three lines) -> Maintenance -> Remote Management -> SSH -> tick the box on the connection you're on (I did LAN since I am on Ethernet) -> click Apply
  • Open up Putty on Windows:
    Connection type: SSH & Telnet
    192.168.1.1 as IP address, 22 on port

    • Click "Open"

    • Click "Accept"

  • Login into the router in SSH with the same credentials as before:
    "User name"
    "Login Password"

    • Type in or copy "z sys atsh"

    • Copy the value of "First MAC Address"


And here is where I get to modify the instructions a bit!

It tells me that after typing in z sys atwz <MAC> 0 10 that

  • sys atwz <MAC> <CountryCode> <EngDbgFlag> <FeatureBit> <MacNumber>

so

  • z sys atwz <MAC> 0 10
    doesn't work and gives
  • format of EngDbgFlag is incorrect and the output of sys help

Also, doing "sys atck" here only does what "sys help" does.


  • Solved it by typing:
    z sys atwz <MAC> 10 1

  • Now it is possible to do sys atck

    • Copy and store the supervisor password.
  • Go download https://github.com/majad00/ex5601_openwrt_loader/releases/tag/1.1

  • Extract the contents of "openwrt_t56_installer_v2" to a location of your choosing.

    • I chose C:\
  • Open Powershell and type in cd <FILE_LOCATION>
    For example, cd C:\

    • Then type in this command.

    scp -O openwrt_chroot_rootfs.tar.gz loader.sh root@192.168.1.1:/tmp/

    • You will be prompted to login as root.
      Paste in the password you copied earlier and press Enter.

    • Should look something like this:

openwrt_chroot_rootfs.tar.gz                         100%   49MB  19.1MB/s   00:02
loader.sh                                            100% 6991     6.7MB/s   00:00
  • Open up Putty again:
    Connection type: SSH & Telnet
    192.168.1.1 as IP address, 22 on port

    • Click "Open"

    • login as: root

root@192.168.1.1's password: <supervisor password from earlier>

The following should look like this:

 BusyBox v1.31.1 () built-in shell (ash)
 Enter 'help' for a list of built-in commands.

 
  _______         ___ ___  _______  _____
 |__     |.--.--.|   |   ||    ___||     |_
 |     __||  |  ||-     -||    ___||       |
 |_______||___  ||___|___||_______||_______|
          |_____|
---------------------------------------------------
root@EX5601-T0:/tmp/var/home/root#
  • Type in this command
    chmod +x /tmp/loader.sh

  • and then
    /tmp/loader.sh

Output should look like this:

 Extracting RootFS...
[OK] Extraction complete. Archive removed to save RAM.
 Installing Matrix files...
[OK] Matrix files installed.
 Preparing Environment...
[OK] Environment prepared with real device nodes.
 Starting Matrix flash runner...
[OK] Matrix flash runner started.
 Launching OpenWrt LuCI services...


================================================
      EX5601-T0 OpenWrt Installer V2.1
================================================

------------------------------------------------
 SUCCESS: Access LUCI at PORT 8080
 Example URL:     http://192.168.1.1:8080
 Username:       root / no password
------------------------------------------------
  • Copy http://192.168.1.1:8080 to the address bar of your browser.

    • Press Login

    • Navigate to System -> Matrix installer

    • Choose the layout you want to install!

I picked uboot since I won't be double-booting, and the additional storage space uboot gives is nice for future projects.

Should take a few minutes.

  • Login into openWRT with the password from behind the router.

That's it!

I also set-up a bridged connection from my cable modem for Internet.

Really proud of myself, got it on the first go.

2 Likes

Thanks again for this amazing tool.
Go get yourself a treat of some kind, you deserve it!

1 Like

Just wanted to say thanks for the detailed tutorial! I should ve create this myself but missed it somehow. You did an excellent job! Thanks again!

Hi friends, I have a WindTre Zyxel EX5601-T0 and I would like to install Openwrt.

The current installed firmware (WindTre specific) is V5.70(ACEN.0)b5.

I already got supervisor password and abel to connect as root.

The guide reports "Work on Generic ACDZ and most ISP specific ACEA ACQQ or ACID Firmwares".

I cannot find any reference to "ACEN". Can you tell me if this procedure is compatible with my firmware V5.70(ACEN.0)b5?

If so, before following the guide to flash openwrt, how can I backup the current WindTre firmware?

Thanks in advance for any help :slight_smile:

Hey! @cacodemon79 So, as far as I know, the ACEN (ISP-Customized Branch) should be pretty similar to Wind3 or Tiscali, so I think it should work fine. The script will only write to NANAD if it finds a compatible partition layout. so there is no worries of softbrick, ( just avoid repeating if it fails) If it doesn't work, just drop the error here, and I'll help you out. Let me know if it works on the ACEN branch!

When the "loader.sh" show message that LUCI is running at port 8080. You can back up all partitions from the dropdown menu > System > Backup/Flash., then use same menu for installation, System > Install matrix

1 Like

@krys1 thank you very much for this very useful information! I will try and let you know.

As regards errors logging, should I enable something before launching the script or it is sufficient to copy the log showed in the "Status" window after clicking on "System > Install matrix > flash Openwrt-stock layout"?

When you run loader.sh, it start a mini root / mini lunix, with everything needed for conversion and directories like /etc, /usr, and /tmp. Logs are stored in /tmp, script will show the name and paths.

If the script goes well, it reboots and wipes the logs. If it doesn’t work, you grab the logs from /tmp. you can also enable logging manually, just check the repo README for how to do that.

@krys1 I confirm you that the procedure described at https://github.com/majad00/ex5601_openwrt_loader worked very well also in my case (Zyxel EX5601-T0 with WindTre firmware V5.70(ACEN.0)b5).

Here below the steps I followed:

1) Launch loader.sh and connect to 192.168.1.1:8080

2) Backup stock firmware
   a) using LUCI "System --> Backup / Flash Firmware" functionality (I saved mtd blocks from 0 to 8)
   b) using SSH nanddump /dev/mtdX | gzip -1 -c > /tmp/mtdX.dump.gz (where X = 0, 1, ..., 8) (*see below for further details)

3) Flash openwrt stock using LUCI System > Install matrix

4) After router reboot, upgrade openwrt to the latest stable version (25.12.5)

Now, I am going to try the third script to convert OpenWrt stock to ubootmod. Can I proceed or there is a risk to brick my device? There is some point where to pay extra attention?

*Concerning backup stock firmware, I tried to perform a second backup through nanddump (as it is usually suggested as tool for backup and also to see if there is any difference with the LUCI "System --> Backup / Flash Firmware" functionality) but I found some difficulties, probably because I am not so expert in this field.

The problem was that when I SSH to 192.168.1.1, the responding SSH server was the one of the Zyxel firmware, not the one of the openwrt running in RAM (maybe because the IP was the same). So, as I did not know a method to connect to SSH in RAM (maybe I had to change the IP of the openwrt ram LAN?) I followed these "complex" steps:

  • install luci-app-ttyd and nand-utils with LUCI
  • execute from ttyd LUCI nanddump:

nanddump /dev/mtd0 | gzip -1 -c > /tmp/mtd0.dump.gz
nanddump /dev/mtd1 | gzip -1 -c > /tmp/mtd1.dump.gz
nanddump /dev/mtd2 | gzip -1 -c > /tmp/mtd2.dump.gz
nanddump /dev/mtd3 | gzip -1 -c > /tmp/mtd3.dump.gz
nanddump /dev/mtd4 | gzip -1 -c > /tmp/mtd4.dump.gz
nanddump /dev/mtd5 | gzip -1 -c > /tmp/mtd5.dump.gz
nanddump /dev/mtd6 | gzip -1 -c > /tmp/mtd6.dump.gz
nanddump /dev/mtd7 | gzip -1 -c > /tmp/mtd7.dump.gz
nanddump /dev/mtd8 | gzip -1 -c > /tmp/mtd8.dump.gz

  • create a folder accessible via browser to download mtd dumps
mkdir -p /www/files
cp mtd* /www/files/
uci set uhttpd.main.index_page='index.html'

echo "Files" > /www/files/index.html
for f in /www/files/*; do
bn=$(basename "$f")
echo "$bn" >> /www/files/index.html
done
echo "" >> /www/files/index.html

uci commit uhttpd
/etc/init.d/uhttpd restart

I am sure there is a simpler procedure to use nanddump but I did not know it :sweat_smile:

Finally, I compared the two kinds of backup and I saw there are some differences, in some cases in dimension, in other cases in content. For example:

mtd0 (spi0-1):

LUCI backup: 50,2 MB (52.690.944 byte)

nanddump: 512 MB (536.870.912 byte)

comparing the two files with HxD: "The file sizes vary. However, the beginning of the largest file is identical to that of the smallest file."


mtd6 (ubi)

LUCI backup: 50,0 MB (52.428.800 byte)

nanddump: 40,8 MB (42.801.097 byte)

comparing the two files with HxD, the files seem to be different

Maybe it is normal but I would like to understand why there are such differences ...

In any case, thank you very much! :slight_smile:

Thanks for your detail feedback! I'm glad it worked with the ACEN firmware.

If you switch to the Ubootmod layout, your backups won't be useful, and you cannot go back to ISP firmware by just flashing because ubootmod conversion changes the bootloader and removes NAND structure, and give you some extra space but no functional changes.

Switching won’t brick your router, but reset it to default before running the script, and wait about two minutes for the Ubootmod conversion to complete.

I agree with you that if I switch to ubootmod I cannot restore backup directly but ... if in future I switch again from ubootmod to stock openwrt with your script, it should be possible to restore backup, shouldn't be?