I build my cloud ap firmware.
I need to auto update my router with sysupgrade.
I set crontab to get data from my cloud, download file and upgrade by sysupgrade.
but sysupgrade is not work by crontab.
if I ssh to router and download file and upgrade manual by sysupgrade -n -v /tmp/myfirmware.bin , it works.
I use command mtd -r write /tmp/myfirmware.bin firmware on crontab.
it works for some router model
but my router linksys_ea6350v3.
it shows error .
root@EasyZone:/tmp# mtd -r write easyzone_cloud_ap_linksys_ea6350v3_v2_9_3.bin firmware
Could not open mtd device: firmware
Can't open device for writing!
Please advice me how to resolve this.
Thank you all.
Using plain "mtd" is a historical practice that worked with the old simple small NOR flash devices.
With the current devices with NAND and also dual-boot (for some/most new Linksys devices), plain mtd is simply wrong.
For your specific device, the normal "sysupgrade" needs these device-specific steps in addition to the generic sysupgrade functions.
Note that usually/often kernel and the rootfs are written to different partitions, so the old style of monolithic mtd write is simply wrong.
Ps.
you might also read the device-specific thread about your device in order to find relevant pointers to the sysupgrade process, if you want to avoid the normal (and working) sysupgrade command.
Pps.
Unless you are lucky, an automatic timed sysupgrade done frequently sounds risky, especially if you continue to use the untested development snapshots from buildbot. Sooner or later you may brick the device.
I try to read the script. I 'm not a developer level but I try to get it.
But my main target to find is :
Why I can update my firmware use sysupgrade on my manual ssh shell?
But
Why I can not update my firmware by auto crontab script?
What is the permission on crontab which not allow to update firmware?
My wild guess: During sysupgrade, automatically various processes are killed. May be, the cron process, being parent of sysupgrade, is killed, and the child (i.g. sysupgrade) killed, too, as a consequence. Try to run "sysupgrade -n -v /tmp/firmware.bin &" as detached process from cron.