From f9194019b6798d6c22d6c1f3f2982fe6a40e7e3a Mon Sep 17 00:00:00 2001 From: Tatiana Leon Date: Tue, 21 Mar 2017 18:05:34 +0100 Subject: [PATCH] recovery init: detach 'update' MTD device from UBI if volume is not found If the volume is not found, the partition cannot be wiped since it is attached. Remove 'update' UBI device in: * mdev automount script if volume is not found * recovery init script before formatting 'update' partition https://jira.digi.com/browse/DEL-3962 Signed-off-by: Tatiana Leon --- .../recipes-core/recovery/recovery-initramfs/automount_mtd.sh | 1 + .../recovery/recovery-initramfs/recovery-initramfs-init | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_mtd.sh b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_mtd.sh index ed1be95ba..6a5c555ac 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_mtd.sh +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/automount_mtd.sh @@ -43,6 +43,7 @@ if is_update_device; then fi else echo "ERROR: Could not mount '${PARTITION_NAME}' partition, volume not found" + ubidetach -p "/dev/${MDEV}" >/dev/null 2>&1 rmdir --ignore-fail-on-non-empty ${UPDATE_MOUNTPOINT} fi fi diff --git a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init index 882059b47..12e68ea36 100644 --- a/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init +++ b/meta-digi-dey/recipes-core/recovery/recovery-initramfs/recovery-initramfs-init @@ -194,8 +194,8 @@ format_ubi_volume() { if grep -qs "${1}" /proc/mounts; then local path="$(sed -ne "s/.*:${1} \(.*\) ubifs.*/\1/g;T;p" /proc/mounts 2>/dev/null)" umount "${path}" >/dev/null 2>&1 - ubidetach -p "/dev/mtd${mtd_num}" >/dev/null 2>&1 fi + ubidetach -p "/dev/mtd${mtd_num}" >/dev/null 2>&1 # Format MTD partition. if ! ubiformat "/dev/mtd${mtd_num}" -q -y; then quit_with_error "Error erasing '/dev/mtd${mtd_num}' block"