base-files: system.sh: add mtd_get_part_erasesize()

Similar to mtd_get_part_size() but for the erase sector size.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/24866
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Michael Pratt authored and Robert Marko committed 2026-11-04 22:34:59 +01:00
1 parent bd742322ea
commit 932b3dc517
1 file changed
+12
@@ -228,6 +228,18 @@ mtd_get_part_size() {
done < /proc/mtd
}
mtd_get_part_erasesize() {
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$erasesize))
break
fi
done < /proc/mtd
}
mmc_get_mac_ascii() {
local part_name="$1"
local key="$2"