Le 30/03/26 à 18:21, Mark Hatle a écrit :
On 3/30/26 11:01 AM, Joshua Watt via lists.openembedded.org wrote:
On Sun, Mar 29, 2026 at 11:12 AM Charles-Antoine Couret via
lists.openembedded.org
<[email protected]> wrote:
What I can suggest is:
* IMAGE_ROOTFS_MAXSIZE would be used against filesystem sizes, and not
against precomputed rootfs sizes as done today, it's likely not really
relevant to keep current behavior as it. I don't know if we would be
able to customize the value per filesystem type as done in my proposal
or if a global setting is good enough.
* if IMAGE_ROOTFS_EXTRA_SPACE is set to 0 and IMAGE_OVERHEAD_FACTOR set
to 1.0, don't provide size parameter to mkfs to create a dynamic and
minimal filesystem, to avoid the need to always provide manually extra
margin just for filesystem overhead
* Then introduce a new variable like IMAGE_ROOTFS_FIXED_SIZE which can
be provided (if set) to mkfs tool to have a fixed partition size
whatever are the other settings related to rootfs size. If unset (by
default), previous logic can be used instead.
Perhaps a better option would be some sort of
"IMAGE_ROOTFS_ALLOW_GROW" variable that controls if an image can
actually grow beyond the IMAGE_ROOTFS_SIZE + overhead amount? The
current code basically takes the max of IMAGE_ROOTFS_SIZE & the actual
install size to determine the size, but this variable could supress
that to make it only look at IMAGE_ROOTFS_SIZE. It could also set
IMAGE_ROOTFS_MAXSIZE to the sum for additional checks?
This makes more sense to me.
Looking at the existing variables:
IMAGE_ROOTFS_SIZE - Defines the size in Kbytes for the generated image.
Really this is the minimum size, computed with actual filesystem needs.
IMAGE_OVERHEAD_FACTOR - Defines a multiplier that the build system
applies to the initial image size for cases when the multiplier times
the returned disk usage value for the image is greater than the sum
of and IMAGE_ROOTFS_EXTRA_SPACE.
IMAGE_ROOTFS_EXTRA_SPACE - Defines additional free disk space created
in the image in Kbytes. By default, this variable is set to '0'.
IMAGE_ROOTFS_MAXSIZE - (not in the documentation.conf but...) This
value is a QA check to ensure that the filesystem does not exceed a
specific size after factoring in filesystem size, extra space and
overhead factor.
(this should be added to the docs!)
Adding an additional boolean of "IMAGE_ROOTFS_ALLOW_GROW" would then
allow those variables to be used "as-is" without the automatic
growing. (I would assume existing behavior means ALLOW_GROW = 1 by
default.)
As far as I can tell, in this patch set that would mean:
IMAGE_ROOTFS_ALLOW_GROW = "0"
IMAGE_ROOTFS_SIZE = _the_ size of filesystem you want
IMAGE_ROOTFS_EXTRA_SPACE = "0"
IMAGE_OVERHEAD_FACTOR = "1"
Then a patch similar to:
def get_rootfs_size(d):
import subprocess, oe.utils
rootfs_alignment = int(d.getVar('IMAGE_ROOTFS_ALIGNMENT'))
overhead_factor = float(d.getVar('IMAGE_OVERHEAD_FACTOR'))
rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE'))
rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE'))
rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE')
rootfs_allow_grow = d.getVar('IMAGE_ROOTFS_ALLOW_GROW') or "1"
...
size_kb = oe.utils.directory_size(d.getVar("IMAGE_ROOTFS")) / 1024
if rootfs_allow_grow:
base_size = size_kb * overhead_factor
bb.debug(1, '%f = %d * %f' % (base_size, size_kb,
overhead_factor))
base_size2 = max(base_size, rootfs_req_size) + rootfs_extra_space
bb.debug(1, '%f = max(%f, %d)[%f] + %d' % (base_size2, base_size,
rootfs_req_size, max(base_size, rootfs_req_size),
rootfs_extra_space))
else:
base_size2 = rootfs_req_size + rootfs_extra_space
...
(Maybe allow_grow is a bad name for the boolean, since effectively we
want to affirmatively tell the system to ignore the actual files in
the filesystem.. So perhaps reversing the boolean to:
IMAGE_ROOTFS_USE_FILE_SIZES (not sure I like this name any better)
but the overall change is MUCH smaller and easier to fit in and QA
with the existing code (as well as document).
Hi,
I think we would go further because the naming and settings can be
confusing and the end result is likely not optimal.
As it today, to have the check of maximum rootfs size which works
properly in all cases, you need to set IMAGE_ROOTFS_SIZE
and IMAGE_ROOTFS_MAXSIZE to the same value (and IMAGE_OVERHEAD_FACTOR to
1, IMAGE_ROOTFS_EXTRA_SPACE is already set to 0 by default). From my
point of view, IMAGE_ROOTFS_SIZE would not be mandatory set to have a
working behaviour for this sanity check, its purpose is
different. IMAGE_ROOTFS_MAXSIZE value alone would be enough.
Then, the drawback of this approach is also that in any case your
filesystem will have this maximum size even when it's not required. I
know that my initial proposal has this issue as well but I think we can
have a way to avoid it but this needs a more complex change as I
suggested above. It would be better to check the file sizes after their
creation instead of having a check before to be able to have this
flexibility even if the change would be more important.
Regards,
Charles-Antoine Couret
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#234320):
https://lists.openembedded.org/g/openembedded-core/message/234320
Mute This Topic: https://lists.openembedded.org/mt/118563509/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-