[Lunar-commits] <moonbase> udev: use Zbiggy's module for udev version 122. good job Zbiggy.

Florin Braescu florin at lunar-linux.org
Sun Jul 6 15:34:23 CEST 2008


commit 5183798b3cfa2ea9237bb3dc4f2de0acb37e6e86
Author: Florin Braescu <florin at lunar-linux.org>
Date:   Sat Jun 7 18:12:31 2008 +0300

    udev: use Zbiggy's module for udev version 122. good job Zbiggy.
---
 filesys/udev/BUILD        |   31 +++++++++++++------------------
 filesys/udev/DETAILS      |   14 +++++++-------
 filesys/udev/POST_INSTALL |   35 ++++++++++++++++++++++-------------
 filesys/udev/udev         |   10 +++++++---
 utils/lunar-init/mount    |   16 +++++++++++++---
 5 files changed, 62 insertions(+), 44 deletions(-)

diff --git a/filesys/udev/BUILD b/filesys/udev/BUILD
index 911badc..cdf229c 100644
--- a/filesys/udev/BUILD
+++ b/filesys/udev/BUILD
@@ -5,21 +5,15 @@
     add_priv_group usb
     add_priv_group cdrw
 
-    UDEV_EXTRAS="extras/ata_id  extras/collect extras/firmware \
-                 extras/path_id extras/scsi_id extras/volume_id \
-                 extras/cdrom_id extras/edd_id extras/floppy \
-                 extras/rule_generator extras/usb_id"
+    # create static nodes dir if missing
+    mkdir -p /lib/udev/devices &&
 
     patch_it $SOURCE2 0 &&
 
-    make EXTRAS="${UDEV_EXTRAS}" &&
-    prepare_install &&
-    make EXTRAS="${UDEV_EXTRAS}" install &&
+    for DIR in `ls extras`; do EXTRAS+="extras/$DIR "; done &&
+    sedit "s@^EXTRAS\ =@EXTRAS =$EXTRAS@" Makefile &&
 
-
-    # Deprecated .. but udevd still doesn't do what udevstart does
-    install -m755 udevstart /sbin/ &&
-    install -m644 udevstart.8 /usr/share/man/man8/ &&
+    default_build &&
 
     # install the init.d script
     # we cannot use automagic install via coretools
@@ -27,17 +21,18 @@
     # and would interfere with boot/{reboot,halt}
     mkdir -p /etc/udev/rules.d /etc/udev/scripts.d &&
 
-    install -m755 ${SCRIPT_DIRECTORY}/udev /etc/init.d/ &&
-
-    # We provide our own default set of rules
-    rm -f /etc/udev/rules.d/50-udev-default.rules &&
+    install -m755 ${SCRIPT_DIRECTORY}/udev /etc/init.d &&
 
