mkinitrd unification across distributions
 help / color / mirror / Atom feed
* How to have dracut conditionally add different kernel modules for different kernels?
@ 2015-04-10 19:11 lyndat3-p/IIKWkZnU0S+FvcfC7Uqw
       [not found] ` <1428693113.1734218.251850073.54517680-2RFepEojUI2N1INw9kWLP6GC3tUn3ZHUQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: lyndat3-p/IIKWkZnU0S+FvcfC7Uqw @ 2015-04-10 19:11 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

The distro I use, opensuse, has switched to using dracut for initrd creation.

Prior to dracut usage, kernel-flavor-specific loading -- particularly for the case of Xen -- could be defined in

 /etc/sysconfig/kernel
  ...
  INITRD_MODULES="processor thermal ahci fan jbd ext3 edd"
  DOMU_INITRD_MODULES="xennet xenblk"
  ...

On 'old' mkinitrd, if both -xen and non-xen kernels were installed, initrd's were created for each.  In the xen case the modules defined in "DOMU_INITRD_MODULES" were conditionally added to the initrd-xen.

Since the  switch to dracut, module config/loading is defined in dracut.conf & dracut.d/*conf

But the 

add_drivers+=" ... " 

is apparently added for all kernels.

What's the right way to add kernel-specific modules in dracut, so that for example the xen mods are ONLY added in the xen case?

LT

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

* Re: How to have dracut conditionally add different kernel modules for different kernels?
       [not found] ` <1428693113.1734218.251850073.54517680-2RFepEojUI2N1INw9kWLP6GC3tUn3ZHUQQ4Iyu8u01E@public.gmane.org>
@ 2015-04-12  8:11   ` Andrei Borzenkov
       [not found]     ` <20150412111154.5de2405f-stAJ6ESoqRzYCGPCin2YbQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Andrei Borzenkov @ 2015-04-12  8:11 UTC (permalink / raw)
  To: lyndat3-p/IIKWkZnU0S+FvcfC7Uqw; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

В Fri, 10 Apr 2015 12:11:53 -0700
lyndat3-p/IIKWkZnU0S+FvcfC7Uqw@public.gmane.org пишет:

> The distro I use, opensuse, has switched to using dracut for initrd creation.
> 
> Prior to dracut usage, kernel-flavor-specific loading -- particularly for the case of Xen -- could be defined in
> 
>  /etc/sysconfig/kernel
>   ...
>   INITRD_MODULES="processor thermal ahci fan jbd ext3 edd"
>   DOMU_INITRD_MODULES="xennet xenblk"
>   ...
> 
> On 'old' mkinitrd, if both -xen and non-xen kernels were installed, initrd's were created for each.  In the xen case the modules defined in "DOMU_INITRD_MODULES" were conditionally added to the initrd-xen.
> 
> Since the  switch to dracut, module config/loading is defined in dracut.conf & dracut.d/*conf
> 
> But the 
> 
> add_drivers+=" ... " 
> 
> is apparently added for all kernels.
> 
> What's the right way to add kernel-specific modules in dracut, so that for example the xen mods are ONLY added in the xen case?

Not sure about the "right" way, but dracut configuration files are
shell scripts, so you can implement the same logic in /etc/dracut.d
snippet, something like

if is_xen_kernel ; then
  add_drivers+=" ..."
fi

where is_xen_kernel does whatever check is required to detect domU
kernel.

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

* Re: How to have dracut conditionally add different kernel modules for different kernels?
       [not found]     ` <20150412111154.5de2405f-stAJ6ESoqRzYCGPCin2YbQ@public.gmane.org>
@ 2015-04-12 16:32       ` lyndat3-p/IIKWkZnU0S+FvcfC7Uqw
  0 siblings, 0 replies; 3+ messages in thread
From: lyndat3-p/IIKWkZnU0S+FvcfC7Uqw @ 2015-04-12 16:32 UTC (permalink / raw)
  To: Andrei Borzenkov; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA



On Sun, Apr 12, 2015, at 01:11 AM, Andrei Borzenkov wrote:
> > What's the right way to add kernel-specific modules in dracut, so that for example the xen mods are ONLY added in the xen case?
> 
> Not sure about the "right" way, but dracut configuration files are
> shell scripts, so you can implement the same logic in /etc/dracut.d
> snippet, something like
> 
> if is_xen_kernel ; then
>   add_drivers+=" ..."
> fi
> 
> where is_xen_kernel does whatever check is required to detect domU
> kernel.

Option to use if ...  should do the trick.

Detecting if xen is RUNNING is

if test -d /proc/xen; then
 whatver
fi

But that's not the needed test.  Like you said have to get a test that checks if the dracut TARGET is a xen kernel.  When dracut's running across multiple xen & non-xen kernels, I'm not yet sure how to hook that info from inside dracut.conf.

LT

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-10 19:11 How to have dracut conditionally add different kernel modules for different kernels? lyndat3-p/IIKWkZnU0S+FvcfC7Uqw
     [not found] ` <1428693113.1734218.251850073.54517680-2RFepEojUI2N1INw9kWLP6GC3tUn3ZHUQQ4Iyu8u01E@public.gmane.org>
2015-04-12  8:11   ` Andrei Borzenkov
     [not found]     ` <20150412111154.5de2405f-stAJ6ESoqRzYCGPCin2YbQ@public.gmane.org>
2015-04-12 16:32       ` lyndat3-p/IIKWkZnU0S+FvcfC7Uqw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox