recovery-initramfs-init: add support for ubisysvols
Adapt the format_ubi_volume() function to wipe out UBI volumes instead of formatting MTD partitions. Signed-off-by: Hector Palacios <hector.palacios@digi.com> https://onedigi.atlassian.net/browse/DEL-7614
This commit is contained in:
parent
13df57c1fc
commit
ec08b1277a
|
|
@ -231,6 +231,23 @@ format_ubi_volume() {
|
||||||
psplash_message "Formatting '${1}' partition..."
|
psplash_message "Formatting '${1}' partition..."
|
||||||
psplash_progress "0"
|
psplash_progress "0"
|
||||||
|
|
||||||
|
# Read the ubisysvols variable.
|
||||||
|
read_uboot_var ubisysvols ubisysvols
|
||||||
|
|
||||||
|
if [ "${ubisysvols}" = "yes" ]; then
|
||||||
|
# Find the volume number associated to the volume name
|
||||||
|
for d in /dev/ubi0_*; do
|
||||||
|
volname="$(ubinfo ${d} | grep ^Name | awk '{print $(2)}')"
|
||||||
|
if [ "${volname}" = "${1}" ]; then
|
||||||
|
# Find mountpoint
|
||||||
|
mountpoint="$(mount | grep ubi0:${1} | awk '{print $(3) }')"
|
||||||
|
umount ${mountpoint} 2> /dev/null
|
||||||
|
# Wipe out volume
|
||||||
|
ubiupdatevol ${d} -t
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
psplash_progress "100"
|
||||||
|
else
|
||||||
# Find the MTD partition.
|
# Find the MTD partition.
|
||||||
local mtd_num="$(sed -ne "s/mtd\([0-9]\+\):.*\<${1}\>.*/\1/g;T;p" /proc/mtd 2>/dev/null)"
|
local mtd_num="$(sed -ne "s/mtd\([0-9]\+\):.*\<${1}\>.*/\1/g;T;p" /proc/mtd 2>/dev/null)"
|
||||||
if [ -z "${mtd_num}" ]; then
|
if [ -z "${mtd_num}" ]; then
|
||||||
|
|
@ -265,6 +282,7 @@ format_ubi_volume() {
|
||||||
quit_with_error "Error creating '${1}' UBI volume"
|
quit_with_error "Error creating '${1}' UBI volume"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue