Note that the flashing instructions on the OpenWrt wiki do not work:
run flashimg
Returns the error:
NAND write: device 1 offset 0x0, size 0xa80100
Attempt to write to non page aligned data
NAND write to offset 0 failed -22
0 bytes written: ERROR
This is because the file size of the OpenWrt image (and $filesize
in u-boot env) is not aligned to the page size:
$ wc -c openwrt-ipq40xx-generic-linksys_whw01-squashfs-factory.bin
11010304 openwrt-ipq40xx-generic-linksys_whw01-squashfs-factory.bin
flashimg=tftpboot $loadaddr $image && nand erase $prikern $imgsize && nand write $loadaddr $prikern $filesize
flashimg2=tftpboot $loadaddr $image && nand erase $altkern $imgsize && nand write $loadaddr $altkern $filesize
The NAND page size is 2KiB:
NAND: spi_nand: spi_nand_flash_probe SF NAND ID 0:ef:ab:21
SF: Detected W25M02GV with page size 2 KiB, total 256 MiB
To be page aligned, you need to write 0xa80800
bytes (5377 pages) instead of 0xa80100
(5376.125). The flash area is actually 0x5000000
much larger than the image you write, so there is no adverse effect.
The actual write command(s) should therefore be:
nand write $loadaddr $prikern 0xa80800
nand write $loadaddr $altkern 0xa80800