5

I have to update some files in a squashfs image file. I found a tool in Linux but not in Windows.

Can anyone help?

2 Answers 2

12

7-Zip is capable of opening squashfs images and extracting their files. I tested this on 7-Zip version 15.14 [64-bit] on Windows 10 with a squashfs image which uses xz compression.

7-Zip does not appear to list squashfs among the archive formats when creating an archive, so you'll need to look elsewhere if you want to generate a squashfs image with modified files. The Wikipedia page for squashfs indicates that mksquashfs and unsquashfs have been ported to some versions of Windows (it also mentions 7-Zip).

André's answer suggests Cygwin as a way to compile and run commands from squashfs-tools. The Windows Subsystem for Linux provides another way to run mksquashfs and unsquashfs. On my Windows 10 system in which Ubuntu 14.04.4 is running via WSL, the following command installed squashfs-tools, after which mksquashfs and unsquashfs are available.

sudo apt install squashfs-tools

With either approach to using squashfs-tools (Cygwin or WSL), 7-Zip is unnecessary for updating files in a squashfs image.

1
10

Eirik's answer solved the "unzip" part. I'll give you the entire squashfs-tools in Windows, so you can both "unzip" (unsquashfs.exe) and "zip" (mksquashfs.exe).

  1. Get Cygwin if you don't have it.
  2. Install the following Cygwin packages:
    • If you're running 32-bit:
      • gcc-core
      • cygwin64-gcc-core
    • If you're running 64-bit:
      • gcc-core
      • cygwin32-gcc-core
    • xz
    • liblzma5 (not sure this is needed)
    • liblzma-devel
  3. Get the latest squashfs source.
  4. Uncomment the following lines in squashfs-tools/Makefile:
    • XZ_SUPPORT = 1
    • LZMA_XZ_SUPPORT = 1
  5. In a Cygwin console, go to the squashfs-tools directory and compile with:

copy-paste this

make EXTRA_CFLAGS="-Dlinux -DFNM_EXTMATCH='(1<<5)' -D'sigtimedwait(a,b,c)=sigwaitinfo(a,b)'"
  1. Install with good old make install

Now you have the squashfs tools in a Cygwin command line just like if it was Linux. As stated above, the tools are unsquashfs.exe and mksquashfs.exe.


Source and credits of this answer: http://domoticx.com/bestandssysteem-squashfs-tools-software/ (Dutch, I used Google Translate)

5
  • 1
    Should it not be cygwin64-gcc-core for 64 bit systems and vice versa? update: cygwin64-gcc-core does not seem to exist on apt-cyg
    – VBW
    Commented Feb 25, 2020 at 9:16
  • The build of squashfs-tools failed :/
    – VBW
    Commented Feb 25, 2020 at 9:24
  • For me version of sources from SourceForge doesn't compile anymore, has compile errors. But version from GitHub here compiled successfully with same steps.
    – Arty
    Commented Nov 29, 2020 at 4:37
  • @ArraysStartAt1 please see stackoverflow.com/a/33203075/4850 to understand why the package names are correct the way I wrote them Commented Dec 2, 2020 at 4:47
  • You will also need to install the 'make' package from cygwin for this to work.
    – Mr. T
    Commented Apr 16, 2021 at 2:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.