Multi-booting OpenWRT & Zyxel OEM firmware
- I'm posting this just in case so everyone knows how to make it work.
- The how-to instructions that i will be posting here is my own personal method, it's probably not the best or fastest way to flash OpenWRT.
- Try this at your own risk, I am a newbie when it comes to any of this, If you check my previous posts you will see i clearly had no idea what i was doing most of the time and just recently gained some knowledge.
- If anyone has tips for me i'd appreciate it.
This will be part 2 and a continuation of my previous post Adding OpenWrt support for Zyxel EX5601-T0 - #678 by thehybrid1337.
Anyone should still be able to follow even if you didn't use the instructions on part 1.
Most important is :
In my previous post i successfully flashed V570ACDZ36C0.bin using mtkupgrade.
Note : At this moment this is the only firmware on my device, since i had used ubiformat mtd5.mtd6.,mtd7. This means that switching boot partitions will do nothing becaus the other boot partition is empty.
To confirm which ubi partition is being used now enter the following command
cat /proc/cmdline
In my case it is rootubi=ubi so we have to move this firmware to ubi2 and after that flash openwrt on ubi.
If rootubi=ubi here then follow instructions
If rootubi=ubi2 then skip to the part that's about preparing OpenWrt firmware
Screenshot rootubi=ubi
To solve this problem i just Flash the same V570ACDZ36C0.bin again, but this time through the router firmware upgrade page. If you flash firmware through the router page, it automatically writes it to the alternative partition. This is exactly what we want because we cant to keep the 1st ubi partition available to flash OpenWrt on it.
Before flashing the firmware, make sure to enter these 2 commands first there won't be any issues.
zycli fwidcheck off
zycli modelcheck off
After your have flashed the same firmware ( or different maybe ). After the reboot type the following in the serial console or SSH terminal
cat /proc/cmdline
instead of rootubi=ubi, it should print out rootubi=ubi2 now.
Screenshot Rootubi=ubi2
This means we are ready to flash OpenWRT on the other partition.
Preparing the OpenWRT firmware.
If you don't want to bother doing this part yourself, there will be a ready to flash firmware on the end of the post.
If you want to do this part yourself.
We can download the 'sysupgrade' for zyxel ex5601-t0 with the stock layout on the OpenWrt website.
To be able to be compatible to multi-boot with Zyxel's firmware, we need to add 'zyfwinfo' to this sysupgrade we just downloaded.
This is required because 'zloader' checks for this in the firmware and won't boot without it if it fails checksum..
'zyfwinfo' is nothing too crazy or difficult but i found a generator on github with instructions making this proces a lot easier. Thanks @skyscreaper pameruoso/OpenWRT-Zyxel-EX5601-T0: Porting openwrt to Zyxel-EX5601-T0
The only file you'll need is gen_zyfwinfo.sh unless you have an sfp port as WAN.
Make a new folder and move the sysupgrade you've downloaded from the OpenWrt website there, in my case it's 'openwrt-24.10.0-mediatek-filogic-zyxel_ex5601-t0-stock-squashfs-sysupgrade.bin'
Run gen_zyfwinfo.sh to generate a zyfwinfo file.
Make another folder in here called "sysupgrade-zyxel_ex5601-t0-stock"
place file 'zyfwinfo' that you've generated . in folder called "sysupgrade-zyxel_ex5601-t0-stock"
Screenshot folder structure
Run the following command to include the zyfwinfo in the firmware.
tar -rf openwrt-24.10.0-mediatek-filogic-zyxel_ex5601-t0-stock-squashfs-sysupgrade.bin sysupgrade-zyxel_ex5601-t0-stock
The sysupgrade file is now compatible.
openwrt-24.10.0-mediatek-filogic-zyxel_ex5601-t0-stock-squashfs-sysupgrade.bin
I've already made the above one compatible and can confirm it works.
Flashing OpenWRT to Ubi
Restart your router and stop the autoboot.
If you are greeted with (bootflag 1)
> Current bootflag is 1
BOARD_DETECT_BY_GPIO=>result=2
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: 9/7, WL threshold: 4096, image sequence number: 138894891
ubi0: available PEBs: 0, total reserved PEBs: 256, PEBs reserved for bad PEB handling: 38
Reading from volume 'zyfwinfo' to 0x7fb47690, size 0x100 ... OK
ubi0: detaching mtd8
ubi0: mtd8 is detached
Multiboot clinent version: 2.7
Hit any key to stop autoboot: 5
ZHAL>
It means you are on ubi2 and have to switch partitions first before flashing OpenWRT
Enter the following commands to switch partititon
ATBT 1
ATSW
After this a reboot is required to switch the partitions so
ATSR
Above command will work, power cycling the router will also work.
Stop the autoboot and this time you will be greeted with ( bootflag 0 )
> Current bootflag is 0
BOARD_DETECT_BY_GPIO=>result=2
ubi0: attaching mtd7
ubi0: scanning is finished
ubi0: attached mtd7 (name "ubi", 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: 13/8, WL threshold: 4096, image sequence number: 1309732647
ubi0: available PEBs: 0, total reserved PEBs: 256, PEBs reserved for bad PEB handling: 38
Reading from volume 'zyfwinfo' to 0x7fb47690, size 0x100 ... OK
ubi0: detaching mtd7
ubi0: mtd7 is detached
Multiboot clinent version: 2.7
This means we are on the correct partition and ready to flash OpenWRT on it.
I will be using mtkupgrade to flash the firmware via the u-boot console.
To be able to get to U-boot Console.
Enter the following command and stop autoboot.
ATGU
ZHAL> prompt yet again but just repeat the same command.
ATGU
There should be MT796> Prompt.
I will flash the firmware by TFTP like i had done previously before.
Screenshot mtkupgrade
mtkupgrade
2 - Firmware
Run image after upgrading? : Yes
0 - TFTP Client
U_Boots ip:192.168.1.1
TFTP servers ip :192.168.1.254
Subnetmask : 255.255.255.0
file name : openwrt-24.10.0-mediatek-filogic-zyxel_ex5601-t0-stock-squashfs-sysupgrade.bin
If it sucessfully boots up without any zyfwinfo errors and
cat/proc/cmdline showing rootubi=ubi.
Sucessfully flashed OpenWRT on ubi and Zyxel OEM on ubi2.