OpenWrt support for Zyxel PMG5617GA, first GPON support !?

The man from the next topic has advanced a bit on this issue. In his repository, he was building a working kernel version 5.9.9.

README.md

Bootloader

Bootloader sources: mtk/bootrom.

Emacs modes for hiding {} blocks (hs-minor-mode), for hiding ifdefs (hide-ifdef-mode), will be helpfull. The sources include SPI and NAND code, 7512 ethernet code, even leds (light diods) IO configs.

Bootloader may support jump addr command. The command will call function (jump to) at addr. tftp will save file to TFTP_BUF_BASE: 0x80020000 addr. (net/tftpput.c).

$ nm output/build/linux-custom/vmlinux | grep kernel_en 80020000 T __kernel_entry 802c48c8 T kernel_entry

__kernel_entry will jump to kernel_entry. kernel_entry is linux entry point. __kernel_entry is defined in arch/mips/kernel/head.S under #if CONFIG_BOOT_RAW. Selecting TC3262 CPU will "select" this option.

vmlinux includes ELF header. arch/mips/boot/vmlinux.bin is vmlinux with ELF header removed (by objcopy) and can be used with jump command.

When vmblinux.bin is uploaded, tftp will not write the file to flash and will complain that file name is invalid, but that is OK and jump 80020000 command can be called.

Did not test this yet:

flash dst src len command will call flash_write(dst, len, &retlen, (const unsigned char *) (src)) src should be set to TFT_BUF_BASE. dst.. go figure.

On power-up, bootloader calls boot_kernel (init/main.c) which loads image, performs tests and jumps to loaded kernel memory address. First, the trx_header (mtk/tools/trx/trx.h) struct len, magic, crc32 will be read from flash and compared. trx_header address: flash_base + flash_tclinux_start. The variables set in flash/flashhal.c, in *_init functions. 0x0 + 0x40000 * 2 if IS_NANDFLASH and TCSUPPORT_BB_NAND, flash command dst will be 0x80000.

1 Like