From 6e137943442fb0ab66c34462fa19e5a4260eddd5 Mon Sep 17 00:00:00 2001 From: Davide Fioravanti Date: Wed, 2 Sep 2020 01:18:16 +0200 Subject: base-files: add minimal mmc support Added minimal mmc support for helper functions: - find_mmc_part: Look for a given partition name. Returns the coresponding partition path - caldata_extract_mmc: Look for a given partition name and then extracts the calibration data - mmc_get_mac_binary: Returns the mac address from a given partition name and offset Signed-off-by: Davide Fioravanti Signed-off-by: Robert Marko [replace dd with caldata_dd, moved sysupgrade mmc to orbi] Signed-off-by: Christian Lamparter --- package/base-files/files/lib/functions.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'package/base-files/files/lib/functions.sh') diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index a5b23eb135..e56e4637f0 100644 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -330,6 +330,19 @@ find_mtd_part() { echo "${INDEX:+$PREFIX$INDEX}" } +find_mmc_part() { + local DEVNAME PARTNAME + + if grep -q "$1" /proc/mtd; then + echo "" && return 0 + fi + + for DEVNAME in /sys/block/mmcblk*/mmcblk*p*; do + PARTNAME="$(grep PARTNAME ${DEVNAME}/uevent | cut -f2 -d'=')" + [ "$PARTNAME" = "$1" ] && echo "/dev/$(basename $DEVNAME)" && return 0 + done +} + group_add() { local name="$1" local gid="$2" -- cgit v1.2.3