-    install -m644 ${SOURCE_DIRECTORY}/etc/udev/gentoo/50-udev.rules \
-                  /etc/udev/rules.d/50-udev.rules &&
+    install -m644 etc/udev/gentoo/* \
+                  etc/udev/rules.d/* \
+                  etc/udev/packages/* \
+                 /etc/udev/rules.d
     install -m755 ${SOURCE_CACHE}/${SOURCE3} \
                   /etc/udev/scripts.d/raid-devfs.sh &&
 
     # We need to remove those in order to get a clean start
-    rm -f /etc/udev/rules.d/70-persistent-{cd,net}.rules
+    rm -f /etc/udev/rules.d/70-persistent-{cd,net}.rules &&
+
+    mv -f /etc/udev/rules.d/40-gentoo.rules /etc/udev/rules.d/40-lunar.rules
 
 ) > $C_FIFO 2>&1
diff --git a/filesys/udev/DETAILS b/filesys/udev/DETAILS
index d12bbd2..7f9024c 100644
--- a/filesys/udev/DETAILS
+++ b/filesys/udev/DETAILS
@@ -1,17 +1,17 @@
           MODULE=udev
-         VERSION=115
+         VERSION=122
           SOURCE=$MODULE-$VERSION.tar.bz2
-         SOURCE2=udev.rules-v9.patch
+         SOURCE2=udev.rules-v10.patch
          SOURCE3=raid-devfs.sh-udev-088
-      SOURCE_URL=http://www.kernel.org/pub/linux/utils/kernel/hotplug/
+      SOURCE_URL=$KERNEL_URL/pub/linux/utils/kernel/hotplug/
      SOURCE2_URL=$PATCH_URL
      SOURCE3_URL=$PATCH_URL
-      SOURCE_VFY=sha1:392f5a8d35a231b0edf075827f194ccfd946234f
-     SOURCE2_VFY=sha1:b089dc4c68c506208f3093b5726ce7f63aa2bada
+      SOURCE_VFY=sha1:4079b2d5149b8f532c1d2e54182380605f634806
+     SOURCE2_VFY=sha1:82545ca2eb9a9d35aa3c7c7385076e45dd98025e
      SOURCE3_VFY=sha1:44a12035774c2b42b784267d38e61a34aa0b645b
         WEB_SITE=http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
          ENTERED=20040104
-         UPDATED=20071118
+         UPDATED=20080518
       MAINTAINER=moe at lunar-linux.org
            SHORT="hotplug and device handling daemon"
 
@@ -31,4 +31,4 @@ differences are:
   that fit your needs and rules
 * udev provides LSB standard device names
 * udev is also the hotplug handler of the future
-EOF   
+EOF
diff --git a/filesys/udev/POST_INSTALL b/filesys/udev/POST_INSTALL
index 8c3989a..11467ab 100644
--- a/filesys/udev/POST_INSTALL
+++ b/filesys/udev/POST_INSTALL
@@ -3,7 +3,8 @@
 # devfs on top, you will see the underlaying static nodes
 
 FAKEROOT=/tmp/UDEV_NODE_ROOT
-DEVPREFIX=${FAKEROOT}/dev 
+DEVPREFIX=${FAKEROOT}/dev
+STATICDIR=/lib/udev/devices
 
 create_node()
 {
@@ -18,29 +19,37 @@ create_node()
   echo -ne "\tTesting for /dev/${NODE}: "
 
   if [ -e ${DEVPREFIX}/${NODE} ]; then
-     echo "node already present. " 
+     echo "node already present."
   else
      mknod -m $PERMS ${DEVPREFIX}/${NODE} ${TYPE} ${MAJOR} ${MINOR} || { echo "cannot create node."; exit 1; }
-     echo "node created. "
+     echo "node created."
   fi
-  
+
+  echo -ne "\tTesting for ${STATICDIR}/${NODE}: "
+
+  if [ -e ${STATICDIR}/${NODE} ]; then
+     echo "node already present."
+  else
+     mknod -m $PERMS ${STATICDIR}/${NODE} ${TYPE} ${MAJOR} ${MINOR} || { echo "cannot create node in $STATICDIR."; exit 1; }
+     echo "static node created in $STATICDIR"
+  fi
+
   test -z "${SYMLINK}" &&  return 0
 
   echo -ne "\tTesting for /dev/${SYMLINK} -> /dev/${NODE} symlink: "
 
   if [ -e ${DEVPREFIX}/${SYMLINK} ]; then
-     if [ "`readlink ${DEVPREFIX}/${SYMLINK}`" = "${NODE}" ]; then 
+     if [ "`readlink ${DEVPREFIX}/${SYMLINK}`" = "${NODE}" ]; then
         echo "already present."
         return 0
-     fi 
-
+     fi
      rm ${DEVPREFIX}/${SYMLINK}
   fi
 
   ln -sf ${NODE} ${DEVPREFIX}/${SYMLINK} || { echo "cannot create."; exit 1; }
   echo "created."
 
-  return 0  
+  return 0
 }
 
 echo    ""
@@ -48,10 +57,10 @@ echo -n "Creating virtual fake root... "       && mkdir ${FAKEROOT}/          &&
 echo -n "Creating fake root to check /dev... " && mount --bind / ${FAKEROOT}/ && echo "done." &&
 echo    "Checking /dev/ for needed static boot nodes... " &&
 
-create_node 0600 console c 5 1      &&
-create_node 0666 null    c 1 3      && 
-create_node 0600 ram0    b 1 0 ram  &&
-create_node 0600 ram1    b 1 1      &&
+create_node 0600 console c 5 1     &&
+create_node 0666 null    c 1 3     &&
+create_node 0600 ram0    b 1 0 ram &&
+create_node 0600 ram1    b 1 1     &&
 
-echo -n "Unmounting fake root... "   && umount ${FAKEROOT} && echo "done." && 
+echo -n "Unmounting fake root... "   && umount ${FAKEROOT} && echo "done." &&
 echo -n "Removing fake root dir... " && rm -rf ${FAKEROOT} && echo "done."
diff --git a/filesys/udev/udev b/filesys/udev/udev
index 820ccb1..de822ae 100644
--- a/filesys/udev/udev
+++ b/filesys/udev/udev
@@ -1,15 +1,19 @@
 #! /bin/bash
 #
 # udev init script to setup /dev
-# config: /etc/udev/udev.conf 
+# config: /etc/udev/udev.conf
 
 case "$1" in
 
   start)
     rm -rf /dev/.udevdb
     export ACTION=add
-    /sbin/udevstart
-    /sbin/udevd --daemon || exit 1;
+    /sbin/udevd --daemon
+    /sbin/udevadm trigger
+    /sbin/udevadm settle
+    # Wake up again lazy devices
+    #/sbin/udevadm trigger --retry-failed
+    #/sbin/udevadm settle || exit 1;
     ;;
 
   stop)
diff --git a/utils/lunar-init/mount b/utils/lunar-init/mount
index d98e3fe..0e93697 100644
--- a/utils/lunar-init/mount
+++ b/utils/lunar-init/mount
@@ -196,11 +196,21 @@ start()
 		run_with_msg " * Mounting /dev" "mount -n -t devfs devfs /dev"
 		run_with_msg "Starting devfsd" "devfsd /dev"
 	elif [ "$DEVNODES" = "udev" ]; then
-		run_with_msg " * Mounting tmpfs on /dev" "mount -t tmpfs tmpfs /dev -o size=6m,mode=0755"
+		run_with_msg " * Mounting udev  on /dev" "mount -w -n -t tmpfs udevfs /dev -o size=6m,mode=0755"
+		# Creating "must have" static device nodes
+		run_without_msg "mkdir -p /dev/{pts,shm}"
+		run_without_msg "cp -a /lib/udev/devices/* /dev"
+		if [ ! -h /dev/ram ]; then
+			ln -sf /dev/ram0 /dev/ram
+		fi
 		run_without_msg "echo > /proc/sys/kernel/hotplug" # Hotplug agents are deprecated!
-		run_with_msg "Creating udev device nodes on /dev" "/sbin/udevstart"
                 run_with_msg "Starting udev device handling daemon" "/sbin/udevd --daemon"
-		run_without_msg "mkdir -p /dev/{pts,shm}"
+                run_with_msg "Activating coldplug devices" "/sbin/udevadm trigger"
+		run_with_msg "Devices activation - please wait" "/sbin/udevadm settle"
+		# This is first aid code for devices hard to init (too slow or to buggy for init by 1st time)
+		# I never have to use it as my machine works great - I leave it just in case
+		#run_with_msg "Activating lazy devices" "/sbin/udevadm trigger --retry-failed"
+		#run_with_msg "Lazy devices activation - please wait" "/sbin/udevadm settle"
 		if [ ! -h /dev/fd ]; then
 			ln -sf /proc/self/fd /dev/fd
 		fi


More information about the Lunar-commits mailing list