Skip to content

The Zyxel PMG3000-D20B (T&W board, 8 MiB of flash) is supported by Peter-Pon since r696: the release includes a converter, pmg3000.sh, with its PC side pmg3000_pc.sh and the instructions in PMG3000.txt. It writes the same image as every other stick over the two firmware slots and the Config partition, as a single slot, and it can undo everything from a backup kept on the PC.

Experimental

The converter was built from the flash dumps of three modules and from the disassembled boot loader, and tested on a simulated module; one tester's module runs Peter-Pon, installed by hand with r684 (see the first installation by hand). Have a 3.3 V USB-TTL adapter (115200 8N1) on the UART pins and a terminal program that can send a file with YMODEM for the first conversions.

The flash has no room for both firmwares at once: for about one minute, while the last part is written, there is no firmware the boot loader can start. If the power fails in that minute, the stick stops at the U-Boot prompt and only the serial console brings it back (if it stops at the boot loader). The same holds for one minute of the way back. Use a stable power source and do not touch the stick while it works by itself.

The converter checks the boot loader against the two builds it knows (U-Boot 2011.12-lantiq-gpon-1.2.16, releases svn24575 and gDCC7715) and refuses anything but 64 MiB of RAM: the other T&W sticks (HALNy, Zisa, D-LINK) are not supported by it.

Flash layout before and after ​

The original layout has two firmware slots of 3648 KiB (ImageA and ImageB), each with a 512-byte T&W header followed by the kernel and a SquashFS root filesystem, the JFFS2 settings partition Config (mounted on /tmp/config) and the factory record SECTION_EGIS (laser calibration, MAC address, factory identity). Peter-Pon is written as it is (uImage, EROFS root filesystem, settings) over ImageA, ImageB and Config, as one 7680 KiB slot called linux. Boot loader, environment and SECTION_EGIS do not move, and Boot and SECTION_EGIS are never written.

Original layout (8 MiB)BootImageA (mtd2)3648 KiB: T&W header + kernel + SquashFSImageB (mtd3)3648 KiB: T&W header + kernel + SquashFSConfig0x0700000x4000000x790000After pmg3000.sh convert (8 MiB)ubootlinux: Peter-PonuImage + EROFSsettings(overlay)0x0700000x7F0000Env / uboot_env 64 KiB (one copy)SECTION_EGIS 64 KiB: calibration, MAC, identity (never written)
RangeOriginalAfter the conversion
0x000000–0x060000Boot, 384 KiBuboot, 384 KiB (read only, never written)
0x060000–0x070000Env, 64 KiB, one copyuboot_env, 64 KiB, one copy (only the boot chain changes)
0x070000–0x400000ImageA, 3648 KiBlinux, 7680 KiB: Peter-Pon and its settings
0x400000–0x790000ImageB, 3648 KiB(part of linux)
0x790000–0x7F0000Config, 384 KiB(part of linux)
0x7F0000–0x800000SECTION_EGIS, 64 KiBSECTION_EGIS, 64 KiB (read only, never written)
before: mtdparts=sflash:384k(Boot),64k(Env),3648k(ImageA),3648k(ImageB),384k(Config),64k(SECTION_EGIS),...
after:  mtdparts=sflash:384k(uboot)ro,64k(uboot_env),7680k(linux),64k(SECTION_EGIS)ro

The original firmware and its settings then exist only in the backup on the PC. The stick has a single slot: upgrades keep the settings, and the Flash page shows the one slot without copy, switch or test.

How the stick boots ​

The original boot command tw_boot is a command inside the T&W boot loader: it reads active_image (A / B), checks the 512-byte T&W header of the slot and the CRC of the image behind it, flips to the other slot on a failure and stops at the prompt when both are bad. It cannot start Peter-Pon, which has no T&W header, and it always hands the kernel the original partition names. The converter writes in the environment the generic Lantiq boot chain, which the built-in settings of the boot loader already carry unused, with the new map:

bootcmd=run boot_image0
boot_image0=run kernel0_from_sf flashargs addmtdparts0 addmisc && bootm ${ram_addr}
kernel0_from_sf=sf probe 0;sf read ${ram_addr} ${kernel0_offs} ${max_kernel_size}
kernel0_offs=0x70000
max_kernel_size=<the kernel + 10 %>
ram_addr=80F00000
machtype=SFP
flashargs=setenv bootargs rootfstype=squashfs,jffs2
addmtdparts0=setenv mtdparts mtdparts=sflash:384k(uboot)ro,64k(uboot_env),7680k(linux),64k(SECTION_EGIS)ro
addmisc=setenv bootargs ${bootargs} ethaddr=${ethaddr} machtype=${machtype} ignore_loglevel vpe1_load_addr=0x83f00000 vpe1_mem=1M mem=63M ${mtdparts}
ethaddr=<the MAC address in SECTION_EGIS>

There is no console= and no ip=, like with tw_boot: the serial console stays as the stick had it, and Peter-Pon answers on 192.168.1.1.

The environment has one copy

