summaryrefslogtreecommitdiff
path: root/package/base-files/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-07-20 09:25:49 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-07-20 09:25:49 +0000
commit8d55ea10ad6eeec6f865dd2704494115b145310d (patch)
tree53d7d07e215372f97538f291976686a30442ca07 /package/base-files/files
parent7ee96847cfd2eec38e0f1b28e1655d16434fc0a7 (diff)
downloadmtk-20170518-8d55ea10ad6eeec6f865dd2704494115b145310d.zip
mtk-20170518-8d55ea10ad6eeec6f865dd2704494115b145310d.tar.gz
mtk-20170518-8d55ea10ad6eeec6f865dd2704494115b145310d.tar.bz2
base-files: add mtd_get_part_size helper
Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 37475
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh12
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 bc521b0..19cfbae 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