[v2] dracut: quote DRACUT_EXTRA_MODULES/DRIVERS for --add

Message ID 20260701063504.3110-1-kumar.rakesh@siemens.com
State Superseded
Headers show
Series [v2] dracut: quote DRACUT_EXTRA_MODULES/DRIVERS for --add | expand

Commit Message

Rakesh Kumar July 1, 2026, 6:35 a.m. UTC
extend_dracut_cmdline() joined multiple modules/drivers into the
--add / --add-drivers arguments without quoting. With more than one
entry the shell split the list, so dracut consumed only the first
module and treated the rest as positional arguments (the output image
path), breaking initramfs generation. Quote the lists so they are
passed as a single argument.

Fixes: f785cd0 (Add class to generate custom dracut initramfs)

Signed-off-by: Rakesh Kumar <kumar.rakesh@siemens.com>
---
 meta/classes-recipe/initrd-dracut.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Zhihang Wei July 9, 2026, 3:51 p.m. UTC | #1
Applied to next, thanks.

Zhihang

On 7/1/26 08:35, 'Rakesh Kumar' via isar-users wrote:
> extend_dracut_cmdline() joined multiple modules/drivers into the
> --add / --add-drivers arguments without quoting. With more than one
> entry the shell split the list, so dracut consumed only the first
> module and treated the rest as positional arguments (the output image
> path), breaking initramfs generation. Quote the lists so they are
> passed as a single argument.
>
> Fixes: f785cd0 (Add class to generate custom dracut initramfs)
>
> Signed-off-by: Rakesh Kumar <kumar.rakesh@siemens.com>
> ---
>   meta/classes-recipe/initrd-dracut.bbclass | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes-recipe/initrd-dracut.bbclass b/meta/classes-recipe/initrd-dracut.bbclass
> index bb4b50b7..542b1fbe 100644
> --- a/meta/classes-recipe/initrd-dracut.bbclass
> +++ b/meta/classes-recipe/initrd-dracut.bbclass
> @@ -48,9 +48,9 @@ def extend_dracut_cmdline(d):
>       if config_path:
>           cmdline.append(f"--conf {config_path}")
>       if extra_drivers:
> -        cmdline.append(f"--add-drivers {extra_drivers}")
> +        cmdline.append(f'--add-drivers "{extra_drivers}"')
>       if extra_modules:
> -        cmdline.append(f"--add {extra_modules}")
> +        cmdline.append(f'--add "{extra_modules}"')
>       return ' '.join(cmdline)
>   
>   ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append = " ${@ extend_dracut_cmdline(d)}"

Patch

diff --git a/meta/classes-recipe/initrd-dracut.bbclass b/meta/classes-recipe/initrd-dracut.bbclass
index bb4b50b7..542b1fbe 100644
--- a/meta/classes-recipe/initrd-dracut.bbclass
+++ b/meta/classes-recipe/initrd-dracut.bbclass
@@ -48,9 +48,9 @@  def extend_dracut_cmdline(d):
     if config_path:
         cmdline.append(f"--conf {config_path}")
     if extra_drivers:
-        cmdline.append(f"--add-drivers {extra_drivers}")
+        cmdline.append(f'--add-drivers "{extra_drivers}"')
     if extra_modules:
-        cmdline.append(f"--add {extra_modules}")
+        cmdline.append(f'--add "{extra_modules}"')
     return ' '.join(cmdline)
 
 ROOTFS_INITRAMFS_GENERATOR_CMDLINE:append = " ${@ extend_dracut_cmdline(d)}"