public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd
@ 2025-01-10 11:50 peter.czegledy via isar-users
  2025-01-10 16:05 ` 'Jan Kiszka' via isar-users
  2025-01-10 16:42 ` [PATCH] " 'Quirin Gylstorff' via isar-users
  0 siblings, 2 replies; 6+ messages in thread
From: peter.czegledy via isar-users @ 2025-01-10 11:50 UTC (permalink / raw)
  To: isar-users; +Cc: benedikt.niedermayr, Peter Czegledy

From: Peter Czegledy <peter.czegledy@evosoft.com>

Specifying the initrd location via WICs sourceparams initrd argument doesn't generate the initrd location properly.

This fixes that and furthermore cleans up some related redundant assignments to kernel variable as they do not impact the final value.

Signed-off-by: Peter Czegledy <peter.czegledy@evosoft.com>
---
 .../lib/wic/plugins/source/bootimg-efi-isar.py   | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index 50f4187d..243824ae 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -97,20 +97,18 @@ class BootimgEFIPlugin(SourcePlugin):
             grubefi_conf += "timeout=%s\n" % bootloader.timeout
             grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot")
 
-            kernel = get_bitbake_var("KERNEL_IMAGETYPE")
-            if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
-                if get_bitbake_var("INITRAMFS_IMAGE"):
-                    kernel = "%s-%s.bin" % \
-                        (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
-
             label = source_params.get('label')
             label_conf = "root=%s" % creator.rootdev
             if label:
                 label_conf = "LABEL=%s" % label
 
+            temp_initrd = initrd
             kernel, initrd = isar_get_filenames(
                 get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
             )
+            if temp_initrd:
+                initrd = temp_initrd
+
             grubefi_conf += "linux /%s %s rootwait %s\n" \
                 % (kernel, label_conf, bootloader.append)
 
@@ -179,12 +177,6 @@ class BootimgEFIPlugin(SourcePlugin):
 
         if not custom_cfg:
             # Create systemd-boot configuration using parameters from wks file
-            kernel = get_bitbake_var("KERNEL_IMAGETYPE")
-            if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
-                if get_bitbake_var("INITRAMFS_IMAGE"):
-                    kernel = "%s-%s.bin" % \
-                        (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
-
             title = source_params.get('title')
 
             temp_initrd = initrd
-- 
2.39.5

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250110115028.256057-1-peter.czegledy%40evosoft.com.

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

* Re: [PATCH] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd
  2025-01-10 11:50 [PATCH] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd peter.czegledy via isar-users
@ 2025-01-10 16:05 ` 'Jan Kiszka' via isar-users
  2025-01-10 20:30   ` [PATCH v2] " peter.czegledy via isar-users
  2025-01-10 16:42 ` [PATCH] " 'Quirin Gylstorff' via isar-users
  1 sibling, 1 reply; 6+ messages in thread
From: 'Jan Kiszka' via isar-users @ 2025-01-10 16:05 UTC (permalink / raw)
  To: peter.czegledy, isar-users; +Cc: benedikt.niedermayr

On 10.01.25 12:50, peter.czegledy via isar-users wrote:
> From: Peter Czegledy <peter.czegledy@evosoft.com>
> 
> Specifying the initrd location via WICs sourceparams initrd argument doesn't generate the initrd location properly.
> 
> This fixes that and furthermore cleans up some related redundant assignments to kernel variable as they do not impact the final value.
> 
> Signed-off-by: Peter Czegledy <peter.czegledy@evosoft.com>
> ---
>  .../lib/wic/plugins/source/bootimg-efi-isar.py   | 16 ++++------------
>  1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> index 50f4187d..243824ae 100644
> --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> @@ -97,20 +97,18 @@ class BootimgEFIPlugin(SourcePlugin):
>              grubefi_conf += "timeout=%s\n" % bootloader.timeout
>              grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot")
>  
> -            kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> -            if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
> -                if get_bitbake_var("INITRAMFS_IMAGE"):
> -                    kernel = "%s-%s.bin" % \
> -                        (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
> -

Please split the cleanups into a separate patch.

BTW, that dead code comes from taking OE's bootimg-efi.py as template
and then adding isar specifics to it. See
scripts/lib/wic/plugins/source/bootimg-efi.py.

>              label = source_params.get('label')
>              label_conf = "root=%s" % creator.rootdev
>              if label:
>                  label_conf = "LABEL=%s" % label
>  
> +            temp_initrd = initrd
>              kernel, initrd = isar_get_filenames(
>                  get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
>              )
> +            if temp_initrd:
> +                initrd = temp_initrd
> +

This is a bit strange pattern, even if we have it elsewhere already.
Better (and shorter):

kernel, default_initrd = isar_get_filenames(...)
if not initrd:
    initrd = default_initrd

>              grubefi_conf += "linux /%s %s rootwait %s\n" \
>                  % (kernel, label_conf, bootloader.append)
>  
> @@ -179,12 +177,6 @@ class BootimgEFIPlugin(SourcePlugin):
>  
>          if not custom_cfg:
>              # Create systemd-boot configuration using parameters from wks file
> -            kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> -            if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
> -                if get_bitbake_var("INITRAMFS_IMAGE"):
> -                    kernel = "%s-%s.bin" % \
> -                        (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
> -
>              title = source_params.get('title')
>  
>              temp_initrd = initrd

Jan

-- 
Siemens AG, Foundational Technologies
Linux Expert Center

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/f3de208c-dcac-4852-b87a-8046636f1aa2%40siemens.com.

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

* Re: [PATCH] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd
  2025-01-10 11:50 [PATCH] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd peter.czegledy via isar-users
  2025-01-10 16:05 ` 'Jan Kiszka' via isar-users
@ 2025-01-10 16:42 ` 'Quirin Gylstorff' via isar-users
  2025-01-13 16:16   ` 'Niedermayr, BENEDIKT' via isar-users
  1 sibling, 1 reply; 6+ messages in thread
From: 'Quirin Gylstorff' via isar-users @ 2025-01-10 16:42 UTC (permalink / raw)
  To: isar-users



On 1/10/25 12:50, peter.czegledy via isar-users wrote:
> From: Peter Czegledy <peter.czegledy@evosoft.com>
> 
> Specifying the initrd location via WICs sourceparams initrd argument doesn't generate the initrd location properly.
> 
> This fixes that and furthermore cleans up some related redundant assignments to kernel variable as they do not impact the final value.
> 
> Signed-off-by: Peter Czegledy <peter.czegledy@evosoft.com>
> ---
>   .../lib/wic/plugins/source/bootimg-efi-isar.py   | 16 ++++------------
>   1 file changed, 4 insertions(+), 12 deletions(-)
> 
> diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> index 50f4187d..243824ae 100644
> --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> @@ -97,20 +97,18 @@ class BootimgEFIPlugin(SourcePlugin):
>               grubefi_conf += "timeout=%s\n" % bootloader.timeout
>               grubefi_conf += "menuentry '%s'{\n" % (title if title else "boot")
>   
> -            kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> -            if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
> -                if get_bitbake_var("INITRAMFS_IMAGE"):
> -                    kernel = "%s-%s.bin" % \
> -                        (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
> -

This is a recipe fork from open-embedded and we intentionally try to 
keep the changes a small as possible to allow merging.

Quirin

>               label = source_params.get('label')
>               label_conf = "root=%s" % creator.rootdev
>               if label:
>                   label_conf = "LABEL=%s" % label
>   
> +            temp_initrd = initrd
>               kernel, initrd = isar_get_filenames(
>                   get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
>               )
> +            if temp_initrd:
> +                initrd = temp_initrd
> +
>               grubefi_conf += "linux /%s %s rootwait %s\n" \
>                   % (kernel, label_conf, bootloader.append)
>   
> @@ -179,12 +177,6 @@ class BootimgEFIPlugin(SourcePlugin):
>   
>           if not custom_cfg:
>               # Create systemd-boot configuration using parameters from wks file
> -            kernel = get_bitbake_var("KERNEL_IMAGETYPE")
> -            if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
> -                if get_bitbake_var("INITRAMFS_IMAGE"):
> -                    kernel = "%s-%s.bin" % \
> -                        (get_bitbake_var("KERNEL_IMAGETYPE"), get_bitbake_var("INITRAMFS_LINK_NAME"))
> -
>               title = source_params.get('title')
>   
>               temp_initrd = initrd

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/44b4312c-82eb-499d-8f8f-fda34b4aa19b%40siemens.com.

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

* [PATCH v2] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd
  2025-01-10 16:05 ` 'Jan Kiszka' via isar-users
@ 2025-01-10 20:30   ` peter.czegledy via isar-users
  2025-01-21 13:57     ` Uladzimir Bely
  0 siblings, 1 reply; 6+ messages in thread
From: peter.czegledy via isar-users @ 2025-01-10 20:30 UTC (permalink / raw)
  To: isar-users; +Cc: Peter Czegledy

From: Peter Czegledy <peter.czegledy@evosoft.com>

Specifying the initrd location via WICs sourceparams initrd argument doesn't generate the initrd location properly in case of grub-efi loader.

This fixes that and unifies the custom initrd handling for grub-efi and systemd-boots.

Signed-off-by: Peter Czegledy <peter.czegledy@evosoft.com>
---
 .../lib/wic/plugins/source/bootimg-efi-isar.py       | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
index 50f4187d..78ae4fb2 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -108,9 +108,12 @@ class BootimgEFIPlugin(SourcePlugin):
             if label:
                 label_conf = "LABEL=%s" % label
 
-            kernel, initrd = isar_get_filenames(
+            kernel, default_initrd = isar_get_filenames(
                 get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
             )
+            if not initrd:
+                initrd = default_initrd
+
             grubefi_conf += "linux /%s %s rootwait %s\n" \
                 % (kernel, label_conf, bootloader.append)
 
@@ -187,12 +190,11 @@ class BootimgEFIPlugin(SourcePlugin):
 
             title = source_params.get('title')
 
-            temp_initrd = initrd
-            kernel, initrd = isar_get_filenames(
+            kernel, default_initrd = isar_get_filenames(
                 get_bitbake_var("IMAGE_ROOTFS"), get_bitbake_var("KERNEL_FILE")
             )
-            if temp_initrd:
-                initrd = temp_initrd
+            if not initrd:
+                initrd = default_initrd
 
             boot_conf = ""
             boot_conf += "title %s\n" % (title if title else "boot")
-- 
2.39.5

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250110203041.662979-1-peter.czegledy%40evosoft.com.

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

* Re: [PATCH] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd
  2025-01-10 16:42 ` [PATCH] " 'Quirin Gylstorff' via isar-users
@ 2025-01-13 16:16   ` 'Niedermayr, BENEDIKT' via isar-users
  0 siblings, 0 replies; 6+ messages in thread
From: 'Niedermayr, BENEDIKT' via isar-users @ 2025-01-13 16:16 UTC (permalink / raw)
  To: quirin.gylstorff, isar-users

On 10.01.25 17:42, 'Quirin Gylstorff' via isar-users wrote:
>
>
> On 1/10/25 12:50, peter.czegledy via isar-users wrote:
>> From: Peter Czegledy <peter.czegledy@evosoft.com>
>>
>> Specifying the initrd location via WICs sourceparams initrd argument 
>> doesn't generate the initrd location properly.
>>
>> This fixes that and furthermore cleans up some related redundant 
>> assignments to kernel variable as they do not impact the final value.
>>
>> Signed-off-by: Peter Czegledy <peter.czegledy@evosoft.com>
>> ---
>>   .../lib/wic/plugins/source/bootimg-efi-isar.py   | 16 ++++------------
>>   1 file changed, 4 insertions(+), 12 deletions(-)
>>
>> diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py 
>> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
>> index 50f4187d..243824ae 100644
>> --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
>> +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
>> @@ -97,20 +97,18 @@ class BootimgEFIPlugin(SourcePlugin):
>>               grubefi_conf += "timeout=%s\n" % bootloader.timeout
>>               grubefi_conf += "menuentry '%s'{\n" % (title if title 
>> else "boot")
>>   -            kernel = get_bitbake_var("KERNEL_IMAGETYPE")
>> -            if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
>> -                if get_bitbake_var("INITRAMFS_IMAGE"):
>> -                    kernel = "%s-%s.bin" % \
>> -                        (get_bitbake_var("KERNEL_IMAGETYPE"), 
>> get_bitbake_var("INITRAMFS_LINK_NAME"))
>> -
>
> This is a recipe fork from open-embedded and we intentionally try to 
> keep the changes a small as possible to allow merging.
>
> Quirin

I think this would be worth a comment section? I also missed the fact 
that this is a OE fork.

Benedikt


>
>>               label = source_params.get('label')
>>               label_conf = "root=%s" % creator.rootdev
>>               if label:
>>                   label_conf = "LABEL=%s" % label
>>   +            temp_initrd = initrd
>>               kernel, initrd = isar_get_filenames(
>>                   get_bitbake_var("IMAGE_ROOTFS"), 
>> get_bitbake_var("KERNEL_FILE")
>>               )
>> +            if temp_initrd:
>> +                initrd = temp_initrd
>> +
>>               grubefi_conf += "linux /%s %s rootwait %s\n" \
>>                   % (kernel, label_conf, bootloader.append)
>>   @@ -179,12 +177,6 @@ class BootimgEFIPlugin(SourcePlugin):
>>             if not custom_cfg:
>>               # Create systemd-boot configuration using parameters 
>> from wks file
>> -            kernel = get_bitbake_var("KERNEL_IMAGETYPE")
>> -            if get_bitbake_var("INITRAMFS_IMAGE_BUNDLE") == "1":
>> -                if get_bitbake_var("INITRAMFS_IMAGE"):
>> -                    kernel = "%s-%s.bin" % \
>> -                        (get_bitbake_var("KERNEL_IMAGETYPE"), 
>> get_bitbake_var("INITRAMFS_LINK_NAME"))
>> -
>>               title = source_params.get('title')
>>                 temp_initrd = initrd
>

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/e40ef9c9-c44d-448c-8672-da97da8da8d0%40siemens.com.

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

* Re: [PATCH v2] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd
  2025-01-10 20:30   ` [PATCH v2] " peter.czegledy via isar-users
@ 2025-01-21 13:57     ` Uladzimir Bely
  0 siblings, 0 replies; 6+ messages in thread
From: Uladzimir Bely @ 2025-01-21 13:57 UTC (permalink / raw)
  To: peter.czegledy, isar-users

On Fri, 2025-01-10 at 21:30 +0100, peter.czegledy via isar-users wrote:
> From: Peter Czegledy <peter.czegledy@evosoft.com>
> 
> Specifying the initrd location via WICs sourceparams initrd argument
> doesn't generate the initrd location properly in case of grub-efi
> loader.
> 
> This fixes that and unifies the custom initrd handling for grub-efi
> and systemd-boots.
> 
> Signed-off-by: Peter Czegledy <peter.czegledy@evosoft.com>
> ---
>  .../lib/wic/plugins/source/bootimg-efi-isar.py       | 12 +++++++---
> --
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> index 50f4187d..78ae4fb2 100644
> --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> @@ -108,9 +108,12 @@ class BootimgEFIPlugin(SourcePlugin):
>              if label:
>                  label_conf = "LABEL=%s" % label
>  
> -            kernel, initrd = isar_get_filenames(
> +            kernel, default_initrd = isar_get_filenames(
>                  get_bitbake_var("IMAGE_ROOTFS"),
> get_bitbake_var("KERNEL_FILE")
>              )
> +            if not initrd:
> +                initrd = default_initrd
> +
>              grubefi_conf += "linux /%s %s rootwait %s\n" \
>                  % (kernel, label_conf, bootloader.append)
>  
> @@ -187,12 +190,11 @@ class BootimgEFIPlugin(SourcePlugin):
>  
>              title = source_params.get('title')
>  
> -            temp_initrd = initrd
> -            kernel, initrd = isar_get_filenames(
> +            kernel, default_initrd = isar_get_filenames(
>                  get_bitbake_var("IMAGE_ROOTFS"),
> get_bitbake_var("KERNEL_FILE")
>              )
> -            if temp_initrd:
> -                initrd = temp_initrd
> +            if not initrd:
> +                initrd = default_initrd
>  
>              boot_conf = ""
>              boot_conf += "title %s\n" % (title if title else "boot")
> -- 
> 2.39.5
> 

Applied to next, thanks.

-- 
Best regards,
Uladzimir.



-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/ecbf388ca0bf8a62a0b16577a519ed368979f091.camel%40ilbers.de.

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

end of thread, other threads:[~2025-01-21 13:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-10 11:50 [PATCH] wic: bootimg-efi-isar: fix generating of grub.cfg for custom initrd peter.czegledy via isar-users
2025-01-10 16:05 ` 'Jan Kiszka' via isar-users
2025-01-10 20:30   ` [PATCH v2] " peter.czegledy via isar-users
2025-01-21 13:57     ` Uladzimir Bely
2025-01-10 16:42 ` [PATCH] " 'Quirin Gylstorff' via isar-users
2025-01-13 16:16   ` 'Niedermayr, BENEDIKT' via isar-users

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