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 <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2023-08-25 12:42:38 +02:00
parent eba8e21d72
commit 8c0dc9af13
2 changed files with 7 additions and 7 deletions

View File

@ -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"

View File

@ -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}