Compile DOS - CGSecurity
Keywords: Compile DOS,Compilar DOS,Compilation sous DOS,DOS Kompilieren,TestDisk Compilation

# Compile DOS

### From CGSecurity

english version deutsche Version versión español version française

## Packages for DJGPP

I am using the following DJGPP package

- GNU Binutils 2.11.2 binaries for DJGPP
- bsh204d GNU Bash 2.04 binary for DJGPP
- bsn129b GNU bison 1.34 for DJGPP V2
- csdpmi5b CWSDPMI binary distribution (release 5)
- dif272b GNU Diffutils 2.7.2 for DJGPP V2
- djdev203 Development Kit and Runtime
- faq230b DJGPP FAQ List edition 2.30 for DJGPP v2.03
- fil40b GNU Fileutils 4.0 for DJGPP 2.x, release 3 (binaries)
- File(1) 3.34: binaries
- find41b GNU findutils 4.1 for DJGPP V2
- flx254b GNU Flex 2.5.4 binaries for DJGPP V2
- gcc304b.zip : GCC 3.0.4 C compiler binaries for DJGPP
- gdb500b GDB GNU Debugger version 5.0 binaries for DJGPP v2
- gpp302b.zip : GCC 3.0.2 C++ compiler binaries for DJGPP
- grep24b GNU grep 2.4 binaries for DJGPP V2
- gwk306b GNU Awk 3.0.6 for DJGPP v2
- libt143d.zip libtool
- m4-14b GNU M4 1.4 binaries for DJGPP v2
- mak3791b GNU Make 3.79.1 binaries for DJGPP V2
- mlp107b Executable File Packer for DJGPP V2
- objc302b.zip : GCC 3.0.2 Objective C compiler binaries for DJGPP
- pdcur24b.zip PDCurses 2.4 binary for DJGPP
- perl561b Perl 5.6.1b for DJGPP V2 (binary)
- sed3028b GNU sed 3.02.80 for DJGPP V2
- shl112b GNU sh-utils 1.12 for DJGPP V2
- tar112ab GNU tar 1.12a binaries for DJGPP V2
- txi40b GNU Texinfo 4.0 binaries for DJGPP V2
- txt20b GNU Textutils 2.0 binaries for DJGPP V2
- Which version 2.11 modified to work with DJGPP by David Cullen

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

I.e. if you have installed DJGPP in D:\gnu, add in your autoexec.bat,

    set DJGPP=D:\gnu\djgpp.env
    set PATH=D:\GNU\BIN;%PATH%

## Patching DJGPP

In `include/signal.h`, add

    #ifndef SIGCONT
    #define SIGCONT 18
    #endif

In `include/mntent.h`, add

    #ifndef MOUNTED
    #define MOUNTED "/etc/mtab"
    #endif
    #ifndef MNTOPT_RO
    #define MNTOPT_RO "ro"
    #endif

In `include/errno.h`, add

    #ifndef EMSGSIZE
    #define EMSGSIZE        90
    #endif
    #ifndef EOPNOTSUPP
    #define EOPNOTSUPP      95
    #endif
    #ifndef ENOTSUPP
    #define ENOTSUPP        524
    #endif
    #ifndef ENOTSUP
    #define ENOTSUP         524
    #endif
    #ifndef ECANCELED
    #define ECANCELED       125
    #endif
    #ifndef EILSEQ
    #define EILSEQ          84
    #endif
    #ifndef EOVERFLOW
    #define EOVERFLOW       600
    #endif

In `include/fcntl.h`, add

    #define O_LARGEFILE     0100000

In `sys/param.h`, add

    /* Some autoconf'd packages check for endianness.  When cross-building we
       can't run programs on the target.  Fortunately, autoconf supports the
       definition of byte order in sys/param.h (that's us!).
       The values here are the same as used in gdb/defs.h (are the more
       appropriate values?).  */
    #define BIG_ENDIAN      4321
    #define LITTLE_ENDIAN   1234
    /* All known dos systems are little endian.  */
    #define BYTE_ORDER      LITTLE_ENDIAN

Add the file `include/stdint.h`

    #ifndef _STDINT_H
    #define _STDINT_H       1
    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;
    typedef int                     intptr_t;
    #endif

`ln -s gpp.exe g++.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).

Back to TestDisk compilation

Category: Data Recovery

##### Data Recovery

- TestDisk
- PhotoRec
- download