Squashfs devs already made patches for adding qshs and shsq magic numbers support with LZMA. https://sourceforge.net/p/squashfs/patches/20/
It would be nice to apply them to 7-zip as well.
Do you think it's applicable?
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).
Thanks,
Ahmad
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Igor, I found a Squashfs archive which is not supported. I think the problem is that the big-endian encoding is not supported, because other archives with little-endian works.
Yeah that's the LZMA compressed squashfs image. But as i found out it's a very special format so I think you don't need to integrate it ;-)
After three hours I finally managed to unpack it with freetz-linux (screenshot 2).
Please kindly accept the following patch. I recently stumbled upon a (fairly standard) SquashFS 3.x LZMA image that was in Motorola byte order (big endian) and it worked like a charm.
Squashfs devs already made patches for adding
qshs
andshsq
magic numbers support with LZMA.https://sourceforge.net/p/squashfs/patches/20/
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:
http://downloads.linksys.com/downloads/firmware/WAG320N-EU-ANNEXA-ETSI-1.00.12,0.zip
I used the 'dd' command to copy the squashfs + lzma portion of the file:
http://www.mediafire.com/?jmp23zhr8rnt1j3
I applied the patch above, edited the
mksquashfs.c
file, line 5287, and replacedSQUASHFS_MAGIC
withSQUASHFS_MAGIC_LZMA_SWAP
and compiled it (I tried theSQUASHFS_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).
Thanks,
Ahmad
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.
Hello Igor, I found a Squashfs archive which is not supported. I think the problem is that the big-endian encoding is not supported, because other archives with little-endian works.
Hope you can look into that issue and perhaps implement a fix in the next version. Here is the fiel:
http://www12.zippyshare.com/v/17442991/file.html
there is no SquashFS signature.
Hmm strange. It's definitely a squashfs3 image with lzma compression...
Do you need something from me to help you?
Search in google:
Magic byte sequences (hex) to identify kernel, SquashFS and bootloader
KERNEL_MAGIC="8112EDFE"
SQUASHFS_MAGIC_LE="68737173"
SQUASHFS_MAGIC_BE="73717368"
BOOTLOADER_MAGIC_LE="00908040"
BOOTLOADER_MAGIC_BE="40809000"
So what is that KERNEL_MAGIC file?
There is lzma stream probably from offset 0x1C
But first 28 bytes is some header.
LOADER_MAGIC2
0x8112EDFE
Do you know the format of that header?
Yeah that's the LZMA compressed squashfs image. But as i found out it's a very special format so I think you don't need to integrate it ;-)
After three hours I finally managed to unpack it with freetz-linux (screenshot 2).
Please kindly accept the following patch. I recently stumbled upon a (fairly standard) SquashFS 3.x LZMA image that was in Motorola byte order (big endian) and it worked like a charm.
ok.
Thanks!