From: Trevor Woerner <twoerner@gmail.com>
To: macpaul.lin@mediatek.com
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Alexander Kanavin <alex@linutronix.de>,
Richard Purdie <richard.purdie@linuxfoundation.org>,
Otavio Salvador <otavio@ossystems.com.br>,
openembedded-core@lists.openembedded.org,
Bear Wang <bear.wang@mediatek.com>,
Pablo Sun <pablo.sun@mediatek.com>,
Ramax Lo <ramax.lo@mediatek.com>, Macpaul Lin <macpaul@gmail.com>,
MediaTek Chromebook Upstream
<Project_Global_Chrome_Upstream_Group@mediatek.com>
Subject: Re: [OE-core] [PATCH v3] wic: Add support for variable sector size when creating ESP
Date: Wed, 17 Sep 2025 10:46:04 -0400 [thread overview]
Message-ID: <20250917144604.GA11844@localhost> (raw)
In-Reply-To: <20250915064137.4025945-1-macpaul.lin@mediatek.com>
Hi,
Out of curiosity, are you in a situation where only one partition (your ESP
partition) is using UFS and the rest of your image is using the regular sector
size?
This patch is useful for you and if the oe maintainers are okay with it
there's no technical problem with it. But it is very narrow, it only provides
a variable sector size in the case of the ESP where someone is using the
bootimg_efi source plugin.
In my opinion, the whole variable sector size thing needs a comprehensive
overhaul, not just for specific use-cases at a time. But I understand you
probably need this to un-stick yourself so you can move on with your project
;-)
At work my team has a more comprehensive variable sector size solution that
allows us to build wic an wic.ufs images in parallel, but it assumes each
entire image is one sector size (wic=512, wic.ufs=4096), and it is against
scarthgap. If there are use-cases where different sector sizes are required
per partition within the same image, then the only logical place to support
that is with a partition option on individual lines of the wks file. E.g.:
part /efi --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 --sector-size 4096
part / --source rootfs --ondisk sda --fstype=ext4 --label platform --align 1024 --use-uuid
bootloader --ptable gpt --timeout=5 --append="rootfstype=ext4 console=ttyS0,115200 console=tty0"
On Mon 2025-09-15 @ 02:41:37 PM, Macpaul Lin via lists.openembedded.org wrote:
> 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.
>
> diff --git a/scripts/lib/wic/plugins/source/bootimg_efi.py b/scripts/lib/wic/plugins/source/bootimg_efi.py
> index cf16705a285a..288fe6a15a7d 100644
> --- a/scripts/lib/wic/plugins/source/bootimg_efi.py
> +++ b/scripts/lib/wic/plugins/source/bootimg_efi.py
> @@ -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)))
>
> --
> 2.45.2
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#223386): https://lists.openembedded.org/g/openembedded-core/message/223386
> Mute This Topic: https://lists.openembedded.org/mt/115249776/900817
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [twoerner@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
prev parent reply other threads:[~2025-09-17 14:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 6:41 [PATCH v3] wic: Add support for variable sector size when creating ESP Macpaul Lin
2025-09-17 14:46 ` Trevor Woerner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250917144604.GA11844@localhost \
--to=twoerner@gmail.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=alex@linutronix.de \
--cc=alexandre.belloni@bootlin.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=bear.wang@mediatek.com \
--cc=macpaul.lin@mediatek.com \
--cc=macpaul@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=otavio@ossystems.com.br \
--cc=pablo.sun@mediatek.com \
--cc=ramax.lo@mediatek.com \
--cc=richard.purdie@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox