Skip to content
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

Squashfs #596

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Squashfs #596

wants to merge 15 commits into from

Conversation

tisoft
Copy link
Contributor

@tisoft tisoft commented Apr 3, 2022

Added support for the SquashFS filesystem.

Based on the SqashFS Superblock from @abitrolly from #308.

Sample application using this structure: https://github.com/tisoft/jsquashfs

Replaces #308

@tisoft
Copy link
Contributor Author

tisoft commented Apr 3, 2022

Not all inode types are implemented yet, but the most used basic_file, basic_directory and extended_fil) are implemented. The other types shouldn't be a big problem.

Export and xattrs tables are not yet implemented.

SquashFS uses compressed metadata blocks. To fully support the format, it is needed to uncompress those blocks and parse the resulting bytes. Currently a custom decompress function is used for this. This could probably be replaced with kaitai.compress functions.

Unfortunately it is possible for inodes in the inode table to span 2 metablocks. That is why currently a custom concat function is needed, that concatenates the uncompressed bytes from a list of metadata blocks.

This format is currently very memory intensive. The real SquashFS implementations use caching to only have those metablocks in memory, that are currently needed. I couldn't find a good solution for that in kaitai.

The custom compression function also allows to automatically pad the resulting byte array with 0x00. This is used for sparse files in SquashFS. It is only needed in data blocks, so it is not needed for parsing the metadata. It could be removed from the format and could be handled any the calling application. For now I included it, to have a "complete" format.

@tisoft tisoft mentioned this pull request Apr 3, 2022
tisoft and others added 2 commits April 20, 2022 20:40
fixed kaitai compiler warnings
added extended file support
fixed data block count calculation
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.

3 participants