mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-31 00:24:12 +00:00
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 <pantanastyle@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com> [replace dd with caldata_dd, moved sysupgrade mmc to orbi] Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
This commit is contained in:
parent
24efb49ff0
commit
6e13794344
@ -330,6 +330,19 @@ find_mtd_part() {
|
|||||||
echo "${INDEX:+$PREFIX$INDEX}"
|
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() {
|
group_add() {
|
||||||
local name="$1"
|
local name="$1"
|
||||||
local gid="$2"
|
local gid="$2"
|
||||||
|
@ -48,6 +48,19 @@ caldata_extract_ubi() {
|
|||||||
caldata_die "failed to extract calibration data from $ubi"
|
caldata_die "failed to extract calibration data from $ubi"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caldata_extract_mmc() {
|
||||||
|
local part=$1
|
||||||
|
local offset=$(($2))
|
||||||
|
local count=$(($3))
|
||||||
|
local mmc_part
|
||||||
|
|
||||||
|
mmc_part=$(find_mmc_part $part)
|
||||||
|
[ -n "$mmc_part" ] || caldata_die "no mmc partition found for partition $part"
|
||||||
|
|
||||||
|
caldata_dd $mmc_part /lib/firmware/$FIRMWARE $count $offset || \
|
||||||
|
caldata_die "failed to extract calibration data from $mmc_part"
|
||||||
|
}
|
||||||
|
|
||||||
caldata_extract_reverse() {
|
caldata_extract_reverse() {
|
||||||
local part=$1
|
local part=$1
|
||||||
local offset=$2
|
local offset=$2
|
||||||
|
@ -135,6 +135,15 @@ mtd_get_part_size() {
|
|||||||
done < /proc/mtd
|
done < /proc/mtd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mmc_get_mac_binary() {
|
||||||
|
local part_name="$1"
|
||||||
|
local offset="$2"
|
||||||
|
local part
|
||||||
|
|
||||||
|
part=$(find_mmc_part "$part_name")
|
||||||
|
get_mac_binary "$part" "$offset"
|
||||||
|
}
|
||||||
|
|
||||||
macaddr_add() {
|
macaddr_add() {
|
||||||
local mac=$1
|
local mac=$1
|
||||||
local val=$2
|
local val=$2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user