From 8c0dc9af13a68526b24fb059215a823b32db9681 Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Fri, 25 Aug 2023 12:42:38 +0200 Subject: [PATCH] udev-extraconf: adapt mount rules and script for new ccmp1 partition table The ccmp1 has two MTD partitions (UBI, UBI_2) with different system volumes. Previously, the fact of having two ubi devices was taken as proof of being on a multi-MTD system (one that has one UBI volume per partition). Instead, this commit reformulates the condition to having a partition of the same name than the UBI volume. Signed-off-by: Hector Palacios --- .../recipes-core/udev/udev-extraconf/automount.rules | 2 +- .../udev/udev-extraconf/mount_digiparts.sh | 12 ++++++------ 2 files changed, 7 insertions(+), 7 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 84bec7099..df3fb866a 100644 --- a/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules +++ b/meta-digi-arm/recipes-core/udev/udev-extraconf/automount.rules @@ -16,7 +16,7 @@ # 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", KERNEL=="ubi0*", ATTRS{name}=="linux*|update*|data*", ACTION=="add", RUN+="/etc/udev/scripts/mount_digiparts.sh", GOTO="automount_rules_end" +SUBSYSTEM=="ubi", KERNEL=="ubi*", 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 eb9aae738..f72b6da8c 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 @@ -18,12 +18,6 @@ BASE_INIT="$(readlink -f "@base_sbindir@/init")" BASE_INIT_ORIG="$(readlink -f "@base_sbindir@/init.orig")" 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 @@ -31,6 +25,12 @@ elif [ "${SUBSYSTEM}" = "mtd" ]; then PARTNAME="$(grep ${MTDN} /proc/mtd | sed -ne 's,.*"\(.*\)",\1,g;T;p')" elif [ "${SUBSYSTEM}" = "ubi" ]; then PARTNAME="$(cat /sys/${DEVPATH}/name)" + # Multi-MTD systems only have one UBI volume per MTD partition that is + # called the same as the MTD partition. Do nothing for UBI events if the + # MTD partition is called the same, as they are already handled by the + # "mtd" subsystem rule + result="$(grep '\"${PARTNAME}\"$' /proc/mtd)" + [ -n "${result}" ] && exit 0 fi MOUNT_FOLDER=${PARTNAME}