From 1d813fe46047070674436be6094339c940a921a5 Mon Sep 17 00:00:00 2001 From: Tatiana Leon Date: Thu, 17 Nov 2022 14:03:00 +0100 Subject: [PATCH] cc6ul: mount_digiparts.sh: fix mount of 'update' partition This commit fixes the issue in Jira https://onedigi.atlassian.net/browse/DEL-7827 (and in GitHub https://github.com/digi-embedded/meta-digi/commit/91bfa01a52dfed6ccc6ac38035e0c6812179ab39#), that is being manifest again in a CC6UL with 1GB although it may affect other hardware. Partitions are mounted: * For multi-MTD systems, when an MTD subsystem event is received. * For single-MTD systems, when a UBI subsystem event is received. This commit avoids process UBI subsystem events in multi-MTD systems. The automount rules filter UBI subsystem events to only process 'ubi0*' (the only UBI device/volumes in a single-MTD) and then the executed script 'mount_digiparts.sh' checks for the existance of '/dev/ubi1' node to consider the system multi-MTD instead of using 'singlemtdsys' U-Boot variable that only exists on CC6UL. Signed-off-by: Tatiana Leon --- .../recipes-core/udev/udev-extraconf/automount.rules | 4 ++-- .../udev/udev-extraconf/mount_digiparts.sh | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules b/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules index 983811717..84bec7099 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules @@ -13,10 +13,10 @@ # %% the '%' char itself # -# Digi-mounted partitions: linux, update +# Digi-mounted partitions: linux, update, data SUBSYSTEM=="block", ENV{ID_PART_ENTRY_NAME}=="linux*|update*|data*", ACTION=="add", RUN+="/etc/udev/scripts/mount_digiparts.sh", GOTO="automount_rules_end" SUBSYSTEM=="mtd", ATTRS{name}=="linux*|update*|data*", ACTION=="add", RUN+="/etc/udev/scripts/mount_digiparts.sh", GOTO="automount_rules_end" -SUBSYSTEM=="ubi", ATTRS{name}=="linux*|update*|data*", ACTION=="add", RUN+="/etc/udev/scripts/mount_digiparts.sh", GOTO="automount_rules_end" +SUBSYSTEM=="ubi", KERNEL=="ubi0*", ATTRS{name}=="linux*|update*|data*", ACTION=="add", RUN+="/etc/udev/scripts/mount_digiparts.sh", GOTO="automount_rules_end" # Avoid mounting recovery partition SUBSYSTEM=="block", ENV{ID_PART_ENTRY_NAME}=="recovery*", ACTION=="add", GOTO="automount_rules_end" diff --git a/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh b/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh index 7fd4749b4..bf07cce48 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/mount_digiparts.sh @@ -17,6 +17,12 @@ BASE_INIT="$(readlink -f "@base_sbindir@/init")" INIT_SYSTEMD="@systemd_unitdir@/systemd" +# Partitions are mounted: +# * For multi-MTD systems, when an MTD subsystem event is received. +# * For single-MTD systems, when a UBI subsystem event is received. +# So, do nothing for UBI subsystem events in multi-MTD systems. +[ "${SUBSYSTEM}" = "ubi" ] && [ -c /dev/ubi1 ] && exit 0 + if [ "${SUBSYSTEM}" = "block" ]; then PARTNAME="${ID_PART_ENTRY_NAME}" elif [ "${SUBSYSTEM}" = "mtd" ]; then @@ -50,8 +56,7 @@ if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then MOUNT="/usr/bin/systemd-mount" MOUNT_PARAMS="${MOUNT_PARAMS} --no-block" - if [ -x "$MOUNT" ]; - then + if [ -x "$MOUNT" ]; then logger "Using systemd-mount to finish mount" else logger "Linux init is using systemd, so please install systemd-mount to finish mount" @@ -106,8 +111,6 @@ elif [ "${SUBSYSTEM}" = "mtd" ]; then rmdir --ignore-fail-on-non-empty ${MOUNTPOINT} fi elif [ "${SUBSYSTEM}" = "ubi" ]; then - # In the case of a 'system' partition with many UBI volumes, the device - # is always /dev/ubi0 # Mount the volume. if ! ${MOUNT} -t ubifs ${DEVNAME} ${MOUNT_PARAMS} ${MOUNTPOINT}; then logger -t udev "ERROR: Could not mount '${PARTNAME}' volume"