summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-05-05 18:33:18 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2007-05-05 18:33:18 +0000
commit2d6b53deec9dab294cb8e0aafe81ecc7aba5ba4e (patch)
treee281bcd95cb9e165ddac1b4ae8f002f20e6acff9
parentb755dc66dfca48518b24450277173be4671fcde5 (diff)
use hotplug2 for serializing hotplug events on 2.6
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@7097 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rwxr-xr-xpackage/base-files/files/etc/init.d/boot6
-rwxr-xr-xpackage/base-files/files/sbin/mount_root17
-rw-r--r--package/hotplug2/Makefile4
-rw-r--r--package/hotplug2/files/hotplug2-init.rules (renamed from package/base-files/files/etc/hotplug2.rules)5
-rw-r--r--package/hotplug2/files/hotplug2.rules12
-rw-r--r--package/hotplug2/patches/100-rules_override.patch34
-rwxr-xr-xtarget/linux/brcm-2.4/base-files/default/etc/preinit6
-rw-r--r--target/linux/brcm-2.4/config/default1
-rw-r--r--target/linux/generic-2.6/config-template1
9 files changed, 70 insertions, 16 deletions
diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot
index 3461eab2f..d5a42e2d7 100755
--- a/package/base-files/files/etc/init.d/boot
+++ b/package/base-files/files/etc/init.d/boot
@@ -27,13 +27,11 @@ start() {
ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
[ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe
- # manually trigger hotplug before loading modules
+ # the coldplugging of network interfaces needs to happen later, so we do it manually here
for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do
/usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug-call net
done
-
- /sbin/hotplug2 --persistent --max-children 5 &
- echo /sbin/hotplug-call > /proc/sys/kernel/hotplug
+ /sbin/hotplug2 --persistent --max-children 1 &
# create /dev/root if it doesn't exist
[ -e /dev/root ] || {
diff --git a/package/base-files/files/sbin/mount_root b/package/base-files/files/sbin/mount_root
index 80078b516..607c79968 100755
--- a/package/base-files/files/sbin/mount_root
+++ b/package/base-files/files/sbin/mount_root
@@ -4,17 +4,26 @@
mount none /proc -t proc
size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)<l)?$2-l:s}' /proc/meminfo)
+
mount none /tmp -t tmpfs -o size=$size,nosuid,nodev,mode=1777
-if grep devfs /proc/filesystems > /dev/null; then
+if grep devfs /proc/filesystems >/dev/null; then
mount none /dev -t devfs
else
- mount -t sysfs none /sys
mount -t tmpfs tmpfs /dev -o size=512K
mknod /dev/console c 5 1
exec >/dev/console </dev/console 2>&1
- mkdir /dev/shm
- /sbin/hotplug2 --no-persistent --coldplug --max-children 1
fi
+mkdir /dev/shm
+if grep sysfs /proc/filesystems >/dev/null; then
+ mount -t sysfs none /sys
+ HOTPLUG=""
+ # use a minimal ruleset only for creating device nodes
+ /sbin/hotplug2 --no-persistent --coldplug --set-rules-file /etc/hotplug2-init.rules
+else
+ HOTPLUG="/sbin/hotplug2-dnode"
+fi
+echo "$HOTPLUG" > /proc/sys/kernel/hotplug
+
mkdir -p /dev/pts
mount none /dev/pts -t devpts
diff --git a/package/hotplug2/Makefile b/package/hotplug2/Makefile
index 6c2a0a105..6b69bac73 100644
--- a/package/hotplug2/Makefile
+++ b/package/hotplug2/Makefile
@@ -21,7 +21,6 @@ include $(INCLUDE_DIR)/package.mk
define Package/hotplug2
SECTION:=utils
CATEGORY:=Utilities
- DEPENDS:=@LINUX_2_6 +udevtrigger
TITLE:=Dynamic device management subsystem for embedded systems
URL:=http://isteve.bofh.cz/~isteve/hotplug2/
endef
@@ -32,6 +31,9 @@ in a tiny pack, intended for Linux early userspace: Init RAM FS and InitRD.
endef
define Package/hotplug2/install
+ $(INSTALL_DIR) $(1)/etc
+ $(INSTALL_DATA) ./files/hotplug2.rules $(1)/etc/
+ $(INSTALL_DATA) ./files/hotplug2-init.rules $(1)/etc/
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/hotplug2 $(1)/sbin/
endef
diff --git a/package/base-files/files/etc/hotplug2.rules b/package/hotplug2/files/hotplug2-init.rules
index 7f1aca917..6efd54668 100644
--- a/package/base-files/files/etc/hotplug2.rules
+++ b/package/hotplug2/files/hotplug2-init.rules
@@ -4,9 +4,6 @@ DEVICENAME ~~ (tun|tap[0-9]) {
}
DEVPATH is set {
- makedev /dev/%DEVICENAME% 0644
+ makedev /dev/%DEVICENAME% 0644
}
-MODALIAS is set {
- exec /sbin/modprobe -q %MODALIAS% ;
-}
diff --git a/package/hotplug2/files/hotplug2.rules b/package/hotplug2/files/hotplug2.rules
new file mode 100644
index 000000000..ebd96fa33
--- /dev/null
+++ b/package/hotplug2/files/hotplug2.rules
@@ -0,0 +1,12 @@
+DEVICENAME ~~ (tun|tap[0-9]) {
+ makedev /dev/net/%DEVICENAME% 0644
+ next
+}
+
+DEVPATH is set {
+ makedev /dev/%DEVICENAME% 0644
+}
+
+SUBSYSTEM ~~ (net|button) {
+ exec /sbin/hotplug-call %SUBSYSTEM%;
+}
diff --git a/package/hotplug2/patches/100-rules_override.patch b/package/hotplug2/patches/100-rules_override.patch
new file mode 100644
index 000000000..0d3b672e6
--- /dev/null
+++ b/package/hotplug2/patches/100-rules_override.patch
@@ -0,0 +1,34 @@
+diff -ur hotplug2.old/hotplug2.c hotplug2.dev/hotplug2.c
+--- hotplug2.old/hotplug2.c 2006-10-08 15:18:23.000000000 +0200
++++ hotplug2.dev/hotplug2.c 2007-05-05 11:38:51.456551560 +0200
+@@ -391,6 +391,7 @@
+ int rv = 0;
+ int i;
+ char *coldplug_command = NULL;
++ char *rules_file = HOTPLUG2_RULE_PATH;
+ sigset_t block_mask;
+
+ struct rules_t *rules = NULL;
+@@ -435,6 +436,13 @@
+ break;
+
+ modprobe_command = *argv;
++ } else if (!strcmp(*argv, "--set-rules-file")) {
++ argv++;
++ argc--;
++ if (argc <= 0)
++ break;
++
++ rules_file = *argv;
+ }
+ }
+ }
+@@ -443,7 +451,7 @@
+ #ifdef HAVE_RULES
+ if (!dumb) {
+ filemap = MAP_FAILED;
+- rule_fd = open(HOTPLUG2_RULE_PATH, O_RDONLY | O_NOATIME);
++ rule_fd = open(rules_file, O_RDONLY | O_NOATIME);
+ if (rule_fd == -1) {
+ dumb = 1;
+ ERROR("rules parse","Unable to open rules file: %s.", strerror(errno));
diff --git a/target/linux/brcm-2.4/base-files/default/etc/preinit b/target/linux/brcm-2.4/base-files/default/etc/preinit
index 11d934279..4513d6382 100755
--- a/target/linux/brcm-2.4/base-files/default/etc/preinit
+++ b/target/linux/brcm-2.4/base-files/default/etc/preinit
@@ -31,14 +31,16 @@ if grep devfs /proc/filesystems > /dev/null; then
mount none /dev -t devfs
M0=/dev/pty/m0
M1=/dev/pty/m1
+ HOTPLUG=/sbin/hotplug-call
else
mount -t sysfs none /sys
mount -t tmpfs tmpfs /dev -o size=512K
mknod /dev/console c 5 1
mkdir /dev/shm
- /sbin/hotplug2 --no-persistent --coldplug --max_children 1
+ /sbin/hotplug2 --no-persistent --coldplug --set-rules-file /etc/hotplug2-init.rules
M0=/dev/ptmx
M1=/dev/ptmx
+ HOTPLUG=
fi
mkdir -p /dev/pts
mount none /dev/pts -t devpts
@@ -86,7 +88,7 @@ eval ${FAILSAFE:+failsafe}
lock -w /tmp/.failsafe
set_state preinit
-echo /sbin/hotplug-call > /proc/sys/kernel/hotplug
+echo "$HOTPLUG" > /proc/sys/kernel/hotplug
ifconfig $ifname 0.0.0.0 down
diff --git a/target/linux/brcm-2.4/config/default b/target/linux/brcm-2.4/config/default
index 60355f89d..282817016 100644
--- a/target/linux/brcm-2.4/config/default
+++ b/target/linux/brcm-2.4/config/default
@@ -175,7 +175,6 @@ CONFIG_MSDOS_FS=m
CONFIG_MTD_BCM947XX=y
CONFIG_MTD_CFI_SSTSTD=y
CONFIG_MTD_SFLASH=y
-# CONFIG_MTD_SPLIT_ROOTFS is not set
# CONFIG_NATSEMI is not set
# CONFIG_NE2K_PCI is not set
# CONFIG_NE3210 is not set
diff --git a/target/linux/generic-2.6/config-template b/target/linux/generic-2.6/config-template
index 92d1d2960..a35715eca 100644
--- a/target/linux/generic-2.6/config-template
+++ b/target/linux/generic-2.6/config-template
@@ -366,6 +366,7 @@ CONFIG_IP6_NF_MATCH_EUI64=m
CONFIG_IP6_NF_MATCH_FRAG=m
CONFIG_IP6_NF_MATCH_HL=m
CONFIG_IP6_NF_MATCH_IPV6HEADER=m
+CONFIG_IP6_NF_MATCH_LIMIT=m
CONFIG_IP6_NF_MATCH_OPTS=m
CONFIG_IP6_NF_MATCH_OWNER=m
CONFIG_IP6_NF_MATCH_RT=m