Skip to content

Instantly share code, notes, and snippets.

@halmartin
Created October 15, 2023 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halmartin/60910299d52b13a2934b47ab01235171 to your computer and use it in GitHub Desktop.
Save halmartin/60910299d52b13a2934b47ab01235171 to your computer and use it in GitHub Desktop.
Flashing Linksys Velop (WHW01/VLP01) to OpenWrt

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment