summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2019-02-20 22:38:08 +0200
committerGitHub <noreply@github.com>2019-02-20 22:38:08 +0200
commitc0bdb281d8a23b06bd2cb923a9e57bd24e48c776 (patch)
tree9f5ef15bc68871c0a2d9048badd7f28e25f4f41a
parent24fe4788daaf4d449bf6ec35ec47a5f330b794f8 (diff)
parenta1b0b150e6ae2aad34c16748f4f58e71c792bdf2 (diff)
Merge pull request #2545 from stangri/luci-app-advanced-reboot
luci-app-advanced-reboot: add support for Linksys EA6350v3, fix kerneā€¦
-rw-r--r--applications/luci-app-advanced-reboot/Makefile4
-rw-r--r--applications/luci-app-advanced-reboot/README.md11
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua15
3 files changed, 20 insertions, 10 deletions
diff --git a/applications/luci-app-advanced-reboot/Makefile b/applications/luci-app-advanced-reboot/Makefile
index 08919640d..863709127 100644
--- a/applications/luci-app-advanced-reboot/Makefile
+++ b/applications/luci-app-advanced-reboot/Makefile
@@ -8,12 +8,12 @@ PKG_MAINTAINER:=Stan Grishin <stangri@melmac.net>
LUCI_TITLE:=Advanced Linksys Reboot Web UI
LUCI_DESCRIPTION:=Provides Web UI (found under System/Advanced Reboot) to reboot supported Linksys and ZyXEL routers to\
- an altnerative partition. Also provides Web UI to shut down (power off) your device. Supported dual-partition\
+ an alternative partition. Also provides Web UI to shut down (power off) your device. Supported dual-partition\
routers are listed at https://github.com/stangri/openwrt-luci/blob/luci-app-advanced-reboot/applications/luci-app-advanced-reboot/README.md
LUCI_DEPENDS:=+luci-mod-admin-full
LUCI_PKGARCH:=all
-PKG_RELEASE:=33
+PKG_RELEASE:=38
include ../../luci.mk
diff --git a/applications/luci-app-advanced-reboot/README.md b/applications/luci-app-advanced-reboot/README.md
index 7ed1826ea..781a1c7f7 100644
--- a/applications/luci-app-advanced-reboot/README.md
+++ b/applications/luci-app-advanced-reboot/README.md
@@ -1,13 +1,17 @@
# Advanced Reboot Web UI (luci-app-advanced-reboot)
## Description
+
This package allows you to reboot to an alternative partition on the supported (dual-partition) routers and to power off (power down) your OpenWrt device.
## Supported Devices
+
Currently supported dual-partition devices include:
+
- Linksys EA3500
- Linksys E4200v2
- Linksys EA4500
+- Linksys EA6350v3
- Linksys EA8500
- Linksys WRT1200AC
- Linksys WRT1900AC
@@ -20,19 +24,24 @@ Currently supported dual-partition devices include:
If you're interested in having your device supported, please post in [OpenWrt Forum Support Thread](https://forum.openwrt.org/t/web-ui-to-reboot-to-another-partition-dual-partition-routers/3423).
## Screenshot (luci-app-advanced-reboot)
+
![screenshot](https://raw.githubusercontent.com/stangri/openwrt_packages/master/screenshots/luci-app-advanced-reboot/screenshot01.png "screenshot")
## How to install
+
Install ```luci-app-advanced-reboot``` from Web UI or connect to your router via ssh and run the following commands:
+
```sh
opkg update
opkg install luci-app-advanced-reboot
```
## Notes/Known Issues
+
- When you reboot to a different partition, your current settings (WiFi SSID/password, etc.) will not apply to a different partition. Different partitions might have completely different settings and even firmware.
- If you reboot to a partition which doesn't allow you to switch boot partitions (like stock vendor firmware), you might not be able to boot back to OpenWrt unless you reflash it, losing all the settings.
- Some devices allow you to trigger reboot to an alternative partition by interrupting boot 3 times in a row (by resetting/switching off the device or pulling power). As these methods might be different for different devices, do your own homework.
## Thanks
-I'd like to thank everyone who helped create, test and troubleshoot this package. Without help from [@hnyman](https://github.com/hnyman), [@jpstyves](https://github.com/jpstyves) and many contributions from [@slh](https://github.com/pkgadd) it wouldn't have been possible.
+
+I'd like to thank everyone who helped create, test and troubleshoot this package. Without help from [@hnyman](https://github.com/hnyman), [@jpstyves](https://github.com/jpstyves), [@imi2003](https://github.com/imi2003) and many contributions from [@slh](https://github.com/pkgadd) it wouldn't have been possible.
diff --git a/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
index dd8071677..ab76c3fdf 100644
--- a/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
+++ b/applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
@@ -7,6 +7,7 @@ devices = {
-- deviceName, boardName, partition1, partition2, offset, envVar1, envVar1Value1, envVar1Value2, envVar2, envVar2Value1, envVar2Value2
{"Linksys EA3500", "linksys-audi", "mtd3", "mtd5", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
{"Linksys E4200v2/EA4500", "linksys-viper", "mtd3", "mtd5", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
+ {"Linksys EA6350v3", "linksys-ea6350v3", "mtd10", "mtd11", 192, "boot_part", 1, 2},
{"Linksys EA8500", "ea8500", "mtd13", "mtd15", 32, "boot_part", 1, 2},
-- {"Linksys EA9500", "linksys-panamera", "mtd3", "mtd6", 28, "boot_part", 1, 2},
{"Linksys WRT1200AC", "linksys-caiman", "mtd4", "mtd6", 32, "boot_part", 1, 2, "bootcmd", "run nandboot", "run altnandboot"},
@@ -34,11 +35,11 @@ for i=1, #devices do
boot_envvar2_partition_one = devices[i][10] or nil
boot_envvar2_partition_two = devices[i][11] or nil
if partition_one_mtd and partition_skip then
- partition_one_label = luci.util.trim(luci.sys.exec("dd if=/dev/" .. partition_one_mtd .. " bs=1 skip=" .. partition_skip .. " count=25" .. " 2>/dev/null"))
+ partition_one_label = luci.util.trim(luci.sys.exec("dd if=/dev/" .. partition_one_mtd .. " bs=1 skip=" .. partition_skip .. " count=128" .. " 2>/dev/null"))
n, partition_one_version = string.match(partition_one_label, '(Linux)-([%d|.]+)')
end
if partition_two_mtd and partition_skip then
- partition_two_label = luci.util.trim(luci.sys.exec("dd if=/dev/" .. partition_two_mtd .. " bs=1 skip=" .. partition_skip .. " count=25" .. " 2>/dev/null"))
+ partition_two_label = luci.util.trim(luci.sys.exec("dd if=/dev/" .. partition_two_mtd .. " bs=1 skip=" .. partition_skip .. " count=128" .. " 2>/dev/null"))
n, partition_two_version = string.match(partition_two_label, '(Linux)-([%d|.]+)')
end
if partition_one_label and string.find(partition_one_label, "LEDE") then partition_one_os = "LEDE" end
@@ -63,7 +64,7 @@ for i=1, #devices do
if device_name and device_name == "ZyXEL NBG6817" then
if not zyxelFlagPartition then zyxelFlagPartition = luci.util.trim(luci.sys.exec("source /lib/functions.sh; find_mtd_part 0:DUAL_FLAG")) end
if not zyxelFlagPartition then
- errorMessage = errorMessage .. luci.i18n.translate("Unable to find Dual Boot Flag Partition." .. " ")
+ errorMessage = errorMessage or "" .. luci.i18n.translate("Unable to find Dual Boot Flag Partition." .. " ")
luci.util.perror(luci.i18n.translate("Unable to find Dual Boot Flag Partition."))
else
current_partition = tonumber(luci.sys.exec("dd if=" .. zyxelFlagPartition .. " bs=1 count=1 2>/dev/null | hexdump -n 1 -e '1/1 \"%d\"'"))
@@ -121,7 +122,7 @@ function action_altreboot()
newEnvSetting = curEnvSetting == boot_envvar1_partition_one and boot_envvar1_partition_two or boot_envvar1_partition_one
errorCode = luci.sys.call("/usr/sbin/fw_setenv " .. boot_envvar1 .. " " .. newEnvSetting)
if errorCode ~= 0 then
- errorMessage = errorMessage .. luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar1 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ". "
+ errorMessage = errorMessage or "" .. luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar1 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ". "
luci.util.perror(luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar1 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ".")
end
end
@@ -129,13 +130,13 @@ function action_altreboot()
if boot_envvar2 then
curEnvSetting = luci.util.trim(luci.sys.exec("/usr/sbin/fw_printenv -n " .. boot_envvar2))
if not curEnvSetting then
- errorMessage = errorMessage .. luci.i18n.translate("Unable to obtain firmware environment variable") .. ": " .. boot_envvar2 .. ". "
+ errorMessage = errorMessage or "" .. luci.i18n.translate("Unable to obtain firmware environment variable") .. ": " .. boot_envvar2 .. ". "
luci.util.perror(luci.i18n.translate("Unable to obtain firmware environment variable") .. ": " .. boot_envvar2 .. ".")
else
newEnvSetting = curEnvSetting == boot_envvar2_partition_one and boot_envvar2_partition_two or boot_envvar2_partition_one
errorCode = luci.sys.call("/usr/sbin/fw_setenv " .. boot_envvar2 .. " '" .. newEnvSetting .. "'")
if errorCode ~= 0 then
- errorMessage = errorMessage .. luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar2 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ". "
+ errorMessage = errorMessage or "" .. luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar2 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ". "
luci.util.perror(luci.i18n.translate("Unable to set firmware environment variable") .. ": " .. boot_envvar2 .. " " .. luci.i18n.translate("to") .. " " .. newEnvSetting .. ".")
end
end
@@ -151,7 +152,7 @@ function action_altreboot()
if zyxelNewBootFlag then
errorCode = luci.sys.call("printf \"" .. zyxelNewBootFlag .. "\" >" .. zyxelFlagPartition )
if errorCode ~= 0 then
- errorMessage = errorMessage .. luci.i18n.translate("Unable to set Dual Boot Flag Partition entry for partition") .. ": " .. zyxelFlagPartition .. ". "
+ errorMessage = errorMessage or "" .. luci.i18n.translate("Unable to set Dual Boot Flag Partition entry for partition") .. ": " .. zyxelFlagPartition .. ". "
luci.util.perror(luci.i18n.translate("Unable to set Dual Boot Flag Partition entry for partition") .. ": " .. zyxelFlagPartition .. ".")
end
end