Add --all-initrd-modules option to copy all kernel modules into initrd/ramfs. This...
authorAndrew Gaffney <agaffney@gentoo.org>
Sun, 3 Feb 2008 19:41:08 +0000 (19:41 +0000)
committerAndrew Gaffney <agaffney@gentoo.org>
Sun, 3 Feb 2008 19:41:08 +0000 (19:41 +0000)
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@587 67a159dc-881f-0410-a524-ba9dfbe2cb84

ChangeLog
gen_cmdline.sh
gen_determineargs.sh
gen_moddeps.sh

index 5b5c7be82637b56edec6352c33cef0d624860033..22cbf287b359e8364505e3e0619c62ec71ada6c5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,11 @@
 # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2
 # $Header: $
 
+  03 Feb 2008; Andrew Gaffney <agaffney@gentoo.org> gen_cmdline.sh,
+  gen_determineargs.sh, gen_moddeps.sh:
+  Add --all-initrd-modules option to copy all kernel modules into
+  initrd/ramfs. This is useful for netboot images
+
   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
index 65d692f8197d22adde55051442c07448d37370ea..55e306353321df22795dd399e91fb71771d9f2c3 100755 (executable)
@@ -40,6 +40,7 @@ longusage() {
   echo "       --symlink               Manage symlinks in /boot for installed images"
   echo "       --no-symlink            Do not manage symlinks"
   echo "       --no-initrdmodules      Don't copy any modules to the initrd"
+  echo "       --all-initrd-modules    Copy all kernel modules to the initrd"
   echo "       --callback=<...>        Run the specified arguments after the"
   echo "                               kernel and modules have been compiled"
   echo "       --static                Build a static (monolithic kernel)."
@@ -368,6 +369,10 @@ parse_cmdline() {
                        CMD_NOINITRDMODULES=1
                        print_info 2 "CMD_NOINITRDMODULES: ${CMD_NOINITRDMODULES}"
                        ;;
+               --all-initrd-modules)
+                       CMD_ALLINITRDMODULES=1
+                       print_info 2 "CMD_ALLINITRDMODULES: ${CMD_ALLINITRDMODULES}"
+                       ;;
                --callback=*)
                        CMD_CALLBACK=`parse_opt "$*"`
                        print_info 2 "CMD_CALLBACK: ${CMD_CALLBACK}/$*"
index cd79b322702dffa33826a00c7ffb56145bb41947..68b0ba0c16304b3dc616fae1e317c01ac3875836 100644 (file)
@@ -99,6 +99,7 @@ determine_real_args() {
        set_config_with_override 2 MODULESPACKAGE       CMD_MODULESPACKAGE
        set_config_with_override 2 KERNCACHE            CMD_KERNCACHE
        set_config_with_override 1 NOINITRDMODULES      CMD_NOINITRDMODULES
+       set_config_with_override 1 ALLINITRDMODULES     CMD_ALLINITRDMODULES
        set_config_with_override 2 INITRAMFS_OVERLAY    CMD_INITRAMFS_OVERLAY
        set_config_with_override 1 MOUNTBOOT            CMD_MOUNTBOOT
        set_config_with_override 1 BUILD_STATIC         CMD_STATIC
index a699e66bda2a67ec846ce8274bda4efc8b574a11..fa550e51555ab5a1af3a9a29b2415ff5e0a7dc27 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-modules_dep_list()
+modules_kext()
 {
        if [ "${PAT}" -gt "4" ]
        then
@@ -8,6 +8,12 @@ modules_dep_list()
        else
                KEXT=".o"
        fi
+       echo ${KEXT}
+}
+
+modules_dep_list()
+{
+       KEXT=$(modules_kext)
        if [ -f ${INSTALL_MOD_PATH}/lib/modules/${KV}/modules.dep ]
        then
                cat ${INSTALL_MOD_PATH}/lib/modules/${KV}/modules.dep | grep ${1}${KEXT}\: | cut -d\:  -f2
@@ -54,16 +60,20 @@ gen_deps()
 
 gen_dep_list()
 {
-       local group_modules     
-       rm -f ${TEMP}/moddeps > /dev/null
+       if [ "${ALLINITRDMODULES}" = "1" ]; then
+               strip_mod_paths $(find "${INSTALL_MOD_PATH}/lib/modules/${KV}" -name "*$(modules_kext)") | sort
+       else
+               local group_modules     
+               rm -f ${TEMP}/moddeps > /dev/null
        
-       for group_modules in ${!MODULES_*}; do
-               gen_deps ${!group_modules}
-       done
+               for group_modules in ${!MODULES_*}; do
+                       gen_deps ${!group_modules}
+               done
 
-       # Only list each module once
-       if [ -f ${TEMP}/moddeps ]
-       then
-           cat ${TEMP}/moddeps | sort | uniq
+               # Only list each module once
+               if [ -f ${TEMP}/moddeps ]
+               then
+                   cat ${TEMP}/moddeps | sort | uniq
+               fi
        fi
 }