core/udev/start_udev
Michal Soltys 112bff655d udev additions/tidying
Don't override exec_prefix= and use --with-rootlibdir to copy
runtime libs to /lib while keeping most of the stuff in /usr.
With this change, we don't have to override pkgconfig, or manually
setup .so symlink. It's also friendlier towards builds with
enable-extras (which would require more additional fixes).

Enable build of static library, which will enable us to add explicit
udev support to static builds of dm/lvm.

Adjust start_udev:

- remount /dev if it's already mounted (due to initramfs or
  CONFIG_DEVTMPFS_MOUNT), which allows us to set mount options
- add inodes limit safeguard
- verify udevd is not running before starting it
- remove 'settle' between subsystems/devices

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-02-27 14:38:22 +01:00

38 lines
1.2 KiB
Bash

#!/bin/sh
# - if /dev is not mounted - mount as a devtmpfs (CONFIG_DEVTMPFS=y) or tmpfs
# - if /dev is mounted (e.g. due to handover from initramfs or
# CONFIG_DEVTMPFS_MOUNT=y), remount with specific options
# - some video drivers require exec access in /dev, thus it's set here
# - for completness, we add few sanity limits (2k non-empty files, 16k inodes)
UDEVOPTS="exec,nosuid,noatime,mode=0755,nr_blocks=2048,nr_inodes=16384"
if /bin/mountpoint -q /dev ; then
/bin/mount -n -o remount,${UDEVOPTS} dev /dev
else
if /bin/sed -n '/devtmpfs/q1' /proc/filesystems ; then
UDEVFS=tmpfs
else
UDEVFS=devtmpfs
fi
/bin/mount -n -t $UDEVFS -o ${UDEVOPTS} dev /dev
fi
# make sure hotplugger is not set
echo > /proc/sys/kernel/hotplug
# since v155, udevd automatically copies /lib/udev/devices
# and creates /proc/{kcore,self/fd/{0,1,2}} symlinks
# launch udev daemon, make sure it's not running first
test -z "$(/bin/pidof -s udevd)" && /sbin/udevd --daemon
# coldplug devices and wait for the queue to be processed
/sbin/udevadm trigger --type=subsystems --action=add
/sbin/udevadm trigger --type=devices --action=add
/sbin/udevadm settle
# retry any failures
/sbin/udevadm trigger --type=failed --action=add
/sbin/udevadm settle