From 80fb4b4d11e77127e4ccbd6fc5f4932c7d77f413 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Fri, 9 May 2008 22:15:46 +0000 Subject: [PATCH] Add nomodules kernel commandline parameter to disable loading of modules git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/genkernel/trunk@675 67a159dc-881f-0410-a524-ba9dfbe2cb84 --- ChangeLog | 4 ++++ generic/initrd.defaults | 4 ++-- generic/initrd.scripts | 9 +++------ generic/linuxrc | 10 ++++------ 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index eb10368..1461b1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,10 @@ # Copyright 2006-2008 Gentoo Foundation; Distributed under the GPL v2 # $Header: $ + 09 May 2008; Andrew Gaffney generic/initrd.defaults, + generic/initrd.scripts, generic/linuxrc: + Add nomodules kernel commandline parameter to disable loading of modules + 09 May 2008; Andrew Gaffney gen_funcs.sh, genkernel, genkernel.conf: Move distfile cache to /var/cache/genkernel/src and add check to make sure diff --git a/generic/initrd.defaults b/generic/initrd.defaults index ba61cd9..689747f 100644 --- a/generic/initrd.defaults +++ b/generic/initrd.defaults @@ -77,5 +77,5 @@ LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' # Only sections that are in by default or those that # are not module groups need to be defined here... -HWOPTS='keymap cache pata sata scsi usb firewire slowusb evms lvm dmraid mdadm fs net' -MY_HWOPTS='pata sata scsi usb firewire dmraid mdadm fs net' +HWOPTS='keymap cache modules pata sata scsi usb firewire slowusb evms lvm dmraid mdadm fs net' +MY_HWOPTS='modules pata sata scsi usb firewire dmraid mdadm fs net' diff --git a/generic/initrd.scripts b/generic/initrd.scripts index 3589f40..7e42be9 100644 --- a/generic/initrd.scripts +++ b/generic/initrd.scripts @@ -448,13 +448,11 @@ cmdline_hwopts() { do if [ "${y}" = "${x}" ] then - FOUND=1 + continue 2 fi done - if [ ! "${FOUND}" = '1' ] - then - TMP_HWOPTS="${TMP_HWOPTS} ${x}" - fi + TMP_HWOPTS="${TMP_HWOPTS} ${x}" + eval DO_`echo ${x} | sed 's/-//'`=1 done MY_HWOPTS=${TMP_HWOPTS} @@ -470,7 +468,6 @@ load_modules() { for modules in $MY_HWOPTS do modules_scan $modules - eval DO_`echo $modules | sed 's/-//'`=1 done else good_msg 'Skipping module load; no modules in the initrd!' diff --git a/generic/linuxrc b/generic/linuxrc index c53a89e..03745f4 100644 --- a/generic/linuxrc +++ b/generic/linuxrc @@ -203,7 +203,10 @@ mount_sysfs setup_hotplug # Load modules listed in MY_HWOPTS if /lib/modules exists for the running kernel -if [ -d "/lib/modules/${KV}" ] +if [ -z "${DO_modules}" ] +then + good_msg 'Skipping module load; disabled via commandline' +elif [ -d "/lib/modules/${KV}" ] then good_msg 'Loading modules' # Load appropriate kernel modules @@ -212,16 +215,11 @@ then for modules in ${MY_HWOPTS} do modules_scan ${modules} - eval DO_`echo ${modules} | sed 's/-//'`=1 done fi # Always eval doload=... modules_load ${MDOLIST} else - for modules in ${MY_HWOPTS} - do - eval DO_`echo ${modules} | sed 's/-//'`=1 - done good_msg 'Skipping module load; no modules in the initrd!' fi -- 2.26.2