[PATCH] wic: support passing extraargs for EFI partition creation

63 views
Skip to first unread message

Richa Bharti

unread,
Dec 17, 2025, 8:21:08 AM12/17/25
to isar-...@googlegroups.com, cedric.h...@siemens.com, srikanth....@siemens.com, Richa Bharti
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....@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"
+
+ 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)
--
2.39.5

Anton Mikanovich

unread,
Dec 18, 2025, 2:28:08 AM12/18/25
to isar-...@googlegroups.com, Richa Bharti
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....@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.

Richa Bharti

unread,
Dec 18, 2025, 3:22:32 AM12/18/25
to isar-...@googlegroups.com, ami...@ilbers.de, cedric.h...@siemens.com, srikanth....@siemens.com, Richa Bharti
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....@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.get('extraargs', "-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)
--
2.39.5

Message has been deleted

Bharti, Richa

unread,
Dec 18, 2025, 3:39:14 AM12/18/25
to isar-...@googlegroups.com, ami...@ilbers.de, Hombourger, Cedric, Krishnakar, Srikanth
Without Extraargs:
```
$ cat wic/generic-ufs-partitions.wks.in
part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot" --label efi --part-type EF00 --align 1024 --use-uuid --size 512M
part --use-uuid --source rootfs --fstype=${BSP_ROOTFS_TYPE} --label system --active --align 1024 --exclude-path boot --fixed-size ${UFS_PART_SYSTEM_SIZE}
bootloader --ptable gpt --timeout 0 --append "${BSP_KERNEL_CMDLINE}

$ file development-image-industrial-os-qcs615-adp-air.wic.p1
development-image-industrial-os-qcs615-adp-air.wic.p1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors/cluster 8, Media descriptor 0xf8, sectors/track 63, heads 32, sectors 1048572 (volumes > 32 MB), FAT (32 bit), sectors/FAT 1024, serial number 0xe9d3c0d4, label: "efi "
```
LOG:
```
DEBUG: ['mkdosfs', '-n', 'efi', '-i', '0x1C1D0579', '-S', '512', '-C', '/tmp/development-image-industrial-os-qcs615-adp-air.wic/tmp.wic.vlfgf_0b/boot.img', '524288']
DEBUG: exec_native_cmd: export PATH=//sbin://usr/sbin://usr/bin://usr/bin/None://bin:None:$PATH;mkdosfs -n efi -i 0x1C1D0579 -S 512 -C /tmp/development-image-industrial-os-qcs615-adp-air.wic/tmp.wic.vlfgf_0b/boot.img 524288
DEBUG: _exec_cmd: export PATH=//sbin://usr/sbin://usr/bin://usr/bin/None://bin:None:$PATH;mkdosfs -n efi -i 0x1C1D0579 -S 512 -C /tmp/development-image-industrial-os-qcs615-adp-air.wic/tmp.wic.vlfgf_0b/boot.img 524288
DEBUG: ['export', 'PATH=//sbin://usr/sbin://usr/bin://usr/bin/None://bin:None:$PATH;mkdosfs', '-n', 'efi', '-i', '0x1C1D0579', '-S', '512', '-C', '/tmp/development-image-industrial-os-qcs615-adp-air.wic/tmp.wic.vlfgf_0b/boot.img', '524288']
```

With Extraargs:

```
$ wic/generic-ufs-partitions.wks.in
part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot,extraargs=-F 32 -S 4096 -r 2048" --label efi --part-type EF00 --align 1024 --use-uuid --size 512M
part --use-uuid --source rootfs --fstype=${BSP_ROOTFS_TYPE} --label system --active --align 1024 --exclude-path boot --fixed-size ${UFS_PART_SYSTEM_SIZE}
bootloader --ptable gpt --timeout 0 --append "${BSP_KERNEL_CMDLINE}"

$ file development-image-industrial-os-qcs615-adp-air.wic.p1
development-image-industrial-os-qcs615-adp-air.wic.p1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", Bytes/sector 4096, Media descriptor 0xf8, sectors/track 32, heads 8, sectors 131072 (volumes > 32 MB), FAT (32 bit), sectors/FAT 128, serial number 0xbf8798d0, label: "efi "
```
LOG:
```
DEBUG: Added 469589 extra blocks to /boot to get to 524288 total blocks
DEBUG: ['mkdosfs', '-n', 'efi', '-i', '0xBF8798D0', '-F', '32', '-S', '4096', '-r', '2048', '-C', '/tmp/development-image-industrial-os-qcs615-adp-air.wic/tmp.wic.qd9it81v/boot.img', '524288']
DEBUG: exec_native_cmd: export PATH=//sbin://usr/sbin://usr/bin://usr/bin/None://bin:None:$PATH;mkdosfs -n efi -i 0xBF8798D0 -F 32 -S 4096 -r 2048 -C /tmp/development-image-industrial-os-qcs615-adp-air.wic/tmp.wic.qd9it81v/boot.img 524288
DEBUG: _exec_cmd: export PATH=//sbin://usr/sbin://usr/bin://usr/bin/None://bin:None:$PATH;mkdosfs -n efi -i 0xBF8798D0 -F 32 -S 4096 -r 2048 -C /tmp/development-image-industrial-os-qcs615-adp-air.wic/tmp.wic.qd9it81v/boot.img 524288
DEBUG: ['export', 'PATH=//sbin://usr/sbin://usr/bin://usr/bin/None://bin:None:$PATH;mkdosfs', '-n', 'efi', '-i', '0xBF8798D0', '-F', '32', '-S', '4096', '-r', '2048', '-C', '/tmp/development-image-industrial-os-qcs615-adp-air.wic/tmp.wic.qd9it81v/boot.img', '524288']
```

Anton Mikanovich

unread,
Dec 22, 2025, 2:24:30 AM12/22/25
to Richa Bharti, isar-...@googlegroups.com, cedric.h...@siemens.com, srikanth....@siemens.com, Baurzhan Ismagulov
18/12/2025 10:22, Richa Bharti 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....@siemens.com>
Hello Richa,

v2 passed CI, but this functionality still not covered by any target.
It makes this feature unmaintainable, we'll never notice it will become
broken.
Would you like to add some extraargs usage in any wks using fat?

Richa Bharti

unread,
Dec 23, 2025, 5:38:40 AM12/23/25
to isar-...@googlegroups.com, ami...@ilbers.de, cedric.h...@siemens.com, srikanth....@siemens.com, i...@ilbers.de, Richa Bharti
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....@siemens.com>
---
meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks | 2 +-
meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks b/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks
index e22dba2f..219c5d06 100644
--- a/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks
+++ b/meta-isar/scripts/lib/wic/canned-wks/sdimage-efi-btrfs.wks
@@ -2,7 +2,7 @@
# long-description: Creates a partitioned EFI disk image without any swap that
# the user can directly dd to boot media, where the last partition is btrfs.

-part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot" --ondisk sda --label efi --part-type EF00 --align 1024
+part /boot --source bootimg-efi-isar --sourceparams "loader=systemd-boot,extraargs=-s 8" --ondisk sda --label efi --part-type EF00 --align 1024

part / --source rootfs --ondisk sda --fstype btrfs --label platform --align 1024 --use-uuid --exclude-path boot/

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 fd4d6017..b0edb8f5 100644
--- a/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
+++ b/meta/scripts/lib/wic/plugins/source/bootimg-efi-isar.py
@@ -537,8 +537,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.get('extraargs', "-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)
--
2.30.2

RICHA BHARTI

unread,
Dec 23, 2025, 5:44:51 AM12/23/25
to isar-users
Added V3 for patch that will validate "extraargs" functionality with target "mc:qemuamd64-bullseye:isar-image-ci". I hope with this the feature will be trackable and any issue will be visible. Let me know if change in target is required.

Anton Mikanovich

unread,
Dec 23, 2025, 10:22:59 AM12/23/25
to isar-...@googlegroups.com, Richa Bharti
23/12/2025 12:44, RICHA BHARTI wrote:
> Added V3 for patch that will validate "extraargs" functionality with
> target "mc:qemuamd64-bullseye:isar-image-ci". I hope with this the
> feature will be trackable and any issue will be visible. Let me know
> if change in target is required.
Hello Richa,

Thanks, v3 looks good enough to be used.
It is already passed fast CI, full one is ongoing.

P.S. I will be on holidays from 24.12.25 to 04.01.26, so only urgent
fixes will
probably be merged to next on this period.

Anton Mikanovich

unread,
Jan 5, 2026, 4:55:36 AM (2 days ago) Jan 5
to Richa Bharti, isar-...@googlegroups.com, cedric.h...@siemens.com, srikanth....@siemens.com, i...@ilbers.de
Applied to next, thanks.
Reply all
Reply to author
Forward
0 new messages