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
91bfa01a52#),
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 <Tatiana.Leon@digi.com>
This commit is contained in:
Tatiana Leon 2022-11-17 14:03:00 +01:00
parent 883141830a
commit 1d813fe460
2 changed files with 9 additions and 6 deletions

View File

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

View File

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