All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add option --ignore-kernel-modules
@ 2010-08-04 16:15 Amadeusz Żołnowski
       [not found] ` <20100804181519.5eaf9f1c-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Amadeusz Żołnowski @ 2010-08-04 16:15 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 3616 bytes --]

Instead of adding modprobe and rmmod, create symlinks to /bin/true to
don't produce unnecessary errors.  Anyway it's a workaround for
following desired behaviour: modprobe tries to insert module only if
it's not built into kernel
---
 dracut                   |   10 +++++++++-
 dracut.8                 |    4 ++++
 modules.d/99base/install |   13 ++++++++++---
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/dracut b/dracut
index c22051c..e0c2186 100755
--- a/dracut
+++ b/dracut
@@ -46,6 +46,10 @@ Creates initial ramdisk images for preloading modules
                         firmwares, separated by :
   --kernel-only         Only install kernel drivers and firmware files
   --no-kernel           Do not install kernel drivers and firmware files
+  --ignore-kernel-modules
+                        Don't try to load modules. It automatically implies
+                        '--no-kernel'. It's assumed that everything needed
+                        is built into kernel.
   --strip               Strip binaries in the initramfs
   --nostrip             Do not strip binaries in the initramfs (default)
   --mdadmconf           Include local /etc/mdadm.conf
@@ -86,6 +90,10 @@ while (($# > 0)); do
 	--fwdir) fw_dir_l="$2"; shift;;
 	--kernel-only) kernel_only="yes"; no_kernel="no";;
 	--no-kernel) kernel_only="no"; no_kernel="yes";;
+    --ignore-kernel-modules) kernel_only="no"; no_kernel="yes"
+        ignore_kmodules="yes"
+        omit_dracutmodules_l+=\ kernel-modules
+        ;;
 	--strip) do_strip_l="yes";;
 	--nostrip) do_strip_l="no";;
         --mdadmconf) mdadmconf_l="yes";;
@@ -228,7 +236,7 @@ chmod 755 "$initdir"
 
 export initdir hookdirs dracutbasedir dracutmodules drivers \
     fw_dir drivers_dir debug beverbose no_kernel kernel_only \
-    add_drivers mdadmconf lvmconf filesystems
+    add_drivers mdadmconf lvmconf filesystems ignore_kmodules
 
 if [[ $kernel_only != yes ]]; then
     # Create some directory structure first
diff --git a/dracut.8 b/dracut.8
index 3a85cb5..4890357 100644
--- a/dracut.8
+++ b/dracut.8
@@ -52,6 +52,10 @@ only install kernel drivers and firmware files
 .BR \-\-no-kernel
 do not install kernel drivers and firmware files
 .TP
+.BR \-\-ignore-kernel-modules
+don't try to load modules; it automatically implies \fB--no-kernel\fR; it's
+assumed that everything needed is built into kernel
+.TP
 .BR \-\-mdadmconf
 include local /etc/mdadm.conf
 .TP
diff --git a/modules.d/99base/install b/modules.d/99base/install
index 6ba9e7e..9cdb086 100755
--- a/modules.d/99base/install
+++ b/modules.d/99base/install
@@ -1,6 +1,13 @@
 #!/bin/bash
-dracut_install mount mknod mkdir modprobe pidof sleep chroot \
-    sed ls flock cp mv dmesg rm ln rmmod mkfifo less 
+dracut_install mount mknod mkdir pidof sleep chroot sed ls flock cp mv dmesg \
+        rm ln mkfifo less 
+if [[ ${ignore_kmodules} = yes ]]; then
+    inst /bin/true
+    ln -s /bin/true "${initdir}"/sbin/modprobe
+    ln -s /bin/true "${initdir}"/sbin/rmmod
+else
+    dracut_install modprobe rmmod
+fi
 if [ ! -e "${initdir}/bin/sh" ]; then
     dracut_install bash
     (ln -s bash "${initdir}/bin/sh" || :)
@@ -18,7 +25,7 @@ if which switch_root >/dev/null 2>&1; then
     dracut_install switch_root 
 else
     inst "$moddir/switch_root" "/sbin/switch_root" \
-	|| derror "Failed to install switch_root"
+            || derror "Failed to install switch_root"
 fi
 inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
 inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
-- 
1.7.2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] add option --ignore-kernel-modules
       [not found] ` <20100804181519.5eaf9f1c-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
