From 050a1da1d2308838edb5d92baf44179cf2cfc510 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Sun, 3 Feb 2008 19:41:08 +0000 Subject: [PATCH] Add --all-initrd-modules option to copy all kernel modules into initrd/ramfs. This is useful for netboot images git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@587 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- ChangeLog | 5 +++++ gen_cmdline.sh | 5 +++++ gen_determineargs.sh | 1 + gen_moddeps.sh | 30 ++++++++++++++++++++---------- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5b5c7be..22cbf28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,11 @@ # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 03 Feb 2008; Andrew Gaffney 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 generic/initrd.scripts, generic/linuxrc: Add setup_hotplug() function that runs before the modules are loaded to diff --git a/gen_cmdline.sh b/gen_cmdline.sh index 65d692f..55e3063 100755 --- a/gen_cmdline.sh +++ b/gen_cmdline.sh @@ -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}/$*" diff --git a/gen_determineargs.sh b/gen_determineargs.sh index cd79b32..68b0ba0 100644 --- a/gen_determineargs.sh +++ b/gen_determineargs.sh @@ -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 diff --git a/gen_moddeps.sh b/gen_moddeps.sh index a699e66..fa550e5 100644 --- a/gen_moddeps.sh +++ b/gen_moddeps.sh @@ -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 } -- 2.26.2