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
master
Gabor Juhos 2013-07-20 09:25:49 +00:00
parent a5ad1e9ad7
commit c475e599b4
2 changed files with 13 additions and 1 deletions

View File

@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/version.mk
PKG_NAME:=base-files
PKG_RELEASE:=142
PKG_RELEASE:=143
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
PKG_BUILD_DEPENDS:=opkg/host

View File

@ -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