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?

André Chalella
  • 13,788
  • 10
  • 54
  • 62
Sriram Chowdary
  • 119
  • 1
  • 2
  • 6

2 Answers2

9

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.

Eirik Fuller
  • 1,454
  • 11
  • 9
9

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)

BotOfWar
  • 588
  • 5
  • 14
André Chalella
  • 13,788
  • 10
  • 54
  • 62
  • 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 Feb 25 '20 at 09:16
  • The build of squashfs-tools failed :/ – VBW Feb 25 '20 at 09:24
  • For me version of sources from SourceForge doesn't compile anymore, has compile errors. But version from [GitHub here](https://github.com/plougher/squashfs-tools) compiled successfully with same steps. – Arty Nov 29 '20 at 04:37
  • @ArraysStartAt1 please see https://stackoverflow.com/a/33203075/4850 to understand why the package names are correct the way I wrote them – André Chalella Dec 02 '20 at 04:47
  • You will also need to install the 'make' package from cygwin for this to work. – Mr. T Apr 16 '21 at 02:25