New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: config: image: add redesigned options for squashfs compression #11328
base: main
Are you sure you want to change the base?
Conversation
every single tool you add should be a separate commit also the tools should not be always enabled by default, but rather use the config you are adding to select them |
I will split commits as suggested, and I should have done so in the first place. However
|
I would just focus on the ones you're adding |
If anything is truly dependent, then its deps should be wired up in the I have already stripped them and things still generally work, but I have not tested with a fully clean/virgin tree (maybe the pre-existing tools are already previously installed and leftover in my |
careful with that concept things can still "work" but that's not always the point, some tools are meant to be just "our copy" of whatever it is, and on many build systems you can install the same thing on the host machine, but that version of the tool differs between build systems. one of the purposes of the |
Could you provide some sizes for the different compression standards please. Maybe we should switch the default from XZ to zstd. The compression ratio in zstd can be configured. |
72a4c34
to
2e5a749
Compare
Yes, I collected stats from various build (all the same rootfs content)
And, I collected live performance stats for some of the same builds (linksys EA7300v1 / ramips-mt7261):
ZSTD is indeed the winner overall (slightly larger than XZ but way faster and less CPU load), but LZ4 can be really fast and lowest CPU load, if you don't care as much about space. LZMA1 support should also be fully dropped, and |
Also, force-pushed my current work, unclassified work in progress lumped in |
2e5a749
to
1f13243
Compare
There is work ongoing in #10967 to switch back to squashfs-tools. |
1f13243
to
45244b0
Compare
Rebased to current Verified it now builds from a clean kernel tree, and the lz4hc compressor kmod exists and gets loaded. Currently reorganizing the menuconfig stuff since I don't like how it works yet (and it needs a setting for which of the enabled compression methods is actually used in the image, currently it just uses whichever the last-enabled one is). Also spent some time investigating the Should I set this to Draft and does that block the constant re-testing cycles (that probably will crash anyway until this is polished)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write commit descriptions for each commit, not just titlte and SoB (just in case you were not planning to still do that).
Apart from that and changes to tools/Makefile
being in the wrong commit it already looks very nice up to this point.
Thank you for working on this and contributing!
45244b0
to
693d822
Compare
improved commit descriptions, picked most of those oneliner cherries into the appropriate atomic commits; thank you for the tips/pointers/direction the remaining lines have to be added to the matching commits without the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this single commit c9d2056 is complete and could be merged, can that occur from here or should I make a totally separate branch and PR for it atomically?
Made a separate PR#11358 for semi-unrelated, completely separable, and unused-here repair that seems to be unlikely to change in this PR.
This looks interesting. |
1bc9c56
to
f24db8d
Compare
Did a whole bunch of cleanup and commit-splitting, now it actually looks almost good, and much less noise with unrelated things split out to:
|
Any news regarding this? |
I'll fast forward it shortly. |
I forgot it's way worse than a fast-forward considering some other changes to squashfs4 since, which was why I backburnered it. Will take me longer, but at least I'm actually digging into it now. |
@Spudz76 hey could you please give this another go or if you can't, do you mind I look into rebasing (parts) of it? I'm specifically interested in ZSTD for x86 images, so this would come in handy! Thanks for your work! |
910d5de
to
4d54718
Compare
@aparcar Finally got around to this. Still crashes on completely unrelated/untouched things in the tests for whatever mysterious reason. But still "Works For Me" (tm) |
4d54718
to
4a2d2f9
Compare
Still very confused as to why two platforms crash on: Or even how to debug that. |
works well. tried both lz4 and zstd on ipq60xx and ipq40xx, theres a bit of faster bootup benefit on my ipq40xx. good job. EDIT:
and on ipq60xx (SNAPSHOT / 6.1)
but it seems theres no issue so its like 🤷 does not happen at all on xz and lz4
|
Yeah I get those errors (also zstd) and I thought it was just "normal" / unrelated to this patch. Admittedly I haven't run a vanilla build in quite some time to see what errors are just regular complaints and which are new. As you note, everything works fine so I wasn't concerned and decided it was all "informational warnings" or "expected failures" that have workarounds or Plan-B's (or everything works anyway). Similarly I assumed these are "normal":
But could be from other patches I have in my "hax" tree that I build from. I shall try a vanilla build from |
4a2d2f9
to
9c8e450
Compare
@backslashxx Added kernel patches that eliminate the ubifs "bad magic" spew when the magic is squashfs so that it falls through quietly (unless the magic is actually wrong and not squashfs). |
e9a4efe
to
33604a4
Compare
Works as expected. Thanks. You sending that upstream? |
It appears the entire The offensive code comes from I am not sure why that's in IMO there should be a Also considering some investigation toward a similar PR as this one based on UBIFS since it supports most of the same compression methods including zstd, and might be superior to squashfs anyway although that is unclear (when the rootfs is read-only anyway). I do think squashfs is still better since the block size can be set quite large which generally improves compression ratios, and it would seem at initial glance that ubifs only works in LEB sizes (128K on my devices NAND flash) although that may be different in read-only mode (since eraseblocks are irrelevant when updates are not allowed anyway). I have been using 1MB with zstd and according to my previous testing that saves 450917 bytes or 3.44 LEBs, that can then be used by the writable overlay ubifs. There are some patches floating around on squashfs upstream for even larger compression blocksizes that have potential to save even more. EDIT: okay ubifs compression is even worse than LEB-size... it uses 4KB no matter what. So it is likely not worth pursuing for the read-only rootfs at all
|
33604a4
to
26a1b94
Compare
Tested UBIFS on my platform, the rootfs was enormous compared to squashfs even with zstd enabled, so that's why almost nothing uses it unless it absolutely must (and most seem to only make a ubifs partition containing the kernel to satisfy the minimums of the bootloader, and then pivot to squashfs from there). Anyway I implemented the Might split this PR into completely separate ones since now some of the commits could probably stand alone, and apparently the squashfs4 tarball situation will never be fixed so this will never pass checks (still sure it's not my fault - maybe doing so many parallel builds hits some connection/spam limit for git clones against github?). |
enable all compressors, set `COMP_DEFAULT` to zstd, configuration can easily override the default where zstd is not preferable add PREFIX support to upstream Makefile via patch define `Host/Uninstall` Makefile target, use default build args rather than overriding `Host/Compile` and `Host/Install` targets Signed-off-by: Tony Butler <spudz76@gmail.com>
add options within images for selecting squashfs compression type using all possibilities provided in tools/squashfs4 and the kernel (gzip, lz4, lzo, xz, zstd) Also attempt to select the best default based on `SMALL_FLASH` and `LOW_MEMORY_FOOTPRINT` leaning toward zstd for most platforms If any compressors are disabled in the kernel config, those will not be available and will not be selected. Signed-off-by: Tony Butler <spudz76@gmail.com>
26a1b94
to
7b3f835
Compare
I have split the UBIFS related stuff into a different PR here since these work separately. Building from just this PR will reintroduce the boot-spew, apply the other patches on top of (or before) this to achieve the quiet operation again. |
This is an attempt at making SquashFS compression fully selectable, and enables all the initramfs compression options (previously selectable, but broken). I wanted to try LZ4 since it might boot a few seconds faster and my device has no shortage of flash space, but nobody wired up the options, and the host-build of
mksquashfs4
was missing several compressors for no real reason (space not an issue on the compilation host).tools/liblz4
,tools/liblzo
,tools/lzop
for the host toolchain, settools/squashfskit4
to use them all (and already existing zstd)This is all untested past building and inspecting output on the compile-host ; awaiting serial cable before I can test it on real hardware for actually-boots status
Did not set myself as maintainer for the new tools packages since they are roughly based on the target packages of similar names. Also did not copy maintainer from those sources, but IMHO it should just be the same maintainer.