aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions.sh
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2013-11-25 08:34:55 +0000
committerJohn Crispin <john@openwrt.org>2013-11-25 08:34:55 +0000
commit93e9a71538c18a979c4999b1d54dd64e59e967ac (patch)
treeb0e9a6a8337202f2ac3f2d0cb268b57547a1d0f1 /package/base-files/files/lib/functions.sh
parent91de2648e948fc9163e16b2babd9e7e808bde94c (diff)
downloadupstream-93e9a71538c18a979c4999b1d54dd64e59e967ac.tar.gz
upstream-93e9a71538c18a979c4999b1d54dd64e59e967ac.tar.bz2
upstream-93e9a71538c18a979c4999b1d54dd64e59e967ac.zip
base-files: allow users to delect debug level during boot
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 38909
Diffstat (limited to 'package/base-files/files/lib/functions.sh')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 85ebc2aeb1..6f23e0b8b2 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"