nuke mdev and replace it with hotplug2 :)
authorFelix Fietkau <nbd@openwrt.org>
Sun, 4 Mar 2007 20:31:53 +0000 (20:31 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 4 Mar 2007 20:31:53 +0000 (20:31 +0000)
SVN-Revision: 6512

19 files changed:
include/kernel-build.mk
package/base-files/files/etc/functions.sh
package/base-files/files/etc/hotplug2.rules [new file with mode: 0644]
package/base-files/files/etc/init.d/boot
package/base-files/files/etc/mdev.conf [deleted file]
package/base-files/files/lib/network/config.sh
package/base-files/files/sbin/hotplug [deleted file]
package/base-files/files/sbin/hotplug-call [new file with mode: 0755]
package/base-files/files/sbin/ifdown
package/base-files/files/sbin/mount_root
package/base-files/files/usr/share/udhcpc/default.script
package/busybox/config/util-linux/Config.in
package/busybox/target-config.in
package/comgt/files/3g.button
package/ppp/files/etc/ppp/ip-down
package/ppp/files/etc/ppp/ip-up
package/udev/patches/02-udevtrigger_no_config.patch [new file with mode: 0644]
target/linux/brcm-2.4/base-files/default/etc/preinit
target/linux/generic-2.6/files/init

index 93bf66dbcb3c15ceeab4af7f161e7cab3eafbbf9..3193e9d185919376352336601b95bc1eca4c9f8f 100644 (file)
@@ -37,6 +37,9 @@ FEATURES:=$(sort $(FEATURES))
 
 # For target profile selection - the default set
 DEFAULT_PACKAGES:=base-files libgcc uclibc bridge busybox dnsmasq dropbear iptables mtd ppp ppp-mod-pppoe mtd kmod-ipt-nathelper
+ifneq ($(KERNEL),2.4)
+  DEFAULT_PACKAGES+=udevtrigger hotplug2
+endif
 
 ifeq ($(DUMP),1)
   all: dumpinfo
index c29ae772ac3b5bc02e12c5e6817250e5c3aed845..4d84bb81e07f96b2c76b683fcb5ca5d8664eafe9 100755 (executable)
@@ -12,7 +12,7 @@ _C=0
 NO_EXPORT=1
 
 hotplug_dev() {
-       env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug net
+       env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug-call net
 }
 
 append() {
diff --git a/package/base-files/files/etc/hotplug2.rules b/package/base-files/files/etc/hotplug2.rules
new file mode 100644 (file)
index 0000000..d2a931a
--- /dev/null
@@ -0,0 +1,7 @@
+DEVPATH is set {
+                       makedev /dev/%DEVICENAME% 0644
+}
+
+MODALIAS is set {
+                       exec /sbin/modprobe -q %MODALIAS% ;
+}
index db7ec8cc3aadd98447c4c89e931d5113b42abe50..ed5e7d8ba56772a0a220bbbe747cd9cf28ec5115 100755 (executable)
@@ -20,8 +20,11 @@ start() {
        
        # manually trigger hotplug before loading modules
        for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
-               /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug net
+               /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
        done
-       
+
+       /sbin/hotplug2 --persistent &
+       echo /sbin/hotplug-call > /proc/sys/kernel/hotplug
+
        load_modules /etc/modules.d/*
 }
diff --git a/package/base-files/files/etc/mdev.conf b/package/base-files/files/etc/mdev.conf
deleted file mode 100644 (file)
index 8935583..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-null 0:0 777
-zero 0:0 666
-console 0:5 0600
-tty 0:5 0660
-ttyS* 0:20 640
index 95954bf15acd1621c5606fafc556ea2102d8d5c7..8a596874d4c4913d1668cf87e18020aea649fb91 100755 (executable)
@@ -157,7 +157,7 @@ setup_interface() {
                                done
                        }
 
-                       env -i ACTION="ifup" INTERFACE="$config" DEVICE="$iface" PROTO=static /sbin/hotplug "iface" &
+                       env -i ACTION="ifup" INTERFACE="$config" DEVICE="$iface" PROTO=static /sbin/hotplug-call "iface" &
                ;;
                dhcp)
                        # prevent udhcpc from starting more than once
diff --git a/package/base-files/files/sbin/hotplug b/package/base-files/files/sbin/hotplug
deleted file mode 100755 (executable)
index 189cfee..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2006 OpenWrt.org
-
-[ -x /sbin/mdev -a -n "$ACTION" -a -n "$DEVPATH" ] && /sbin/mdev "$@"
-
-# bypass the normal hotplug path for firmware loading
-# would otherwise cause problems with drivers like bcm43xx
-[ "$1" = "firmware" -a "$ACTION" = "add" ] && {
-       [ -f "/lib/firmware/$FIRMWARE" ] && {
-               echo 1 > "/sys$DEVPATH/loading"
-               cp "/lib/firmware/$FIRMWARE" "/sys$DEVPATH/data"
-               echo 0 > "/sys$DEVPATH/loading"
-       }
-       exit 0
-}
-
-. /etc/functions.sh
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-LOGNAME=root
-USER=root
-export PATH LOGNAME USER
-
-[ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && {
-       for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
-               [ -f $script ] && . $script
-       ); done
-}
diff --git a/package/base-files/files/sbin/hotplug-call b/package/base-files/files/sbin/hotplug-call
new file mode 100755 (executable)
index 0000000..b1b6f97
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+
+# bypass the normal hotplug path for firmware loading
+# would otherwise cause problems with drivers like bcm43xx
+[ "$1" = "firmware" -a "$ACTION" = "add" ] && {
+       [ -f "/lib/firmware/$FIRMWARE" ] && {
+               echo 1 > "/sys$DEVPATH/loading"
+               cp "/lib/firmware/$FIRMWARE" "/sys$DEVPATH/data"
+               echo 0 > "/sys$DEVPATH/loading"
+       }
+       exit 0
+}
+
+. /etc/functions.sh
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+LOGNAME=root
+USER=root
+export PATH LOGNAME USER
+
+[ \! -z "$1" -a -d /etc/hotplug.d/$1 ] && {
+       for script in $(ls /etc/hotplug.d/$1/* 2>&-); do (
+               [ -f $script ] && . $script
+       ); done
+}
index 540c69f169115efe2981aa4b050ff1e9f7f6ca5a..e00a4e38da39c98cd656d19c9e6f3d456665fcfa 100755 (executable)
@@ -21,7 +21,7 @@ config_get proto "$cfg" proto
 
 config_get iface "$cfg" device
 [ "$proto" = "static" ] && {
-       env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$iface" PROTO=static /sbin/hotplug "iface" &
+       env -i ACTION="ifdown" INTERFACE="$config" DEVICE="$iface" PROTO=static /sbin/hotplug-call "iface" &
 }
 
 # call interface stop handler
index 9a87fadbaa088ac8db3a4cdfdadf24c606bac2d2..dd9d99d8e6a0d69501af478a021a7b81a89942af 100755 (executable)
@@ -12,7 +12,7 @@ else
        mount -t tmpfs tmpfs /dev -o size=512K
        mknod /dev/console c 5 1
        mkdir /dev/shm
-       /sbin/mdev -s
+       /sbin/hotplug2 --no-persistent --coldplug
 fi
 mkdir -p /dev/pts
 mount none /dev/pts -t devpts
index f39d21ed8c2ae380180b5d0e9d90fadfa694c808..c7239535660df4b91603741c54812a29e6cfe6ca 100755 (executable)
@@ -14,7 +14,7 @@ hotplug_event() {
                config_get proto $ifc proto
                [ "$proto" = "dhcp" ] || continue
 
-               env -i ACTION="$1" INTERFACE="$ifc" DEVICE="$ifname" PROTO=dhcp /sbin/hotplug iface
+               env -i ACTION="$1" INTERFACE="$ifc" DEVICE="$ifname" PROTO=dhcp /sbin/hotplug-call iface
        done
 }
 
index 0f219d70e244a298208634bd7f17b41aec8e6b3f..ab3dc3731dd45f99eee50aadd95093d259988756 100644 (file)
@@ -267,7 +267,7 @@ config BUSYBOX_CONFIG_LOSETUP
 
 config BUSYBOX_CONFIG_MDEV
        bool "mdev"
-       default y
+       default n
        help
          mdev is a mini-udev implementation: call it with -s to populate
          /dev from /sys, then "echo /sbin/mdev > /proc/sys/kernel/hotplug" to
@@ -276,7 +276,7 @@ config BUSYBOX_CONFIG_MDEV
 
 config BUSYBOX_CONFIG_FEATURE_MDEV_CONF
        bool "Support /etc/mdev.conf"
-       default y
+       default n
        depends on BUSYBOX_CONFIG_MDEV
        help
          The mdev config file contains lines that look like:
index 77c58cef14239f318e75298de93bcbb9ceafa261..86f270b59093117a483cc223d969e38876f8dbbc 100644 (file)
@@ -2,10 +2,3 @@ config BUSYBOX_CONFIG_FEATURE_DEVFS
        default y if LINUX_2_4
        default n if LINUX_2_6
 
-config BUSYBOX_CONFIG_MDEV
-       default n if LINUX_2_4
-       default y if LINUX_2_6
-
-config BUSYBOX_CONFIG_FEATURE_MDEV_CONF
-       default n if LINUX_2_4
-       default y if LINUX_2_6
index 54997d870aed81e17ebb4ab3da5f691309cd130e..57f42860731622e2d427561a7ad3dfe7a42a747f 100644 (file)
@@ -13,6 +13,7 @@ button_action() {(
 )}
 
 [ "$ACTION" = "released" -a "$BUTTON" = "3g" ] && {
+       HOTPLUG="$(cat /proc/sys/kernel/hotplug)"
        (echo /bin/true > /proc/sys/kernel/hotplug)
 
        include /lib/network
@@ -31,5 +32,5 @@ button_action() {(
        }
        config_load network
 
-       (echo /sbin/hotplug > /proc/sys/kernel/hotplug)
+       (echo $HOTPLUG > /proc/sys/kernel/hotplug)
 } &
index 334bcb885afdd68e4f4a2ebd58acc2b9277cd6f9..6bff00ca035ddf224e26feb994ac7152d4d14673 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-[ -z "$6" ] || env -i ACTION="ifdown" INTERFACE="$6" PROTO=ppp /sbin/hotplug "iface"
+[ -z "$6" ] || env -i ACTION="ifdown" INTERFACE="$6" PROTO=ppp /sbin/hotplug-call "iface"
 
 [ -d /etc/ppp/ip-down.d ] && {
        for SCRIPT in /etc/ppp/ip-down.d/*
index 34b4b50e15ae0f1d2af865f5487e10cf76a88304..53a91343a510b51faa09822f04cc613ec3e71e51 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-[ -z "$6" ] || env -i ACTION="ifup" INTERFACE="$6" PROTO=ppp /sbin/hotplug "iface"
+[ -z "$6" ] || env -i ACTION="ifup" INTERFACE="$6" PROTO=ppp /sbin/hotplug-call "iface"
 
 [ -d /etc/ppp/ip-up.d ] && {
        for SCRIPT in /etc/ppp/ip-up.d/*
diff --git a/package/udev/patches/02-udevtrigger_no_config.patch b/package/udev/patches/02-udevtrigger_no_config.patch
new file mode 100644 (file)
index 0000000..e9c22d4
--- /dev/null
@@ -0,0 +1,10 @@
+--- udev.old/udevtrigger.c     2007-03-03 18:42:09.000000000 +0100
++++ udev.dev/udevtrigger.c     2007-03-04 21:15:18.459211632 +0100
+@@ -446,7 +446,6 @@
+       };
+       logging_init("udevtrigger");
+-      udev_config_init();
+       dbg("version %s", UDEV_VERSION);
+       sysfs_init();
index 1c4e59f1520c0db55d419471a2a11677581b557b..b7a9f04772123cac23eb53de2ee327522978d1a5 100755 (executable)
@@ -65,7 +65,7 @@ eval ${FAILSAFE:+failsafe}
 
 lock -w /tmp/.failsafe
 set_state preinit
-echo /sbin/hotplug > /proc/sys/kernel/hotplug
+echo /sbin/hotplug-call > /proc/sys/kernel/hotplug
 
 ifconfig $ifname 0.0.0.0 down
 
index 292d429dcd5e1832b0ac6e40213ea488c8a332d1..af397d9abbc72d700dbc69cbfb44d8309a1abc35 100755 (executable)
@@ -12,7 +12,7 @@ else
        mknod /dev/console c 5 1
        mkdir /dev/pts
        mkdir /dev/shm
-       /sbin/mdev -s
+       /sbin/hotplug2 --no-persistent --coldplug
 fi
 
 mount none /dev/pts -t devpts