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
cleanup-cruft
Andrew Gaffney 17 years ago
parent 5f3bff37d1
commit 6c98ac18d3

@ -2,6 +2,12 @@
# Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2 # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: $ # $Header: $
03 Feb 2008; Andrew Gaffney <agaffney@gentoo.org> 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 <agaffney@gentoo.org> gen_configkernel.sh, 03 Feb 2008; Andrew Gaffney <agaffney@gentoo.org> gen_configkernel.sh,
genkernel.conf: genkernel.conf:
Clean up OLDCONFIG logic and default to OLDCONFIG=yes. This is for bug 207895 Clean up OLDCONFIG logic and default to OLDCONFIG=yes. This is for bug 207895

@ -50,7 +50,7 @@ modules_scan() {
then then
[ -n "${DEBUG}" ] && echo -ne "${BOLD} ::${NORMAL} Checking for ${x}..." [ -n "${DEBUG}" ] && echo -ne "${BOLD} ::${NORMAL} Checking for ${x}..."
# find -name does not work since the return status is always zero # 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 then
echo -ne "${BOLD} ::${NORMAL} Scanning for ${x}..." echo -ne "${BOLD} ::${NORMAL} Scanning for ${x}..."
modprobe ${x} -n modprobe ${x} -n
@ -300,9 +300,6 @@ run_shell() {
runmdev() { runmdev() {
# busybox udev replacement # busybox udev replacement
mdev -s mdev -s
# catch udev hotplug events
echo /sbin/mdev > /proc/sys/kernel/hotplug
} }
test_success() { test_success() {
@ -391,6 +388,22 @@ bind_mount_dev() {
mount -o bind ${NEW_ROOT}/dev /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() { start_dev_mgr() {
# Check udev is available... # Check udev is available...
if [ "${KV_2_6_OR_GREATER}" -a "${USE_UDEV_NORMAL}" != '0' ] if [ "${KV_2_6_OR_GREATER}" -a "${USE_UDEV_NORMAL}" != '0' ]
@ -460,9 +473,9 @@ cmdline_hwopts() {
} }
load_modules() { 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 then
good_msg 'Loading modules' good_msg 'Loading modules'
# Load appropriate kernel modules # Load appropriate kernel modules

@ -220,8 +220,11 @@ splash 'init'
detect_sbp2_devices detect_sbp2_devices
cmdline_hwopts cmdline_hwopts
# Load modules listed in MY_HWOPTS if /lib/modules exists # Setup hotplugging for firmware loading
if [ -d '/lib/modules' ] setup_hotplug
# Load modules listed in MY_HWOPTS if /lib/modules exists for the running kernel
if [ -d '/lib/modules/${KV}' ]
then then
good_msg 'Loading modules' good_msg 'Loading modules'
# Load appropriate kernel modules # Load appropriate kernel modules

Loading…
Cancel
Save