The Nokia G-010S-A (CIG board) is supported by Peter-Pon, but its flash has a different layout from the one of the Huawei MA5671A / Nokia G-010S-P and a different U-Boot (U-Boot 2015.04-lantiq-gpon-1.3.6.1). The release includes a converter, g010sa.sh, with its PC side g010sa_pc.sh and the instructions in G010SA.txt: it converts the flash to the two-slot layout of the G-010S-P and installs Peter-Pon in one step, and it can undo everything from a backup kept on the PC.
WARNING
The conversion keeps the laser calibration (goi_config, in the U-Boot environment), but it overwrites the identity partitions (ri, sfp, ribackup) and the Nokia settings (configfs, logfs): from then on they exist only in the backup on the PC. Write down the GPON serial number and the PLOAM password before starting: Peter-Pon asks for them.
install.sh refuses an unconverted G-010S-A, and also a G-010S-A whose U-Boot is not the 1.3.6.1 build: do not run it for the first install, g010sa.sh installs Peter-Pon itself.
Flash layout before and after
The original layout has two 6 MiB firmware slots, followed by the Nokia partitions. The Peter-Pon image (6.5 MiB for r696) does not fit in a 6 MiB slot. The conversion moves the slot boundaries to the ones of the G-010S-P (0x0C0000 and 0x800000): boot loader and environment do not move, the original firmware stays in the new image0 for the way back, and Peter-Pon is written in the new image1, over the end of the old image1, configfs and logfs.
| Range | Original | After the conversion |
|---|---|---|
0x000000–0x040000 | uboot | uboot (never written) |
0x040000–0x0C0000 | uboot_env | uboot_env (only the boot variables change) |
0x0C0000–0x6C0000 | linux / image0, 6 MiB | image0: the original Nokia firmware, untouched |
0x6C0000–0x800000 | first 1.25 MiB of image1 | image0: erased (the tail of the new 7424 KiB slot) |
0x800000–0xCC0000 | rest of image1 | image1: Peter-Pon |
0xCC0000–0xDC0000 | configfs (Nokia settings) | image1: Peter-Pon |
0xDC0000–0xFD0000 | logfs (logs) | image1: Peter-Pon and its settings area |
0xFD0000–0x1000000 | ri, sfp, ribackup (identity) | image1: settings area, formatted by Peter-Pon at its first start |
before: mtdparts=sflash:256k(uboot)ro,512k(uboot_env),6144k(linux),6144k(image1),1024k(configfs),2112k(logfs),64k(ri),64k(sfp),64k(ribackup)
after: mtdparts=sflash:256k(uboot)ro,512k(uboot_env),7424k(image0),8192k(linux)How the slot is chosen
The G-010S-A U-Boot chooses the slot with the Nokia variables commit / next_active and keeps a boot counter (boot_fail) that it increments and saves at every start: at 8 it switches to the other slot. The conversion replaces the slot choice with the MA5671A one, which uses committed_image and imageN_is_valid and resets the counter at every start.
| Variable | After the conversion |
|---|---|
select_image | the MA5671A one (committed_image, image0_is_valid, image1_is_valid), with setenv boot_fail 0 |
bootcmd | run flash_flash |
addmtdparts0 | setenv mtdparts mtdparts=sflash:256k(uboot)ro,512k(uboot_env),7424k(linux),8192k(image1) |
addmtdparts1 | setenv mtdparts mtdparts=sflash:256k(uboot)ro,512k(uboot_env),7424k(image0),8192k(linux) |
kernel1_offs | 0x800000 |
max_kernel_size | raised when the Peter-Pon kernel needs it |
image0_is_valid, image1_is_valid | 1, 1 |
committed_image | 1 (Peter-Pon) |
g010sa_backup | the MD5 of the nine verified backup files, used by the way back and to resume after a power cut |
goi_config (laser calibration) and the identity variables are never written. If goi_config is the generic default built into this U-Boot (the settings of the stick were reset at some time), the script warns that the laser runs on generic values on any firmware.
Procedure
You need a PC on the network of the stick with ssh and scp, the files g010sa.sh, g010sa_pc.sh and *sysupgrade.bin of the release, and about 20 minutes. The stick must be running from its first slot (image0), the normal case. <user> is the login of the stick: ONTUSER on the Nokia firmware, root on the other ones.
Legacy SSH algorithms
The SSH server (Dropbear) of the original Nokia firmware only offers the legacy ssh-rsa host key, which the recent OpenSSH clients disable: ssh and scp then fail with no matching host key type found. Their offer: ssh-rsa. Enable it for the stick on every command:
ssh -o HostKeyAlgorithms=+ssh-rsa <user>@<module>
scp -O -o HostKeyAlgorithms=+ssh-rsa FILE <user>@<module>:/tmp/For the PC script, pass it with SSH_OPTS:
SSH_OPTS='-o HostKeyAlgorithms=+ssh-rsa' sh images/g010sa_pc.sh backup <user>@<module> g010sa_backup-O makes scp use 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. After a power cut during a step, start the stick again and run the same command again. sh /tmp/g010sa.sh status says where the stick is and what comes next.
1. Backup (Linux / macOS)
sh images/g010sa_pc.sh backup <user>@<module> g010sa_backupIt copies the nine partitions (uboot uboot_env image0 image1 configfs logfs ri sfp ribackup, 16 MiB) to the folder g010sa_backup, with MD5SUMS, SHA256SUMS and a manifest, and checks every copy on the stick. logfs changes at every login, so it is saved as it was when read. Keep the folder twice (e.g. on a second disk): it is the only way back, and it holds the serial number, the password and the laser calibration of the stick, so never send it to anyone. Do not restart the stick between this step and the next one.
2. Convert and install
scp -O images/*sysupgrade.bin <user>@<module>:/tmp/
ssh <user>@<module> 'sh /tmp/g010sa.sh convert --dry-run /tmp/<the .bin file>'
ssh <user>@<module> 'sh /tmp/g010sa.sh convert /tmp/<the .bin file>'
ssh <user>@<module> rebootOn the Nokia firmware, convert stops the log service and unmounts /configs and /logs by itself (since r696; with r684 this had to be done by hand with killall syslogd; umount /logs; umount /configs). It leaves the serial console off, so that the router sees the module.
The stick keeps its network until Peter-Pon is written. After the reboot Peter-Pon runs from image1; the next versions are installed with install.sh like on the G-010S-P.
Windows
The same steps, one command at a time from cmd.exe (not PowerShell), in the folder with the files:
scp -O g010sa.sh <user>@<module>:/tmp/g010sa.sh
ssh <user>@<module> "sh /tmp/g010sa.sh backup"
ssh <user>@<module> "mkdir -p /tmp/g010sa"Then for each NAME in uboot uboot_env image0 image1 configfs logfs ri sfp ribackup:
ssh <user>@<module> "sh /tmp/g010sa.sh read NAME" > NAME.bin
scp -O NAME.bin <user>@<module>:/tmp/g010sa/NAME.bin
ssh <user>@<module> "sh /tmp/g010sa.sh verify-backup NAME"If a check fails, read that partition again and repeat the other two commands. Then continue with step 2.
Going back to the original firmware
The way back has two stages and puts back every byte of the flash from the backup folder:
sh images/g010sa_pc.sh restore <user>@<module> g010sa_backup
ssh <user>@<module> reboot
sh images/g010sa_pc.sh restore <user>@<module> g010sa_backupStage 2 also unmounts /configs and /logs by itself. sh images/g010sa_pc.sh compare <user>@<module> g010sa_backup reads every partition again and compares it with the folder (logfs differs, as expected).
On Windows: copy g010sa.sh to the stick again, upload image0.bin and uboot_env.bin to /tmp/g010sa/, run sh /tmp/g010sa.sh restore, reboot, then copy g010sa.sh again, upload image1, configfs, logfs, ri, sfp, ribackup and uboot_env and run it again.
Problems
Send the project the output of sh /tmp/g010sa.sh status, the error message and what the serial console prints: never the backup folder.