OpenWrt/Upgrade

OpenWrt/Upgrade

升级 OpenWrt

如果已经是 OpenWrt,可以直接在 luci web 界面里升级固件。(当然也可以在 breed 里直接刷)

也可以在 OpenWrt ssh 里直接升级固件(注意固件必须放到 /tmp/ 下)

sysupgrade -v /tmp/*.bin
# add the `-n` option if you DO NOT want to preserve any old configuration files and configure upgraded device from clean state (network/system settings will be lost as well)

可选 (sysupgrade alternative)

mtd -r write /tmp/openwrt-ar71xx-generic-wzr-hp-ag300h-squashfs-sysupgrade.bin firmware

Keep settings

The “Keep settings” checkbox is a more advanced feature. It performs OpenWrt backup before upgrade and restores it after upgrade. Checking it will preserve several specific config files on the upgrade, but not the whole overlay partition. Only check the “Keep settings” checkbox on minor OpenWrt → OpenWrt bug fix upgrades that are known to not change the config structure.

The default upgrade on command line will automatically preserve basic OpenWrt configuration by saving and then restoring configuration files in default locations (/etc/config). This will preserve things like network settings, WiFi settings, the device hostname, and so on. A OpenWrt command line upgrade by default preserves the following configuration files:

listed by opkg list-changed-conffiles
listed within the text files in /lib/upgrade/keep.d/ (for example, /lib/upgrade/keep.d/base-files-essential)
listed in /etc/sysupgrade.conf

Custom installed packages and their own configuration will not be preserved, so it may be necessary to document your programs and save the settings that will need to be re-installed or restored after the upgrade. There are scripts available from OpenWrt forum to deal with that automatically. If you want to make some manual notes about installed packages: (script by user valentijn)

awk '/^Package:/{PKG= $2} /^Status: .*user installed/{print PKG}' /usr/lib/opkg/status

/etc/sysupgrade.conf 里列出的目录和文件(每行1个。注意不能使用*通配符)会在升级时保留

推荐做法:在 /etc/sysupgrade.conf 里加一行 /root 。所有自己增加的脚本和配置文件都放到 /root 里。


Last update: 2020-06-04 08:17:01 UTC