使用openwrt的小伙伴越來越多,大家比較熟悉的一般是用luci網(wǎng)頁升級,其中會有很多使用openwrt的小伙伴來問:openwrt用命令怎么升級固件?今天就來說說通過命令sysupgrade實現(xiàn)openwrt升級固件,脫離luci用命令行更新固件。使用命令行實現(xiàn)openwrt升級固件:
1、使用mobaxterm(等ssh終端工具登錄,passwd修改默認密碼比如abcabc,然后路由器會自動ssh模式,然后用ssh登錄路由器的(命令ssh?root@192.168.1.1--- 您的openwrt IP)。
2、使用winSCP,準(zhǔn)備好要刷的固件,然后用scp協(xié)議連接到路由器,然后上傳固件文件到tmp文件夾中。
3、上傳完成后,在ssh終端輸入命令 sysupgrade /tmp/openwrt-squashfs-sysupgrade.bin(這個.bin文件是你之前上傳到tmp文件夾的固件,這個命令中的固件名稱也要改成你實際上傳的固件名稱來使用)
不清楚sysupgrade怎么用可以先全用命令sysupgrade --help 查看用法:
sysupgrade --help
Usage: /sbin/sysupgrade [<upgrade-option>...] <image file or URL>
/sbin/sysupgrade [-q] [-i] <backup-command> <file>
upgrade-option:
-d <delay>? ?add a delay before rebooting
-f <config>??restore configuration from .tar.gz (file or url)
-i? ?? ?? ???interactive mode
-c? ?? ?? ???attempt to preserve all changed files in /etc/
-n? ?? ?? ???do not save configuration over reflash
-T | --test
Verify image and config .tar.gz but do not actually flash.
-F | --force
Flash image even if image checks fail, this is dangerous!
-q? ?? ?? ???less verbose
-v? ?? ?? ???more verbose
-h | --help??display this help
backup-command:
-b | --create-backup <file>
create .tar.gz of files specified in sysupgrade.conf
then exit. Does not flash an image. If file is '-',
i.e. stdout, verbosity is set to 0 (i.e. quiet).
-r | --restore-backup <file>
restore a .tar.gz created with sysupgrade -b
then exit. Does not flash an image. If file is '-',
the archive is read from stdin.
-l | --list-backup
list the files that would be backed up when calling
sysupgrade -b. Does not create a backup file.
4、直接開始刷固件,等待刷機完成。升級完成后,系統(tǒng)會自動重啟.......