@ 2010-08-04 16:32   ` Harald Hoyer
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Hoyer @ 2010-08-04 16:32 UTC (permalink / raw)
  To: Amadeusz Żołnowski; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

pushed

On 08/04/2010 06:15 PM, Amadeusz Żołnowski wrote:
> Instead of adding modprobe and rmmod, create symlinks to /bin/true to
> don't produce unnecessary errors.  Anyway it's a workaround for
> following desired behaviour: modprobe tries to insert module only if
> it's not built into kernel
> ---
>   dracut                   |   10 +++++++++-
>   dracut.8                 |    4 ++++
>   modules.d/99base/install |   13 ++++++++++---
>   3 files changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/dracut b/dracut
> index c22051c..e0c2186 100755
> --- a/dracut
> +++ b/dracut
> @@ -46,6 +46,10 @@ Creates initial ramdisk images for preloading modules
>                           firmwares, separated by :
>     --kernel-only         Only install kernel drivers and firmware files
>     --no-kernel           Do not install kernel drivers and firmware files
> +  --ignore-kernel-modules
> +                        Don't try to load modules. It automatically implies
> +                        '--no-kernel'. It's assumed that everything needed
> +                        is built into kernel.
>     --strip               Strip binaries in the initramfs
>     --nostrip             Do not strip binaries in the initramfs (default)
>     --mdadmconf           Include local /etc/mdadm.conf
> @@ -86,6 +90,10 @@ while (($#>  0)); do
>   	--fwdir) fw_dir_l="$2"; shift;;
>   	--kernel-only) kernel_only="yes"; no_kernel="no";;
>   	--no-kernel) kernel_only="no"; no_kernel="yes";;
> +    --ignore-kernel-modules) kernel_only="no"; no_kernel="yes"
> +        ignore_kmodules="yes"
> +        omit_dracutmodules_l+=\ kernel-modules
> +        ;;
>   	--strip) do_strip_l="yes";;
>   	--nostrip) do_strip_l="no";;
>           --mdadmconf) mdadmconf_l="yes";;
> @@ -228,7 +236,7 @@ chmod 755 "$initdir"
>
>   export initdir hookdirs dracutbasedir dracutmodules drivers \
>       fw_dir drivers_dir debug beverbose no_kernel kernel_only \
> -    add_drivers mdadmconf lvmconf filesystems
> +    add_drivers mdadmconf lvmconf filesystems ignore_kmodules
>
>   if [[ $kernel_only != yes ]]; then
>       # Create some directory structure first
> diff --git a/dracut.8 b/dracut.8
> index 3a85cb5..4890357 100644
> --- a/dracut.8
> +++ b/dracut.8
> @@ -52,6 +52,10 @@ only install kernel drivers and firmware files
>   .BR \-\-no-kernel
>   do not install kernel drivers and firmware files
>   .TP
> +.BR \-\-ignore-kernel-modules
> +don't try to load modules; it automatically implies \fB--no-kernel\fR; it's
> +assumed that everything needed is built into kernel
> +.TP
>   .BR \-\-mdadmconf
>   include local /etc/mdadm.conf
>   .TP
> diff --git a/modules.d/99base/install b/modules.d/99base/install
> index 6ba9e7e..9cdb086 100755
> --- a/modules.d/99base/install
> +++ b/modules.d/99base/install
> @@ -1,6 +1,13 @@
>   #!/bin/bash
> -dracut_install mount mknod mkdir modprobe pidof sleep chroot \
> -    sed ls flock cp mv dmesg rm ln rmmod mkfifo less
> +dracut_install mount mknod mkdir pidof sleep chroot sed ls flock cp mv dmesg \
> +        rm ln mkfifo less
> +if [[ ${ignore_kmodules} = yes ]]; then
> +    inst /bin/true
> +    ln -s /bin/true "${initdir}"/sbin/modprobe
> +    ln -s /bin/true "${initdir}"/sbin/rmmod
> +else
> +    dracut_install modprobe rmmod
> +fi
>   if [ ! -e "${initdir}/bin/sh" ]; then
>       dracut_install bash
>       (ln -s bash "${initdir}/bin/sh" || :)
> @@ -18,7 +25,7 @@ if which switch_root>/dev/null 2>&1; then
>       dracut_install switch_root
>   else
>       inst "$moddir/switch_root" "/sbin/switch_root" \
> -	|| derror "Failed to install switch_root"
> +            || derror "Failed to install switch_root"
>   fi
>   inst "$moddir/dracut-lib.sh" "/lib/dracut-lib.sh"
>   inst_hook cmdline 10 "$moddir/parse-root-opts.sh"

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-04 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-04 16:15 [PATCH] add option --ignore-kernel-modules Amadeusz Żołnowski
     [not found] ` <20100804181519.5eaf9f1c-2qtfh70TtYba5EbDDlwbIw@public.gmane.org>
2010-08-04 16:32   ` Harald Hoyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.