Thursday, January 10, 2008

Titbits on Cygwin :)

The following are small tidbits of information that I can comeback to refer... and hopefully helpful to others too...

Cygwin:
Cygwin is an interesting tool for those who are familiar with linux and wants to do something similar in windows. It gives a bash shell in a windows system and permits compilation of most linux programs.

Well one interesting thing to keep in mind while installing cygwin is to remember that you need to choose the components that you may want to install. The default installation of cygwin does NOT install the gcc compilers and most of the libraries which might interest a developer.

The installation takes quite sometime as it downloads stuffs from internet. Maybe a wiser choice is to download it locally and then install it as the internet installation fails often.

waiting... waiting... for the downloading to finish. Probably I am downloading more stuffs that I really need...

Finally cygwin is installed with compiler on my PC!!!

My aim is to compile squashfs tools in windows so that I will have the utility available to make a squash fs image in windows AND Linux.

SquashFS:
The following are some leads on squashfs filesystem-
http://www.roseindia.net/linux/tutorial/linux-howto/SquashFS-HOWTO/creatingandusing.html

The source code for the tools can be found at the following link-
http://sourceforge.net/projects/squashfs

It compiles cleanly in Linux. I am trying to see whether its the same case with windows cygwin compilation too.

SquashFS tools Compilation on Cygwin:

In cygwin, squashFS tools does not compile cleanly. Its to be expected as the squashFS providers does not claim to support windows platform.

Compilation fails because it references system header files. Looking a bit closely in the code, it looks like the mksquashfs.c is trying to get the number of processors in the system.

My aim is to compile the code in a Windows PC with one processor. So thats it. #ifdef away the code thats trying to get the number of processors and #else to processors=1..

Summerising the changes required to compile squashFS(version3.1r2) in cygwin-
-Define linux macro in the Makefile to make the compilation work similar to linux
-#ifdef away a few calls done to get the number of processors and include files

Bingo it works!!! I have mksquashfs that work on windows. I am able to mount the squashFS image made in windows in the target Linux!!!!

If this tool is to be invoked without cygwin, we will have to copy the following cygwin DLLs to the same directory as the executable mksquashfs.exe is.
-cygwin1.dll
-cygz.dll

3 comments:

chnrxn said...

I've posted a patch against squashfs 3.4 at

http://www.el-co.hu/smf/index.php/topic,206.msg1809.html#msg1809

I've implemented the function to detect the number of processors by simply reading the NUMBER_OF_PROCESSORS environment variable.

Unknown said...
This comment has been removed by the author.
Unknown said...

squashfs tools for cygrin that works perfectly on squashfs 2.1 filesystem. also have an option for 2.0 filesystem

http://motohell.com/index.php?action=dlattach;topic=3848.0;attach=4083