wic: support passing extraargs for EFI partition creation

Message ID 20251217130253.947946-1-Richa.Bharti@siemens.com
State Superseded, archived
Headers show
Series wic: support passing extraargs for EFI partition creation | expand

Commit Message

Bharti, Richa Dec. 17, 2025, 1:02 p.m. UTC
Some EFI firmwares require FAT filesystems to use specific geometry or
sector parameters.

Add support for an `extraargs` source parameter to allow passing
additional mkdosfs options when creating the EFI System Partition (ESP).
If no extra arguments are provided, mkdosfs defaults to "-S 512",
preserving existing behaviour.

Signed-off-by: Richa Bharti <Richa.Bharti@siemens.com>
---
 meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Anton Mikanovich Dec. 18, 2025, 7:28 a.m. UTC | #1
Hello Richa,

17/12/2025 15:02, 'Richa Bharti' via isar-users wrote:
> Some EFI firmwares require FAT filesystems to use specific geometry or
> sector parameters.
>
> Add support for an `extraargs` source parameter to allow passing
> additional mkdosfs options when creating the EFI System Partition (ESP).
> If no extra arguments are provided, mkdosfs defaults to "-S 512",
> preserving existing behaviour.
>
> Signed-off-by: Richa Bharti <Richa.Bharti@siemens.com>
> ---
>   meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 6 ++++--
>   1 file changed, 4 insertions(+), 2 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 446398d0..6862a288 100644
> --- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> +++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
> @@ -506,8 +506,10 @@ class BootimgEFIPlugin(SourcePlugin):
>   
>           label = part.label if part.label else "ESP"
>   
> -        dosfs_cmd = "mkdosfs -n %s -i %s -C %s %d" % \
> -                    (label, part.fsuuid, bootimg, blocks)
> +        extraargs = source_params['extraargs'] or "-S 512"
This will fail with KeyError: 'extraargs' if no extraargs declared.
> +
> +        dosfs_cmd = "mkdosfs -n %s -i %s %s -C %s %d" % \
> +                    (label, part.fsuuid, extraargs, bootimg, blocks)
>           exec_native_cmd(dosfs_cmd, native_sysroot)
>   
>           mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)

Moreover, features like this should be covered by some target or have a 
test\
case in CI.

Patch

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 446398d0..6862a288 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -506,8 +506,10 @@  class BootimgEFIPlugin(SourcePlugin):
 
         label = part.label if part.label else "ESP"
 
-        dosfs_cmd = "mkdosfs -n %s -i %s -C %s %d" % \
-                    (label, part.fsuuid, bootimg, blocks)
+        extraargs = source_params['extraargs'] or "-S 512"
+
+        dosfs_cmd = "mkdosfs -n %s -i %s %s -C %s %d" % \
+                    (label, part.fsuuid, extraargs, bootimg, blocks)
         exec_native_cmd(dosfs_cmd, native_sysroot)
 
         mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (bootimg, hdddir)