summaryrefslogtreecommitdiff
path: root/package/base-files/files
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh20
-rw-r--r--package/base-files/files/lib/preinit/30_failsafe_wait25
2 files changed, 37 insertions, 8 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 85ebc2a..6f23e0b 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -260,6 +260,26 @@ mtd_get_mac_ascii()
[ -n "$mac_dirty" ] && macaddr_canonicalize "$mac_dirty"
}
+mtd_get_blob()
+{
+ local mtdname="$1"
+ local offset="$2"
+ local count="$3"
+ local firmware="$4"
+ local part
+
+ part=$(find_mtd_part "$mtdname")
+ if [ -z "$part" ]; then
+ echo "mtd_get_blob: partition $mtdname not found!" >&2
+ return 1
+ fi
+
+ dd if=$part of=$firmware bs=1 skip=$offset count=$count 2>/dev/null || {
+ echo "mtd_get_blob: failed to extract $firmware from $part" >&2
+ return 1
+ }
+}
+
mtd_get_mac_binary() {
local mtdname="$1"
local offset="$2"
diff --git a/package/base-files/files/lib/preinit/30_failsafe_wait b/package/base-files/files/lib/preinit/30_failsafe_wait
index 6bce8ae..5225659 100644
--- a/package/base-files/files/lib/preinit/30_failsafe_wait
+++ b/package/base-files/files/lib/preinit/30_failsafe_wait
@@ -5,7 +5,7 @@
fs_wait_for_key () {
local timeout=$3
local timer
- local do_failsafe
+ local do_keypress
local keypress_true="$(mktemp)"
local keypress_wait="$(mktemp)"
local keypress_sec="$(mktemp)"
@@ -40,6 +40,7 @@ fs_wait_for_key () {
} &
echo "Press the [$1] key and hit [enter] $2"
+ echo "Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level"
# if we're on the console we wait for input
{
while [ -r $keypress_wait ]; do
@@ -48,14 +49,22 @@ fs_wait_for_key () {
[ -n "$timer" ] || timer=1
timer="${timer%%\ *}"
[ $timer -ge 1 ] || timer=1
- do_failsafe=""
+ do_keypress=""
{
- read -t "$timer" do_failsafe
- if [ "$do_failsafe" = "$1" ]; then
- echo "true" >$keypress_true
- lock -u $keypress_wait
- rm -f $keypress_wait
- fi
+ read -t "$timer" do_keypress
+ case "$do_keypress" in
+ $1)
+ echo "true" >$keypress_true
+ ;;
+ 1 | 2 | 3 | 4)
+ echo "$do_keypress" >/tmp/debug_level
+ ;;
+ *)
+ continue;
+ ;;
+ esac
+ lock -u $keypress_wait
+ rm -f $keypress_wait
}
done
}