diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-07-20 09:25:49 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2013-07-20 09:25:49 +0000 |
commit | c475e599b47c83b875adbf4d8011e00f5da6a4ff (patch) | |
tree | e39678b0d81b31797cd121e3c79fe1ca14d61bd6 /package/base-files/files | |
parent | a5ad1e9ad7718c8bbe26ea4881fa5ea85d35844e (diff) | |
download | master-187ad058-c475e599b47c83b875adbf4d8011e00f5da6a4ff.tar.gz master-187ad058-c475e599b47c83b875adbf4d8011e00f5da6a4ff.tar.bz2 master-187ad058-c475e599b47c83b875adbf4d8011e00f5da6a4ff.zip |
base-files: add mtd_get_part_size helper
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@37475 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-x | package/base-files/files/lib/functions.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index bc521b07ee..19cfbae172 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -275,6 +275,18 @@ mtd_get_mac_binary() { dd bs=1 skip=$offset count=6 if=$part 2>/dev/null | hexdump -v -n 6 -e '5/1 "%02x:" 1/1 "%02x"' } +mtd_get_part_size() { + local part_name=$1 + local first dev size erasesize name + while read dev size erasesize name; do + name=${name#'"'}; name=${name%'"'} + if [ "$name" = "$part_name" ]; then + echo $((0x$size)) + break + fi + done < /proc/mtd +} + macaddr_add() { local mac=$1 local val=$2 |