Skip to content

Say when a data partition comes out smaller than declared - #386

Closed
anton-vinogradov wants to merge 1 commit into
bmorcelli:mainfrom
anton-vinogradov:say-when-the-filesystem-shrinks
Closed

Say when a data partition comes out smaller than declared#386
anton-vinogradov wants to merge 1 commit into
bmorcelli:mainfrom
anton-vinogradov:say-when-the-filesystem-shrinks

Conversation

@anton-vinogradov

Copy link
Copy Markdown
Contributor

An empty filesystem is given LAUNCHER_DEFAULT_SPIFFS_SIZE regardless of the size its manifest or partition table declared. That default is right, and this PR does not change it — as you pointed out on #377, most images on M5Burner are whole-flash dumps whose spiffs is empty and huge, and honouring those would hand out megabytes of nothing.

What it changes is that the shrink is currently silent. A firmware genuinely built around a larger filesystem is installed successfully, reports nothing unusual, and runs with a third of the space it was built for. The only way to discover it is to read your own partition table back afterwards, which is exactly how I found it:

                       installed          firmware's own table
font   (has payload)   2,293,760          2,293,760     ← honoured
spiffs (empty)           458,752          1,572,864     ← default, silently

So: one console line where the size is chosen, in all three paths that choose it (manifest, SD, web). Same allocation as before, just no longer a surprise.

Data partition 'spiffs': asked 1536 KB, allocating 448 KB (empty filesystem, using the default)

Built for m5stack-cardputer.

Separately, and not part of this PR: is there a way you would want a firmware to say "this filesystem is empty, but I need N bytes"? Right now size with copy_size = 0 is indistinguishable from a dump's leftovers, which is what forces the label exceptions you mentioned for font. If you have a shape in mind — a manifest flag, an install-time prompt, a size ceiling — I am happy to implement it. If you would rather keep the label list, that is a fine answer too and this PR stands on its own.

An empty filesystem gets LAUNCHER_DEFAULT_SPIFFS_SIZE whatever its manifest or
partition table asked for. That is the right default — most images on M5Burner
are whole-flash dumps whose spiffs is empty and enormous, and honouring those
would hand out megabytes of nothing. But a firmware genuinely built around a
larger filesystem gets shrunk in silence, and the only way to find out is to
read back your own partition table afterwards.

That is how I found it: installing a firmware that declares 1.5 MB of LittleFS
for user data, which arrived as 448 KB. The install reported success and there
was nothing anywhere to suggest the difference.

One line on the console at the point the size is chosen, in all three paths that
choose it. No decision changes; the same size is allocated as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants