Add Squashfs support for LZMA Magic Numbers

  • Ahmad Hazimeh
    Ahmad Hazimeh

    Squashfs devs already made patches for adding qshs and shsq magic numbers support with LZMA.
    It would be nice to apply them to 7-zip as well.
    Do you think it's applicable?

    Off topic: Could there be a way by which Squashfs can be modifiable as well? I'm having trouble rebuilding with mksquashfs, even when setting it to use the magic number the original file was compiled with.
    I'm trying to edit a file in a router firmware:,
    I used the 'dd' command to copy the squashfs + lzma portion of the file:

    I applied the patch above, edited the mksquashfs.c file, line 5287, and replaced SQUASHFS_MAGIC with SQUASHFS_MAGIC_LZMA_SWAP and compiled it (I tried the SQUASHFS_MAGIC_LZMA, but the output file was the exact opposite of what I expected).
    When I ran mksquashfs with the proper settings, it gave a file with the destined LZMA magic number, but its "structure", as revealed by binwalk, was totally different than that of the unmodified filesystem.

    Hence, if you could add squashfs read\write functionality, with magic number support, to 7-zip, such that it rebuilds the filesystem with the exact settings, you'd do us a great favor (since a majority of WAG320N owners suffer from its lack of customization).


  • Igor Pavlov
    Igor Pavlov

    I changed Squashfs code for new version already.
    If next alpha version of 7-zip will not support some Squashfs archives, please write here again.