If the power fails while the environment is being written (by the converter, an upgrade or a setting), the boot loader loses it and saves its built-in settings, which start with tw_boot and find no image they can start: the stick stops at the U-Boot prompt. sh /tmp/pmg3000.sh recovery prints the lines that start Peter-Pon again from there, with the MAC address and kernel size of the stick: keep a copy after each upgrade.

Optical calibration ​

On the Zyxel the laser calibration is not in the goi_config U-Boot variable like on the Huawei MA5671A: it is a tar.gz in SECTION_EGIS (mtd5, 0x7F0000), together with the factory identity and the MAC address. The original firmware unpacks it at boot with /etc/init.d/load_egis_file.sh into /tmp/egis, linked from /etc/config:

/etc/config/goi_config -> /tmp/egis/config/goi_config
/etc/config/goi_defaults -> /tmp/egis/config/goi_defaults
FileContent
goi_configoptical calibration
goi_defaultsreference values
goi_table_laser_ref.csv, goi_table_laser_ref_base.csvlaser references
goi_table_mpd_resp_corr.csvmonitor photodiode correction
goi_table_pth_corr.csvlaser threshold correction
goi_table_vapd_bd.csvAPD voltage
goi_table_text_corr.csvtemperature compensation
goi_table_rssi1490_corr.csvreceived power calibration
rssi_parameterRSSI parameters

Since r696 Peter-Pon reads the calibration from SECTION_EGIS by itself at every start, with the APD supply calibration and the TX fault pin of this board: the calibration is not converted and does not need to be exported. The boot loader reads SECTION_EGIS at every start and rewrites it with built-in defaults when its CRC is wrong, so it must never be written, on any firmware.

DANGER

Every stick must use its own calibration: never copy the calibration or the SECTION_EGIS of another stick.

Procedure ​

You need a PC on the network of the stick, the files pmg3000.sh, pmg3000_pc.sh and *sysupgrade.bin of the release, and 30 minutes. <user> is the login on the stick, which must be root. Before starting, write down the GPON serial number and the PLOAM password used on your line (the original web UI shows them): Peter-Pon asks for them.

Legacy SSH algorithms

The SSH server (Dropbear) of the original firmware may offer only legacy algorithms, which the recent OpenSSH clients disable: ssh and scp then fail with no matching host key type or no matching key exchange method. Add the options named by the message:

sh
SSH_OPTS='-o HostKeyAlgorithms=+ssh-rsa -o KexAlgorithms=+diffie-hellman-group1-sha1' sh pmg3000_pc.sh backup <user>@<module> pmg3000_backup

scp -O uses the legacy SCP protocol, because the stick has no SFTP server.

Every step stops with a plain message when something is not as expected, and nothing is written before all its checks have passed. A power cut before "the module works by itself": start the stick again and run the same command again. sh /tmp/pmg3000.sh status says where the stick is and what comes next.

1. Backup (Linux / macOS, original firmware with SSH) ​

sh
sh pmg3000_pc.sh backup <user>@<module> pmg3000_backup

It copies the six partitions (boot env imagea imageb config egis, 8 MiB) to the folder pmg3000_backup, with MD5SUMS, SHA256SUMS and a manifest, and checks every copy on the stick. Config, which the original firmware writes while it runs, is saved as it was when read. The manifest also has the CRC32 of imageb.bin, needed by the serial recovery.

Keep the folder twice (e.g. on a second disk): it is the only way back and the only other copy of the laser calibration and of the identity of the stick, so never send it to anyone. Do not restart the stick between this step and the next one.

2. Convert ​

sh
scp -O <the .bin file> <user>@<module>:/tmp/
ssh <user>@<module> 'sh /tmp/pmg3000.sh convert --dry-run /tmp/<the .bin file>' > pmg3000_backup/convert_plan.txt
ssh <user>@<module> 'sh /tmp/pmg3000.sh convert /tmp/<the .bin file>'

convert_plan.txt names every write and holds the lines to type at the U-Boot prompt for this stick: keep it with the backup (it contains the MAC address, mask it if you send it). When the last command says that the module works by itself, the SSH session stops answering and the serial console shows the progress; after about three minutes the stick restarts into Peter-Pon (the first start takes about two minutes) and answers on 192.168.1.1. Do not power it off before that.

Telnet only or Windows ​

The same steps by hand, with the files sent through busybox nc (<pc> is the address of the PC, which needs ncat):

sh
# copy the tool
PC:     ncat -l 9000 --send-only < pmg3000.sh
stick:  nc <pc> 9000 > /tmp/pmg3000.sh
stick:  sh /tmp/pmg3000.sh backup ; mkdir -p /tmp/pmg3000

Then for each NAME in boot env imagea imageb config egis:

sh
PC:     ncat -l 9000 > NAME.bin
stick:  sh /tmp/pmg3000.sh read NAME | nc <pc> 9000
PC:     ncat -l 9000 --send-only < NAME.bin
stick:  nc <pc> 9000 > /tmp/pmg3000/NAME.bin
stick:  sh /tmp/pmg3000.sh verify-backup NAME

If a check fails, read that partition again and repeat the other lines. Then send the image to /tmp the same way and run the two convert lines of step 2 on the stick, keeping what the dry run prints.

Going back to the original firmware ​

