Planned to do that. RIght now I have too much load form work and university but I'll do it.
Also... Can I run openwrt from USB? Completely from USB? Like flashing a bootloader to the flashchip that does nothing excpet loadinh what inside the first partition it found?
May you elaborate that more? I have a 8MB flashchip and since I also mostly use minimal builds I've never tuched extroot (I even used to remove that feature completely while testing ultra-minimal builds).
I'd either use tar or rsync of with "exclude" rules for the memory-backed and "special" file systems (like /proc/, /dev/, /sys/) and the mount point, or perhaps cp -rp on /rom/ and /overlay/upper/
I built a new image with a custom /etc/config/fstab that automatically mount as overlay the partition with owrt_overlay as label... and it works :3! Now I have a nice image that even at its first boot do not touch (or at least not so much) the flashchip for writing. Now to avoid even more stuffs I should copy things from /rom/ to /overlay/upper/...
To do it properly without overwriting stuffs that should not be overwritten, my idea is:
Get a list of all custom files I modified after the first boot
Files modified / created / automatically by OpenWRT are already inside /overlay/upper/ (and thus in the USB)
Open the sysupgrade image I built like an archive to get a full list of real/non-special/non-memory-backed files existing in the ROM
Merge the lists to get an files to exclude/include lists
Manually copy everything
Or there is a fancy (more intelligent) way to do it? Can I do something like dir / -R (print all directory and subdirs starting from /) but excluding special stuffs?
UPDATE:
I'm dumb. looking at /rom/ (and coping from it) make much more sense u.u i should just copy form rom to upper overlay without overwriting already existing files
I ended up using cp -aRu /rom/* /overlay/upper/... it still works what you think? Are there better ways to do it?
Btw that + customized fstab built-in the image to autoload the overlay even at first boot, now my openwrt image runs 99% of the time from USB. Be careful guys if you follow my exemple, to properly reset your router you have to format (from a pc) the overlay partition BEFORE turning up your router (possibly in failsafe mode) to perform a firstboot command and reset your configuration.
I'm not a big fan of writing directly to the parts of the overlay system. Too much magic going on for me to trust that I've gotten the state properly updated. Mounting it as an overlay (over nothing) would probably be more robust. See Script: Mount "Alternate" NAND Firmware (Linksys +?) for one sketch of how to mount an overlay-intended file system and then apply it as an overlay (over an empty "lower", if you want "everything" copied). (I'm not sure you're writing to an overlay-intended file system. Reading from one that is not mounted as an overlay (and was cleanly unmounted) should be OK to extract the changes.)
"Better"? Probably something like building a kernel and system that runs natively off the USB file system. Worth the time on a TD-W8970? Personal decision.
Possible, yes. Worth the time to custom configure and build a kernel and potentially modify the boot loader environment or code? For me, for a TD-W8970, definitely not.
I might as well buy a new td-w8970 v1.... But man this router thought me so much
I think something related to network in general is broken especially related to Wi-Fi, probably hardware and specific to my router BUUUUT I have to say that, doing these thing got me less crashes:
Wi-Fi disabled if I'm home alone (this helped soooo much)
separating ethernet and Wi-Fi on two networks (192.168.1.X and 192.168.2.X), disabling the bridge
disabling VLAN
connecting only my PC (ethernet) and nothing else (this helped the most combined with no Wi-Fi, but of course the device is much more useless in this configuration)
When I do everything described there I can almost reach 6h of uptime, which is a record but, still not enough.
I'd consider a separate modem and router. That way you can get the best in both for your budget, yet when one fails or becomes underpowered/obsolete, you can swap it out, and still have half your investment still running. At least in the US, the modem-router-wifi units are built as cheaply as possible for sale to the ISPs, where there really isn't any consumer choice. If your TD-W8970v1 is working as a modem, then maybe unloading everything but the modem function will help.
I have a TD-W8980 myself and I use some experimental patches, which have been tested thoroughly and they improved the wifi a lot and also the overall cpu performance and ethernet speed. I use it with a external hdd for torrents and samba mainly because Internet is routed from HH5A. Btw you can also try these patches and hopefully they can improve the performance of your router in general.
At first it was thought that your flash may be corrupted so for that I would choose the overlay option with slightly changing the overlay part. At boot router will need to mount the USB and then, unless restarted, everything runs from the USB. I just modified the copy command to include rom and overlay.
mkdir /mnt/upper
tar -C /rom -cvf - . | tar -C /mnt/upper -xf -
tar -C /overlay -cvf - . | tar -C /mnt -xf -
You just need to execute the above commands in order and then everything should be in USB and your router should work fine.
I just realized that I haven't tried LEDE in a while and never started doing the whole git bisect thing... I rebuilt an image with the same "verbose-as-fuck" i used for master builds and kept the weird network and USB-overlay configuration. The router is still running and I haven't got a crash in 15 hours... And I begin to see things in the crashlogs!
I see this (all lines were starting with <date> kern.warn kernel: [<timestamp>]):
Any guess except that I should post this on bug tracker? Btw the router did not crash after it, kept going for at least 3 hours , until I rebooted it cause I changed some settings.
It seems to be a bug somewhere in the work-queue maybe but if this is LEDE image then it would probably got fixed in 18.06 but if it's not LEDE then it would be a good idea to report it.
Yes it is a lede image, but its the only thing that seems to not crash within 5hours xD If it was already fixed then they may backport it, or point me to its fix, I could try to backport it and try to tackle the next bug...
It doesnt look much mandatory to fix if router is still working for you. It could be just some variable over-flowing. If the build works then stay on it and dont think much about fixing stuff because you cant just backport the entire 18.06, that will be pointless. I'd suggest to just use it as is and maybe wait for 19.x builds.
The strange thing are it looks that it only happen on firmware with VMMC support but please please try it anyway (try to chmod any bigger file that exist from the beginning)