Upgrading WNDR4700 or apm821xx

Every months there's new update for my WNDR4700, but when I install using sysupgrade page. I loses the USB support since it is installed from outside (uPD72020x-firmware_2_powerpc_464fp.ipk), not only this but I also it broke the package which are installed online such as luci-app-samba, wpad kmod-mii kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-rndis

Is there anyway to update ROM without any problem ? Or Tell me what you do? share your experience with me? @chunkeey

As you probably know, this is an expected behaviour since the packages themselves are not preserved between upgrades, only settings. You could:

  • Compile your own firmware incorporating those packages
  • Use an upgrade script which will reinstall the packages after the upgrade (like this one)
  • Create your own personalized script to run after upgrade
  • Run a one-liner to do that - copy-paste into SSH - this is what I do
1 Like

Since after upgrade wifi and wan gets broken, I have to connect LAN wire then I transfer files using

$scp ~/myofflineipk/*.ipk root@

Then I use ssh to perform manually installation, then I restore setting Backup.
I also need to fix /etc/rc.button/xyz manually

This is the way I upgrade, So I do upgrade when I have 3-4 hour to waste.

Can overly partition help in upgrade consistency ?

You do have 256MB flash size? Maybe you could create a /etc/postinit folder, and add it to /etc/sysupgrade.conf and put your files for default restoration there. Then, sysupgrade preserving settings (not sure if without it the sysupgrade take into consideration the files/folders to preserve but I don't think so). That way you could do opkg install /etc/postinit/mypackage.ipk from that directory after the upgrade. Just a guess thought.

Also add /etc/rc.button/xyz to your /etc/sysupgrade.conf.

And from what I recall, extroot (I suppose that's what you mean by overlay) will just add trouble to a sysupgrade.

Edit: This will still require hardwired access unfortunately, but might help cut down your upgrade time.

Edit2: Most importantly, you would need to update this folder with the packages and dependencies compiled and compatible for the release you plan to upgrade to before such upgrade.

As you can see, compiling your own firmware is clearly the safest/easiest path, that's why it was my first option.

Even if you have enough flash space at your disposal, you can't expect binary packages built for older LEDE versions to be installable or usable in newer versions/ snapshots. Most visibly this will explodes spectacularly for kernel modules, but everything else (except for very simple interpreted binaries)is affected by ABI differences (libc-, ssl versions, etc.). You really do need to install packages matching to your new firmware version, this leaves imagebuilder or building from source as your options.


As connectivity is broken after updating, the only easy update method is to compile a personal firmware with all needed packages included in the image. Then all packages are there right after the flash. Either compile from scratch, or cook up the firmware with imagegenerator.

You can also include your personal settings & scripts (like that button) as "custom files" both with compiling and with imagegenerator.


Not possible for me to compile linux.

looks tough then what I am doing now, since the package are only 4-10, and target is just 1 router.

I am happy with scp. Thanks guys, team LEDE rocks.

I am taking new approach, but before I do that, I want to talk about here

I upgrade my LEDE on WNDR4700 using package lede-17.01.4-apm821xx-nand-WNDR4700-squashfs-sysupgrade.tar located at https://downloads.lede-project.org/releases/17.01.4/targets/apm821xx/nand/
Now when I decompress this lede-17.01.4-apm821xx-nand-WNDR4700-squashfs-sysupgrade.tar, I get 3 file listing

~/sysupgrade-wndr4700$ ls -l
total 4632
-rw-r--r-- 1 user_xyz user_xyz      15 Oct 17 23:16 CONTROL
-rw-r--r-- 1 user_xyz user_xyz 1572880 Oct 17 23:16 kernel
-rw-r--r-- 1 user_xyz user_xyz 3158806 Oct 17 23:16 root

Now, the root file contains squashfs of **/**,
I am thinking to use unsquashfs and mksquashfs command to extract add my desired file K2013080.mem at /lib/firmware/ and repack as squashfs
and replace the new repacked squashfs to the original tar (lede-17.01.4-apm821xx-nand-WNDR4700-squashfs-sysupgrade.tar)

Is this approach going to work ? or I am going to break my router. Or I can do this in better way ( you tell me). I want discus with you guys before I do.

These 2 approach, take lot of effort

One more thing, I found some where how to use mksquashfs, used this command to make root.new file
$ sudo mksquashfs squashfs-root root.new -b 1024k -comp xz -Xbcj powerpc -e boot
[sudo] password for user_xyz:
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on filesystem.squashfs, block size 1048576.
[===============================================================] 869/869 100%
Exportable Squashfs 4.0 filesystem, xz compressed, data block size 1048576
compressed data, compressed metadata, compressed fragments, compressed xattrs
duplicates are removed
Filesystem size 3007.08 Kbytes (2.94 Mbytes)
22.06% of uncompressed filesystem size (13629.08 Kbytes)
Inode table size 8098 bytes (7.91 Kbytes)
20.56% of uncompressed inode table size (39393 bytes)
Directory table size 11086 bytes (10.83 Kbytes)
45.44% of uncompressed directory table size (24395 bytes)
Number of duplicate files found 9
Number of inodes 1191
Number of files 876
Number of fragments 15
Number of symbolic links 209
Number of device nodes 1
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 105
Number of ids (unique uids + gids) 1
Number of uids 1
root (0)
Number of gids 1
root (0)

what should be block size for my router, compression format, etc etc, Kindly comment on these issue too

Hello kdm6389,

I am just curious, did it work out for you ?
Unfortunatly I can't help with this approach you were writing about.
Just asking, because Id be glad to add USB support! So if it worked out, me and for sure some more people would like to read here, how exactly you managed to solve this problem !

No, I did not used that, since no one told to do so. You should not too, until some elder test it, and say go for it. I dont want to blow WNDR4700.