base-files: sysupgrade: support additional mtd options
authorDavid Bauer <mail@david-bauer.net>
Mon, 31 Dec 2018 15:24:26 +0000 (16:24 +0100)
committerMathias Kresin <dev@kresin.me>
Sat, 26 Jan 2019 20:46:32 +0000 (21:46 +0100)
Add support for passing additional parameters to mtd called during
sysupgrade. It will be required to toggle the "recovery moe" flag
supported by recent tp-link boards.

Signed-off-by: David Bauer <mail@david-bauer.net>
[split code from board support patch; add commit message]
Signed-off-by: Mathias Kresin <dev@kresin.me>
package/base-files/files/lib/upgrade/common.sh
package/base-files/files/sbin/sysupgrade

index 8ee07494a38af524c017ec1ad9ae2b7a9b773f74..b3a29fb32e31901c9d657d9751a8502553cf554a 100644 (file)
@@ -223,9 +223,9 @@ indicate_upgrade() {
 default_do_upgrade() {
        sync
        if [ "$SAVE_CONFIG" -eq 1 ]; then
-               get_image "$1" "$2" | mtd $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}"
+               get_image "$1" "$2" | mtd $MTD_ARGS $MTD_CONFIG_ARGS -j "$CONF_TAR" write - "${PART_NAME:-image}"
        else
-               get_image "$1" "$2" | mtd write - "${PART_NAME:-image}"
+               get_image "$1" "$2" | mtd $MTD_ARGS write - "${PART_NAME:-image}"
        fi
        [ $? -ne 0 ] && exit 1
 }
index 58b613b5a0854f25ca824a1b439fd505e2dabdca..54d7a64b48524bf7918044394ee49e8da08e119b 100755 (executable)
@@ -4,6 +4,7 @@
 . /lib/functions/system.sh
 
 # initialize defaults
+export MTD_ARGS=""
 export MTD_CONFIG_ARGS=""
 export INTERACTIVE=0
 export VERBOSE=1