wic: Add support for variable sector size when creating ESP
PATCH v2 1/1 wic: Add support for variable sector size when creating ESP
Derive sector_size from the WIC_SECTOR_SIZE BitBake variable. Recalculate blocks to align with the chosen sector size. While the default sector size of mkdosfs is 512 bytes, pass -S <sector_size> to align the setting of WIC_SECTOR_SIZE.
--- scripts/lib/wic/plugins/source/bootimg_efi.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
Changes for v2:
- drop --sector-size, use get_bitbake_var("WIC_SECTOR_SIZE") instead.
- drop value filter of sector-size.
- drop creating new sub-varible for 'part'.
scripts/lib/wic/plugins/source/bootimg_efi.py +9 -2
@@ -415,8 +415,15 @@ class BootimgEFIPlugin(SourcePlugin): label = part.label if part.label else "ESP" - dosfs_cmd = "mkdosfs -v -n %s -i %s -C %s %d" % \ - (label, part.fsuuid, bootimg, blocks) + # Support variable sector size + sector_size = int(get_bitbake_var("WIC_SECTOR_SIZE")) + + size_bytes = blocks * 1024 + blocks = size_bytes // sector_size + + dosfs_cmd = "mkdosfs -n %s -i %s -C %s %d -S %d" % \ + (label, part.fsuuid, bootimg, blocks, sector_size) + exec_native_cmd(dosfs_cmd, native_sysroot) logger.debug("mkdosfs:\n%s" % (str(out)))
Signature · 1 line
2.45.2
Quoted 7 lines · Macpaul Lin via lists.openembedded.org
Derive
sector_sizefrom theWIC_SECTOR_SIZEBitBake variable. Recalculate blocks to align with the chosen sector size. While the default sector size of mkdosfs is 512 bytes, pass -S <sector_size> to align the setting ofWIC_SECTOR_SIZE.Signed-off-by Macpaul Lin <[email protected]>---
Hi,
Thanks for your patch.
It looks like this is breaking some builds, as WIC_SECTOR_SIZE might not be defined.
ERROR: core-image-minimal-1.0-r0 do_image_wic: Execution of '/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/core-image-minimal/1.0/temp/run.do_image_wic.1122779' failed with exit code 1
...
| File "/srv/pokybuild/yocto-worker/genericx86-64/build/scripts/lib/wic/partition.py", line 199, in prepare
| plugin.do_prepare_partition(self, srcparams_dict, creator,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| cr_workdir, oe_builddir, bootimg_dir,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| kernel_dir, rootfs_dir, native_sysroot)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/srv/pokybuild/yocto-worker/genericx86-64/build/scripts/lib/wic/plugins/source/bootimg_efi.py", line 419, in do_prepare_partition
| sector_size = int(get_bitbake_var("WIC_SECTOR_SIZE"))
| TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'https://autobuilder.yoctoproject.org/valkyrie/#/builders/4/builds/2367
Can you fix this error, please?
Thanks,
Mathieu
Signature · 3 lines
Mathieu Dubois-Briand, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 43 lines · Mathieu Dubois-Briand
Quoted 7 lines · Macpaul Lin via lists.openembedded.org
Derive
sector_sizefrom theWIC_SECTOR_SIZEBitBake variable. Recalculate blocks to align with the chosen sector size. While the default sector size of mkdosfs is 512 bytes, pass -S <sector_size> to align the setting ofWIC_SECTOR_SIZE.Signed-off-by Macpaul Lin <[email protected]>---
Hi,
Thanks for your patch.
It looks like this is breaking some builds, as
WIC_SECTOR_SIZEmight not
be defined.ERROR: core-image-minimal-1.0-r0
do_image_wic: Execution of '/srv/pokybuild/yocto-worker/genericx86-64/build/build/tmp/work/genericx86_64-poky-linux/core-image- minimal/1.0/temp/run.do_image_wic.1122779' failed with exit code 1
...Quoted 10 lines
File "
/srv/pokybuild/yocto-worker/genericx86-64/build/scripts/lib/wic/partition.py", line 199, in prepare plugin.do_prepare_partition(self,srcparams_dict, creator, ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^cr_workdir,oe_builddir,bootimg_dir,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kernel_dir,rootfs_dir,native_sysroot)Quoted 8 lines
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/genericx86-64/build/scripts/lib/wic/plugins/source/bootimg_efi.py", line 419, indo_prepare_partition
sector_size= int(get_bitbake_var("WIC_SECTOR_SIZE"))
TypeError:int()argument must be a string, a bytes-like object or a real number, not 'NoneType'
Quoted 7 lines
Can you fix this error, please?
Thanks,
Mathieu
Oh my god. I have only ARM environment to test.
I've checked scripts/lib/wic/engine.py
The check seems only to assign sector_size is None or the other value. Not sure if this would help for x86 platforms.
Will include the check logic in v3.
Quoted 3 lines
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
Thanks
Macpaul Lin