PATCH/RFC: Udev minor additions/tidying
This patch adjusts few things in Pkgfile and start_udev. Rationale in the commit message. Tested with x86_64 (and homegrown initramfs). Michal Soltys (1): udev additions/tidying udev/.footprint | 1 + udev/.md5sum | 2 +- udev/Pkgfile | 15 ++++++--------- udev/start_udev | 28 ++++++++++++++++------------ 4 files changed, 24 insertions(+), 22 deletions(-) -- 1.7.3.5
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> --- udev/.footprint | 1 + udev/.md5sum | 2 +- udev/Pkgfile | 15 ++++++--------- udev/start_udev | 28 ++++++++++++++++------------ 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/udev/.footprint b/udev/.footprint index 5a0d969..dc0497b 100644 --- a/udev/.footprint +++ b/udev/.footprint @@ -57,6 +57,7 @@ lrwxrwxrwx root/root usr/bin/udevinfo -> /sbin/udevadm drwxr-xr-x root/root usr/include/ -rw-r--r-- root/root usr/include/libudev.h drwxr-xr-x root/root usr/lib/ +-rw-r--r-- root/root usr/lib/libudev.a -rwxr-xr-x root/root usr/lib/libudev.la lrwxrwxrwx root/root usr/lib/libudev.so -> ../../lib/libudev.so.0.10.0 drwxr-xr-x root/root usr/lib/pkgconfig/ diff --git a/udev/.md5sum b/udev/.md5sum index 66e67c4..0b4ebee 100644 --- a/udev/.md5sum +++ b/udev/.md5sum @@ -1,2 +1,2 @@ -572661c0c9cde672fa68250f9a55be94 start_udev +443d19ce3b54ef554fc7942a709936e2 start_udev 4db27d73fdbe94f47fd89fdd105c2dfb udev-166.tar.bz2 diff --git a/udev/Pkgfile b/udev/Pkgfile index 2034d8f..92f5c9b 100644 --- a/udev/Pkgfile +++ b/udev/Pkgfile @@ -4,7 +4,7 @@ name=udev version=166 -release=1 +release=2 source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$name-$version.tar.bz2 \ start_udev) @@ -12,24 +12,21 @@ build() { cd udev-$version ./configure --prefix=/usr \ - --exec-prefix= \ + --sbindir=/sbin \ --sysconfdir=/etc \ - --libdir=/usr/lib \ + --with-rootlibdir=/lib \ --libexecdir=/lib/udev \ --mandir=/usr/man \ --disable-extras \ - --disable-introspection + --disable-introspection \ + --enable-static make - make install DESTDIR=$PKG pkgconfigdir=/usr/lib/pkgconfig + make install DESTDIR=$PKG mkdir -p $PKG/lib/{firmware,udev/devices/{pts,shm}} mkdir -p $PKG/lib - # Fix location of libaries - mv $PKG/usr/lib/libudev.so.* $PKG/lib - ln -sf ../../lib/$(readlink $PKG/usr/lib/libudev.so) $PKG/usr/lib/libudev.so - # Populate nodes mknod -m 600 $PKG/lib/udev/devices/console c 5 1 mknod -m 600 $PKG/lib/udev/devices/kmsg c 1 11 diff --git a/udev/start_udev b/udev/start_udev index 224db5f..3319a4d 100644 --- a/udev/start_udev +++ b/udev/start_udev @@ -1,16 +1,21 @@ #!/bin/sh -# mount /dev as a devtmpfs or tmpfs, depending on current kernel capability -# mount only, if it's not already mounted (e.g. after handover from initramfs) -# note: some video drivers require exec access in /dev -if ! /bin/mountpoint -q /dev ; then - if ! /bin/sed -n '/devtmpfs/q1' /proc/filesystems ; then - UDEVFS=devtmpfs - else +# - 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 udev /dev -o exec,nosuid,mode=0755,size=8M + /bin/mount -n -t $UDEVFS -o ${UDEVOPTS} dev /dev fi # make sure hotplugger is not set @@ -19,12 +24,11 @@ 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 -/sbin/udevd --daemon +# 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 settle /sbin/udevadm trigger --type=devices --action=add /sbin/udevadm settle -- 1.7.3.5
Michal Soltys <soltys <at> ziu.info> writes:
This patch adjusts few things in Pkgfile and start_udev.
Rationale in the commit message. Tested with x86_64 (and homegrown initramfs).
Michal Soltys (1): udev additions/tidying
udev/.footprint | 1 + udev/.md5sum | 2 +- udev/Pkgfile | 15 ++++++--------- udev/start_udev | 28 ++++++++++++++++------------ 4 files changed, 24 insertions(+), 22 deletions(-)
Thanks for the patch, Michal. I'll look at it next week, when I'm back at home. Greetings Juergen
On Sun, Feb 20, 2011 at 03:25:40PM +0100, Michal Soltys wrote:
This patch adjusts few things in Pkgfile and start_udev.
I've just committed your changes, but had to fix the md5sum of start_udev? Thanks again for your contribution. Greetings Juergen -- Juergen Daubert | mailto:jue@jue.li Korb, Germany | http://jue.li/crux
On 11-02-27 18:11, Juergen Daubert wrote:
On Sun, Feb 20, 2011 at 03:25:40PM +0100, Michal Soltys wrote:
This patch adjusts few things in Pkgfile and start_udev.
I've just committed your changes, but had to fix the md5sum of start_udev? Thanks again for your contribution.
Ah sorry for that, must have forgotten -um before commiting and generating patch.
participants (2)
-
Juergen Daubert
-
Michal Soltys