From Peter-Pon (user root), with the backup folder:

sh
sh pmg3000_pc.sh restore root@<module> pmg3000_backup

It uploads the six files and starts the way back from RAM: Config, the environment (the backup's, with tw_boot again), ImageB, ImageA, then a restart into the original firmware (about three minutes, with the same one-minute rule). Then run the same command once more: it ends with the way back is complete. sh pmg3000_pc.sh compare root@<module> pmg3000_backup reads every partition again and compares it with the folder (Config differs, as expected).

By hand: send pmg3000.sh to /tmp and the six files to /tmp/pmg3000/, then run sh /tmp/pmg3000.sh restore.

If it stops at the boot loader ​

The serial console shows ImageA head check ERROR and ImageB ... ERROR, or Bad Magic Number / Bad Data CRC, then the U-Boot prompt. Boot loader and SECTION_EGIS are untouched. Type or paste one line at a time:

A. Peter-Pon was running and nothing was being converted, restored or upgraded when the power failed (only the boot settings were lost): type the setenv lines of convert_plan.txt (or of the last sh /tmp/pmg3000.sh recovery), then saveenv, then boot.

B. In every other case, or when you are not sure, put the original firmware back from imageb.bin of the backup, sent with YMODEM (about 6 minutes at 115200 baud). XXXXXXXX is the CRC32 printed by the backup and written in manifest.txt:

loady 0x80F00000
crc32 0x80F00000 ${filesize} 0x80E00000
if itest *0x80E00000 == 0xXXXXXXXX; then sf probe 0 && sf erase 0x400000 0x390000 && sf write 0x80F00000 0x400000 ${filesize} && echo WRITTEN; else echo FILE-BAD; fi
boot

Only WRITTEN means that the flash was written; after FILE-BAD send the file again. The original firmware starts, then sh /tmp/pmg3000.sh status says the next step: convert again, or restore with the six files uploaded.

DANGER

Type nothing else at that prompt, and no other sf erase: 0x000000–0x070000 is the boot loader and its environment, 0x7F0000 is the factory record of the stick.

The first installation by hand (r684) ​

Before the converter existed, Peter-Pon r684 was installed by hand on a PMG3000-D20B via SSH. It used a different layout, which kept Config: ImageA and ImageB merged into a 7296 KiB linux partition.

VariableOriginalBy hand
bootcmdtw_bootrun boot_image0
kernel0_offs0x70200 (after the T&W header)0x70000
max_kernel_size180000200000
flashargssetenv bootargs rootfstype=squashfs,jffs2setenv bootargs rootfstype=erofs,jffs2
addmtdparts0...3648k(ImageA),3648k(ImageB),0x60000(Config),0x10000(SECTION_EGIS),2624k@1472k(rootfs)...384k(uboot)ro,64k(uboot_env),7296k(linux),384k(Config)ro,64k(SECTION_EGIS)ro
The commands used
sh
dd if=/tmp/r684.bin of=/tmp/r684-A.bin bs=65536 count=57
dd if=/tmp/r684.bin of=/tmp/r684-B.bin bs=65536 skip=57
fw_setenv kernel0_offs 0x70000
fw_setenv max_kernel_size 200000
fw_setenv flashargs 'setenv bootargs rootfstype=erofs,jffs2'
fw_setenv addmtdparts0 'setenv mtdparts mtdparts=sflash:384k(uboot)ro,64k(uboot_env),7296k(linux),384k(Config)ro,64k(SECTION_EGIS)ro'
fw_setenv bootcmd 'run boot_image0'
mtd write /tmp/r684-B.bin ImageB
mtd write /tmp/r684-A.bin ImageA
mtd verify /tmp/r684-A.bin ImageA
mtd verify /tmp/r684-B.bin ImageB

The image was split at the size of ImageA (57 × 64 KiB) because the mtd tool of the original firmware cannot write across two partitions. reboot did not restart the stick: it had to be pulled out and inserted again.

r684 did not read the calibration of the Zyxel: it used generic values, so the stick stayed in O1, with zero received power and a temperature of about −118 °C. The calibration was still in SECTION_EGIS (and in the full backup): goi_config and the optical tables were taken from there and adapted to the format of r684 (header of the laser table, APD converter parameters in the right sections, receiver voltage table rebuilt from the original values), without raising the laser power. /etc/fw_env.config was also corrected: the firmware looked for two copies of the U-Boot environment while the Zyxel has one, so reading it gave Bad CRC, although the CRC of the real data was valid. After a reboot the optical temperature was 47–49 °C and the stick reached O5:

Value
Board shown by the web UIPMG3000-D20B
PLOAM stateO5, in service
Received power (1490 nm)−22.0 dBm
Transmitted power (1310 nm)3.0 dBm
Temperature (laser / chip)47.9 °C / 65.8 °C
Link to the router1000M, full duplex

Since r696 both fixes are part of the firmware: it reads the single copy of the environment and the calibration of SECTION_EGIS by itself.

Copyright © 2022-2026. The documentation hereby found is distributed under the terms of the MIT License. Any external reference, link or software retains its original license and is not under the control of this website. Privacy Policy.