Reverting the removal of generic/modprobe for bug #197730. This is genkernel 3.4...
authorChris Gianelloni <wolf31o2@gentoo.org>
Fri, 2 Nov 2007 00:37:39 +0000 (00:37 +0000)
committerChris Gianelloni <wolf31o2@gentoo.org>
Fri, 2 Nov 2007 00:37:39 +0000 (00:37 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@551 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
gen_initramfs.sh
gen_initrd.sh
generic/modprobe [new file with mode: 0755]
genkernel

index c093ce427f04dac63a7efb4f30d705003bb9f309..20ebcf53b5d6c8f7d6bdc09705fb65eb93582a1e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 # Copyright 2006-2007 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  02 Nov 2007; Chris Gianelloni <wolf31o2@gentoo.org> ++, gen_initramfs.sh,
+  gen_initrd.sh, genkernel:
+  Reverting the removal of generic/modprobe for bug #197730. This is genkernel
+  3.4.9_pre6 for testing.
+
   01 Nov 2007; Chris Gianelloni <wolf31o2@gentoo.org> gen_compile.sh,
   gen_initramfs.sh, genkernel:
   Fixed device-mapper/man removal for bug #196087, fixed mdadm.conf copying,
index 8790cd98c90e37333f74bb5132f7050e83495c91..852b129bff33ff6efc57d2fcbc40e41552e700a9 100644 (file)
@@ -384,6 +384,12 @@ append_auxilary() {
        done
        echo '"' >> "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"    
 
+       if [ -f "${GK_SHARE}/${ARCH}/modprobe" ]
+       then
+               cp "${GK_SHARE}/${ARCH}/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
+       else
+               cp "${GK_SHARE}/generic/modprobe" "${TEMP}/initramfs-aux-temp/sbin/modprobe"
+       fi
        if isTrue $CMD_DOKEYMAPAUTO
        then
                echo 'MY_HWOPTS="${MY_HWOPTS} keymap"' >> ${TEMP}/initramfs-aux-temp/etc/initrd.defaults
@@ -413,6 +419,7 @@ append_auxilary() {
        chmod +x "${TEMP}/initramfs-aux-temp/init"
        chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.scripts"
        chmod +x "${TEMP}/initramfs-aux-temp/etc/initrd.defaults"
+       chmod +x "${TEMP}/initramfs-aux-temp/sbin/modprobe"
        cd "${TEMP}/initramfs-aux-temp/"
        find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
        cd "${TEMP}"
index 5d75e04151d82569e26758ee4bdd587573d3e029..072e73879e9978274136714b16c6382742014620 100644 (file)
@@ -310,6 +310,12 @@ create_initrd_aux() {
        done
        echo '"' >> "${TEMP}/initrd-temp/etc/initrd.defaults"   
 
+       if [ -f "${GK_SHARE}/${ARCH}/modprobe" ]
+       then
+               cp "${GK_SHARE}/${ARCH}/modprobe" "${TEMP}/initrd-temp/sbin/modprobe"
+       else
+               cp "${GK_SHARE}/generic/modprobe" "${TEMP}/initrd-temp/sbin/modprobe"
+       fi
        if isTrue $CMD_DOKEYMAPAUTO
        then
                echo 'MY_HWOPTS="${MY_HWOPTS} keymap"' >> ${TEMP}/initrd-temp/etc/initrd.defaults
@@ -326,6 +332,7 @@ create_initrd_aux() {
        chmod +x "${TEMP}/initrd-temp/linuxrc"
        chmod +x "${TEMP}/initrd-temp/etc/initrd.scripts"
        chmod +x "${TEMP}/initrd-temp/etc/initrd.defaults"
+       chmod +x "${TEMP}/initrd-temp/sbin/modprobe"
 }
 
 calc_initrd_size() {
diff --git a/generic/modprobe b/generic/modprobe
new file mode 100755 (executable)
index 0000000..ff676f7
--- /dev/null
@@ -0,0 +1,143 @@
+#!/bin/ash
+# Apparently, this is required for proper functionality with busybox 1.1.3
+# Check out bug #197730 for more details.
+
+. /etc/initrd.defaults
+
+usage() {
+       echo 'Usage:'
+       echo '  modprobe moduleprefix'
+       echo
+       echo 'Example:'
+       echo '  modprobe eepro100'
+       echo
+       echo 'Note: Do not pass the suffix to modprobe!'
+       exit 1
+}
+
+# Pass module name to this function
+modules_dep_list() {
+       if [ "$#" -lt '1' ]
+       then
+               echo 'modules_dep_list(): Improper usage!'
+               exit 1
+       fi
+       cat /lib/modules/${KV}/modules.dep | grep ${1}${KSUFF}\: | cut -d\:  -f2
+}
+
+
+# Pass module deps list
+strip_mod_paths() {
+       local x
+       local ret
+       local myret
+
+       [ "$#" -lt '1' ] && return
+
+       for x in ${*}
+       do
+               ret=`basename ${x} | cut -d. -f1`
+               myret="${myret} ${ret}"
+       done
+       echo "${myret}"
+}
+
+LOADED_MODULES=''
+is_module_already_loaded() {
+       local x
+       if [ "$#" != '1' ]
+       then
+               echo 'is_module_already_loaded(): Improper usage!'
+       fi
+
+       for x in ${LOADED_MODULES}
+       do
+               if [ "${x}" = "${1}" ]
+               then
+                       # Yep, module is loaded
+                       return 0
+               fi
+       done
+       return 1
+}
+
+real_mod_path() {
+       # Find -name is no good since the return status is always zero
+       find /lib/modules | grep /"${1}${KSUFF}"
+}
+
+modprobe2() {
+       local x
+       local deps
+       local real_path
+       local modlist
+       local ret
+
+       local echoAppend
+       local echoFlags
+
+       if [ "$#" -lt '1' ]
+       then
+               usage
+               exit 1
+       fi
+       real_path=`real_mod_path ${1}`
+       if [ "${real_path}" = '' -o "${real_path}" = ' ' ]
+       then
+               echo ' module not found.'
+               exit 2
+       fi
+       modlist=`modules_dep_list ${1}`
+       if [ "${modlist}" != '' -a "${modlist}" != ' ' ]
+       then
+               deps=`strip_mod_paths ${modlist}`
+       else
+               deps=''
+       fi
+       # Make sure we don't do any endless loops!
+
+       LOADED_MODULES="${LOADED_MODULES} ${1}"
+       for x in ${deps}
+       do
+               if ! is_module_already_loaded ${x}
+               then
+                       if [ "${x}" != '' -a "${x}" != ' ' ]
+                       then
+                               modprobe2 "${x}" -n
+                       fi
+               else
+                       filler=1
+               fi
+       done
+       ${INSMOD} ${real_path} > /dev/null 2>&1
+       ret=$?
+       if [ "$ret" -eq '0' ]
+       then
+               echoAppend=' loaded.'
+               [ "${2}" = '-n' ] && echoFlags='-n' && echoAppend=', '
+               echo ${echoFlags} "${1}${echoAppend}"
+       fi
+       return $ret
+}
+
+if [ "$#" -lt '1' ]
+then
+       usage
+fi
+
+[ -f '/modules.cache' ] || touch /modules.cache
+for x in `cat /modules.cache`
+do
+       LOADED_MODULES="${LOADED_MODULES} ${x}"
+done
+
+modprobe2 ${1}
+modprobe_ret=$?
+
+[ -f '/modules.cache' ] && rm -f /modules.cache > /dev/null 2>&1
+for x in ${LOADED_MODULES}
+do
+       echo $x >> /modules.cache
+done
+
+exit $modprobe_ret
index a9cc7cb8517b9c9d938c0e8879575e637dcbc8d9..422418808456ce53d4ef15d8b2015e0fb6561460 100755 (executable)
--- a/genkernel
+++ b/genkernel
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 PATH="/bin:/usr/bin:/sbin:/usr/sbin"
-GK_V='3.4.9_pre5'
+GK_V='3.4.9_pre6'
 
 # Set the default for TMPDIR.  May be modified by genkernel.conf or the
 # --tempdir command line option.