From 70126a0c0a429e5c990af9ca0deaeb8b83b659e9 Mon Sep 17 00:00:00 2001 From: Ryan Mullen Date: Wed, 14 Nov 2012 23:52:40 -0500 Subject: [PATCH] Introduced udev with patches to remove accept4() call until glibc update --- udev/.footprint | 67 +++++++++++++++++++++++++++++++++++ udev/.md5sum | 4 +++ udev/81-crux.rules | 6 ++++ udev/Pkgfile | 44 +++++++++++++++++++++++ udev/pre-accept4-kernel.patch | 41 +++++++++++++++++++++ udev/start_udev | 32 +++++++++++++++++ 6 files changed, 194 insertions(+) create mode 100644 udev/.footprint create mode 100644 udev/.md5sum create mode 100644 udev/81-crux.rules create mode 100644 udev/Pkgfile create mode 100644 udev/pre-accept4-kernel.patch create mode 100644 udev/start_udev diff --git a/udev/.footprint b/udev/.footprint new file mode 100644 index 0000000..19c1cac --- /dev/null +++ b/udev/.footprint @@ -0,0 +1,67 @@ +drwxr-xr-x root/root etc/ +drwxr-xr-x root/root etc/udev/ +drwxr-xr-x root/root etc/udev/rules.d/ +-rw-r--r-- root/root etc/udev/udev.conf +drwxr-xr-x root/root lib/ +drwxr-xr-x root/root lib/firmware/ +lrwxrwxrwx root/root lib/libudev.so.0 -> libudev.so.0.13.1 +-rwxr-xr-x root/root lib/libudev.so.0.13.1 +drwxr-xr-x root/root lib/udev/ +-rwxr-xr-x root/root lib/udev/accelerometer +-rwxr-xr-x root/root lib/udev/ata_id +-rwxr-xr-x root/root lib/udev/cdrom_id +-rwxr-xr-x root/root lib/udev/collect +drwxr-xr-x root/root lib/udev/devices/ +drwxr-xr-x root/root lib/udev/devices/pts/ +drwxr-xr-x root/root lib/udev/devices/shm/ +-rwxr-xr-x root/root lib/udev/mtd_probe +-rw-r--r-- root/root lib/udev/rule_generator.functions +drwxr-xr-x root/root lib/udev/rules.d/ +-rw-r--r-- root/root lib/udev/rules.d/42-usb-hid-pm.rules +-rw-r--r-- root/root lib/udev/rules.d/50-udev-default.rules +-rw-r--r-- root/root lib/udev/rules.d/60-cdrom_id.rules +-rw-r--r-- root/root lib/udev/rules.d/60-persistent-alsa.rules +-rw-r--r-- root/root lib/udev/rules.d/60-persistent-input.rules +-rw-r--r-- root/root lib/udev/rules.d/60-persistent-serial.rules +-rw-r--r-- root/root lib/udev/rules.d/60-persistent-storage-tape.rules +-rw-r--r-- root/root lib/udev/rules.d/60-persistent-storage.rules +-rw-r--r-- root/root lib/udev/rules.d/60-persistent-v4l.rules +-rw-r--r-- root/root lib/udev/rules.d/61-accelerometer.rules +-rw-r--r-- root/root lib/udev/rules.d/75-cd-aliases-generator.rules +-rw-r--r-- root/root lib/udev/rules.d/75-net-description.rules +-rw-r--r-- root/root lib/udev/rules.d/75-persistent-net-generator.rules +-rw-r--r-- root/root lib/udev/rules.d/75-probe_mtd.rules +-rw-r--r-- root/root lib/udev/rules.d/75-tty-description.rules +-rw-r--r-- root/root lib/udev/rules.d/78-sound-card.rules +-rw-r--r-- root/root lib/udev/rules.d/80-drivers.rules +-rw-r--r-- root/root lib/udev/rules.d/81-crux.rules +-rw-r--r-- root/root lib/udev/rules.d/95-udev-late.rules +-rwxr-xr-x root/root lib/udev/scsi_id +-rwxr-xr-x root/root lib/udev/udevd +-rwxr-xr-x root/root lib/udev/v4l_id +-rwxr-xr-x root/root lib/udev/write_cd_rules +-rwxr-xr-x root/root lib/udev/write_net_rules +drwxr-xr-x root/root run/ +drwxr-xr-x root/root sbin/ +-rwxr-xr-x root/root sbin/start_udev +-rwxr-xr-x root/root sbin/udevadm +lrwxrwxrwx root/root sbin/udevd -> ../lib/udev/udevd +drwxr-xr-x root/root usr/ +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.13.1 +drwxr-xr-x root/root usr/lib/pkgconfig/ +-rw-r--r-- root/root usr/lib/pkgconfig/libudev.pc +drwxr-xr-x root/root usr/man/ +drwxr-xr-x root/root usr/man/man7/ +-rw-r--r-- root/root usr/man/man7/udev.7.gz +drwxr-xr-x root/root usr/man/man8/ +-rw-r--r-- root/root usr/man/man8/scsi_id.8.gz +-rw-r--r-- root/root usr/man/man8/udevadm.8.gz +-rw-r--r-- root/root usr/man/man8/udevd.8.gz +drwxr-xr-x root/root usr/share/ +drwxr-xr-x root/root usr/share/pkgconfig/ +-rw-r--r-- root/root usr/share/pkgconfig/udev.pc diff --git a/udev/.md5sum b/udev/.md5sum new file mode 100644 index 0000000..4231035 --- /dev/null +++ b/udev/.md5sum @@ -0,0 +1,4 @@ +ee21e150df6c804eef03a6cb2fc1cceb 81-crux.rules +ea80f70bc4bf2e4ab1b9412085c27b05 pre-accept4-kernel.patch +585b2d60139c1a3a03fea06c5c16f2a8 start_udev +023877e6cc0d907994b8c648beab542b udev-182.tar.xz diff --git a/udev/81-crux.rules b/udev/81-crux.rules new file mode 100644 index 0000000..88d8bc9 --- /dev/null +++ b/udev/81-crux.rules @@ -0,0 +1,6 @@ +# +# 81-crux.rules +# + +KERNEL=="fuse", ACTION=="add", RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections" + diff --git a/udev/Pkgfile b/udev/Pkgfile new file mode 100644 index 0000000..24faacd --- /dev/null +++ b/udev/Pkgfile @@ -0,0 +1,44 @@ +# Description: Userspace device management daemon, patched to remove accept4() syscall +# URL: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html +# Maintainer: CRUX System Team, core-ports at crux dot nu +# Depends on: kmod + +name=udev +version=182 +release=1 +source=(ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/$name-$version.tar.xz \ + pre-accept4-kernel.patch 81-crux.rules start_udev) + +build() { + cd udev-$version + + patch -p1 < $SRC/pre-accept4-kernel.patch + ./configure --prefix=/usr \ + --sbindir=/sbin --bindir=/sbin \ + --sysconfdir=/etc \ + --with-rootlibdir=/lib \ + --with-rootprefix= \ + --libexecdir=/lib \ + --mandir=/usr/man \ + --disable-introspection \ + --disable-gudev \ + --disable-keymap \ + --enable-static \ + --enable-rule_generator + + make + make install DESTDIR=$PKG + + mkdir -p $PKG/lib/{firmware,udev/devices/{pts,shm}} + mkdir -p $PKG/{lib,sbin,run} + + # Symlink to udevd + ln -s ../lib/udev/udevd $PKG/sbin/udevd + + # Add CRUX items + install -m 0755 $SRC/start_udev $PKG/sbin + install -m 0644 $SRC/81-crux.rules $PKG/lib/udev/rules.d + + # Remove junk + rm -r $PKG/usr/share/{gtk-,}doc +} diff --git a/udev/pre-accept4-kernel.patch b/udev/pre-accept4-kernel.patch new file mode 100644 index 0000000..f520a8d --- /dev/null +++ b/udev/pre-accept4-kernel.patch @@ -0,0 +1,41 @@ +diff -urN a/src/udev-ctrl.c b/src/udev-ctrl.c +--- a/src/udev-ctrl.c 2011-10-09 17:10:32.000000000 -0600 ++++ b/src/udev-ctrl.c 2011-10-25 15:11:09.000000000 -0600 +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -182,6 +183,7 @@ + struct ucred ucred; + socklen_t slen; + const int on = 1; ++ int flgs; + + conn = calloc(1, sizeof(struct udev_ctrl_connection)); + if (conn == NULL) +@@ -189,13 +191,19 @@ + conn->refcount = 1; + conn->uctrl = uctrl; + +- conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); ++ //conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); ++ conn->sock = accept(uctrl->sock, NULL, NULL); + if (conn->sock < 0) { + if (errno != EINTR) + err(uctrl->udev, "unable to receive ctrl connection: %m\n"); + goto err; + } + ++ // Since we don't have accept4 ++ flgs = fcntl(conn->sock, F_GETFL, NULL); ++ if(flgs >= 0) fcntl(conn->sock, F_SETFL, flgs | O_NONBLOCK); ++ fcntl(conn->sock, F_SETFD, FD_CLOEXEC); ++ + /* check peer credential of connection */ + slen = sizeof(ucred); + if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { + diff --git a/udev/start_udev b/udev/start_udev new file mode 100644 index 0000000..d8f4b26 --- /dev/null +++ b/udev/start_udev @@ -0,0 +1,32 @@ +#!/bin/sh + +# - if /dev is not mounted - mount as a devtmpfs (CONFIG_DEVTMPFS=y) +# - 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 + /bin/mount -n -t devtmpfs -o ${UDEVOPTS} dev /dev +fi + +# mount /run directory +/bin/mount -n -t tmpfs -o mode=0755,nosuid,nodev,exec tmpfs /run + +# 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 + -- 2.26.2