From 6c98ac18d3e8a8fe67e8e36d9a359318e0dfc53d Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Sun, 3 Feb 2008 15:35:39 +0000 Subject: [PATCH] Add setup_hotplug() function that runs before the modules are loaded to setup mdev as the hotplug event handler Add $KV to /lib/modules anywhere it occurs to allow for an initramfs with multiple sets of modules git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@586 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- ChangeLog | 6 ++++++ generic/initrd.scripts | 25 +++++++++++++++++++------ generic/linuxrc | 7 +++++-- 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5508ee4..5b5c7be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,12 @@ # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 03 Feb 2008; Andrew Gaffney generic/initrd.scripts, + generic/linuxrc: + Add setup_hotplug() function that runs before the modules are loaded to + setup mdev as the hotplug event handler. Add $KV to /lib/modules anywhere it + occurs to allow for an initramfs with multiple sets of modules + 03 Feb 2008; Andrew Gaffney gen_configkernel.sh, genkernel.conf: Clean up OLDCONFIG logic and default to OLDCONFIG=yes. This is for bug 207895 diff --git a/generic/initrd.scripts b/generic/initrd.scripts index 9f2351c..7f68a53 100644 --- a/generic/initrd.scripts +++ b/generic/initrd.scripts @@ -50,7 +50,7 @@ modules_scan() { then [ -n "${DEBUG}" ] && echo -ne "${BOLD} ::${NORMAL} Checking for ${x}..." # find -name does not work since the return status is always zero - if find /lib/modules | grep /"${x}${KSUFF}" >/dev/null 2>&1 + if find /lib/modules/${KV} | grep /"${x}${KSUFF}" >/dev/null 2>&1 then echo -ne "${BOLD} ::${NORMAL} Scanning for ${x}..." modprobe ${x} -n @@ -300,9 +300,6 @@ run_shell() { runmdev() { # busybox udev replacement mdev -s - - # catch udev hotplug events - echo /sbin/mdev > /proc/sys/kernel/hotplug } test_success() { @@ -391,6 +388,22 @@ bind_mount_dev() { mount -o bind ${NEW_ROOT}/dev /dev } +setup_hotplug() { + # Check udev is available... + if [ "${KV_2_6_OR_GREATER}" -a "${USE_UDEV_NORMAL}" != '0' ] + then + USE_UDEV_NORMAL=1 + else + USE_UDEV_NORMAL=0 + fi + + if [ "${USE_UDEV_NORMAL}" = '1' ] + then + # catch udev hotplug events + echo /sbin/mdev > /proc/sys/kernel/hotplug + fi +} + start_dev_mgr() { # Check udev is available... if [ "${KV_2_6_OR_GREATER}" -a "${USE_UDEV_NORMAL}" != '0' ] @@ -460,9 +473,9 @@ cmdline_hwopts() { } load_modules() { - # Load modules listed in MY_HWOPTS if /lib/modules exists + # Load modules listed in MY_HWOPTS if /lib/modules exists for the running kernel - if [ -d '/lib/modules' ] + if [ -d '/lib/modules/${KV}' ] then good_msg 'Loading modules' # Load appropriate kernel modules diff --git a/generic/linuxrc b/generic/linuxrc index 381c6b5..1fc1de0 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -220,8 +220,11 @@ splash 'init' detect_sbp2_devices cmdline_hwopts -# Load modules listed in MY_HWOPTS if /lib/modules exists -if [ -d '/lib/modules' ] +# Setup hotplugging for firmware loading +setup_hotplug + +# Load modules listed in MY_HWOPTS if /lib/modules exists for the running kernel +if [ -d '/lib/modules/${KV}' ] then good_msg 'Loading modules' # Load appropriate kernel modules -- 2.26.2