meta-digi: mount boot partitions read-only

https://jira.digi.com/browse/DEL-949

Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
Javier Viguera 2014-03-10 11:53:20 +01:00
parent 379a44a891
commit a3f3d6125f
4 changed files with 57 additions and 2 deletions

View File

@ -0,0 +1,22 @@
# There are a number of modifiers that are allowed to be used in some
# of the different fields. They provide the following subsitutions:
#
# %n the "kernel number" of the device.
# For example, 'sda3' has a "kernel number" of '3'
# %e the smallest number for that name which does not matches an existing node
# %k the kernel name for the device
# %M the kernel major number for the device
# %m the kernel minor number for the device
# %b the bus id for the device
# %c the string returned by the PROGRAM
# %s{filename} the content of a sysfs attribute
# %% the '%' char itself
#
# Boot partitions
SUBSYSTEM=="block", ENV{ID_PART_ENTRY_NAME}=="kernels?", ACTION=="add", RUN+="/etc/udev/scripts/mount_bootparts.sh", GOTO="automount_rules_end"
# Media automounting
SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh"
SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh"
LABEL="automount_rules_end"

View File

@ -0,0 +1,27 @@
#!/bin/sh
#===============================================================================
#
# mount_bootparts.sh
#
# Copyright (C) 2014 by Digi International Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# !Description: Attempt to mount boot partitions read-only (called from udev)
#
#===============================================================================
MOUNT="/bin/mount"
# Use 'silent' if util-linux's mount (busybox's does not support that option)
[ "$(readlink ${MOUNT})" = "/bin/mount.util-linux" ] && MOUNT="${MOUNT} -o silent"
MOUNTPOINT="/mnt/${ID_PART_ENTRY_NAME}"
mkdir -p ${MOUNTPOINT}
if ! ${MOUNT} -t auto -r ${DEVNAME} ${MOUNTPOINT}; then
logger -t udev "mount_bootparts.sh: mount ${DEVNAME} under ${MOUNTPOINT} failed!"
rmdir --ignore-fail-on-non-empty ${MOUNTPOINT}
fi

View File

@ -4,3 +4,9 @@ PRINC := "${@int(PRINC) + 1}"
PR_append = "+${DISTRO}" PR_append = "+${DISTRO}"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://mount_bootparts.sh"
do_install_append() {
install -m 0755 ${WORKDIR}/mount_bootparts.sh ${D}${sysconfdir}/udev/scripts/
}

View File

@ -1,7 +1,7 @@
# #
# Automatically generated make config: don't edit # Automatically generated make config: don't edit
# Busybox version: 1.21.1 # Busybox version: 1.21.1
# Fri Feb 14 15:39:27 2014 # Tue Mar 4 10:56:29 2014
# #
CONFIG_HAVE_DOT_CONFIG=y CONFIG_HAVE_DOT_CONFIG=y
@ -580,7 +580,7 @@ CONFIG_MOUNT=y
CONFIG_FEATURE_MOUNT_FAKE=y CONFIG_FEATURE_MOUNT_FAKE=y
CONFIG_FEATURE_MOUNT_VERBOSE=y CONFIG_FEATURE_MOUNT_VERBOSE=y
CONFIG_FEATURE_MOUNT_HELPERS=y CONFIG_FEATURE_MOUNT_HELPERS=y
# CONFIG_FEATURE_MOUNT_LABEL is not set CONFIG_FEATURE_MOUNT_LABEL=y
CONFIG_FEATURE_MOUNT_NFS=y CONFIG_FEATURE_MOUNT_NFS=y
CONFIG_FEATURE_MOUNT_CIFS=y CONFIG_FEATURE_MOUNT_CIFS=y
CONFIG_FEATURE_MOUNT_FLAGS=y CONFIG_FEATURE_MOUNT_FLAGS=y