Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle squashfs in Windows

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

Can anyone help?

like image 706
Sriram Chowdary Avatar asked Apr 07 '16 13:04

Sriram Chowdary


2 Answers

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.

like image 141
Eirik Fuller Avatar answered Sep 22 '22 15:09

Eirik Fuller


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)

like image 33
André Chalella Avatar answered Sep 21 '22 15:09

André Chalella