@@ -415,8 +415,19 @@ 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)
+ # define sector size, default is 512 for mkdosfs
+ sector_size_str = get_bitbake_var('WIC_SECTOR_SIZE')
+ if sector_size_str is not None and str(sector_size_str).isdigit():
+ sector_size = int(sector_size_str)
+ else:
+ sector_size = 512
+
+ size_bytes = blocks * 1024
+ blocks = (size_bytes + sector_size - 1) // sector_size
+
+ dosfs_cmd = "mkdosfs -v -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)))
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. Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com> --- scripts/lib/wic/plugins/source/bootimg_efi.py | 15 +++++++++++++-- 1 file changed, 13 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'. Changes for v3: - Add -v option back for mkdosfs. - Round up the value of blocks instead of round dwon.