Packages for DJGPP

I am using the following DJGPP package

You can get this C compiler at http://www.delorie.com/djgpp.

Patching DJGPP

In include/signal.h, add

#ifndef SIGCONT
#define SIGCONT	18	/* CG */
#endif
In include/mntent.h, add
#ifndef MOUNTED
#define	MOUNTED	"/etc/mtab"	/* CG */
#endif
#ifndef MNTOPT_RO
#define	MNTOPT_RO "ro"	/* CG */
#endif
In include/errno.h, add
#ifndef EOPNOTSUPP
#define EOPNOTSUPP 95	/* CGR */
#endif
#ifndef ENOTSUPP
#define ENOTSUPP        524     /* Operation is not supported  CGR */
#endif
#ifndef ENOTSUP
#define ENOTSUP         524     /* CGR */
#endif
#ifndef ECANCELED
#define ECANCELED       125     /* CGR */
#endif
#ifndef EILSEQ
#define EILSEQ		84	/* CGR */
#endif
In include/fcntl.h, add
#define O_LARGEFILE     0100000 /* CG */
Add the file include/stdint.h
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;
typedef char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef long long int int64_t;
Add in include/sys/types.h:
__DJ_loff_t             // CG
#undef __DJ_loff_t      // CG
#define __DJ_loff_t     // CG
Add in include/sys/djtypes.h:
#define __DJ_loff_t     typedef long long int loff_t;   // CG

How to compile E2FS Library

Get e2fsprogs-1.29.tgz at http://e2fsprogs.sourceforge.net or on TestDisk web page.

cd testdisk
tar xvf e2fsprogs-1.29.tgz

EXT2FS Patch

If e2fsprogs-1.29.tgz, in lib/e2p/iod.c, comment len = dep->d_reclen; We don't use this library, we only need the compilation doesn't block on this file.

Compilation

Under Dos or Win9x, run

bash
./configure --with-cc=gcc && make libs

How to compile ReiserFS Library

Get progsreiserfs-0.3.1-rc8.tar.gz at http://reiserfs.osdn.org.ua/

Installation

tar xzf progsreiserfs-*.tar.gz

Compilation

bash
./configure --disable-nls && make

How to compile ntfsprogs

Get ntfsprogs-1.8.0.tar.gz from http://linux-ntfs.sf.net/

Installation and patch

tar xzf ntfsprogs-1.8.0.tar.gz
cd ntfsprogs-1.8.0

You can patch the patch with patch < ../src/ntfsprogs.patch or manually.
Edit include/endians.h

#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
#ifdef HAVE_BYTE_SWAP_H
#include <byteswap.h>
#endif

Edit include/volume.h

#ifdef HAVE_SYS_MOUNT_H
#       include <sys/mount.h>
#endif
#ifdef HAVE_MNTENT_H
#       include <mntent.h>
#endif

/* Cygwin doesn't seem to have MS_RDONLY, so we define it here. */
#if !defined(MS_RDONLY)
typedef enum {
	MS_RDONLY = 1,
} MS_MOUNT;
#endif

Compilation

bash
export CC=gcc
./configure && make

How to compile TestDisk

Source code is included in the TestDisk download (along with a DOS executable and DPMI server program) from the CGSecurity Website's TestDisk Home page:
http://www.cgsecurity.org/testdisk.html.

To compile TestDisk, run cd src; make dos. If you need a small binary for binary distribution, run

strip testdisk.exe
djp -s testdisk.exe

TestDisk is a true 32-bit program (compiled under DJGPP), so a DPMI server program (cwsdpmi.exe) is included in the download which allows TestDisk to run under 16-bit DOS. If you want to work under real (16-bit) DOS, you'll need to have a DPMI server running; to do that, get: csdpmi*b.zip and simply place the executable (cwsdpmi.exe) in your bin directory (which must be in the PATH).


TestDisk home: http://www.cgsecurity.org/testdisk.html.
Christophe GRENIER grenier@cgsecurity.org