DJGPP
The DJGPP toolkit is a port of several basic GNU utilities to MS-DOS, using the 32-bit DPMI system extender, created by DJ Delorie. It included versions of GCC, binutils, and EMACS. It also includes several DOS and Windows specific utilities.
While DJGPP has been widely used for OS development in the past, it's close connection to MS-DOS and compatibility problems with Windows XP have caused most Windows users to shift to Cygwin or MinGW. DJGPP must be considered obsolete by now.
ELF files
It is fairly simple to produce ELF files with DJGPP. What you will need is a good installation of DJGPP, you will need sed, bison, flex, bash, etc. You will also need to do it from a dosbox inside Windows95/98 etc so you can use long file names.
First, download the latest binutils. (I used binutils-2.9.1.tar.gz). You need the plain binutils, not the binutils for Linux, not the binutils for dos, etc, but the plain binutils from any GNU archive site.
Once you have downloaded binutils, if you have LESS than 64mb of memory, edit the properties of your dos box and manually enter 65535 into the box provided for EMS memory, XMS memory and DPMI memory (using the selectors in the box will not let you enter 65535 so it must be entered by hand).
use DJTARX to unpack the binutils into your root directory (its easier).
C: CD \ DJTARX \download\binutils-2.9.1.tar.gz
Once its unpacked you will have to make some very minor modifications to you DJGPP installation (nothing drastic!)
Enter into the DJGPP\bin directory and COPY flex.exe lex.exe, bash.exe to sh.exe and make a new directory in your root called \bin and copy sh.exe to \bin\sh.exe
C: CD \ COPY flex.exe lex.exe COPY bash.exe sh.exe MD \bin COPY \djgpp\bin\bash.exe \bin\sh.exe
The \bin directory must be on the SAME DRIVE as the one you unpacked binutils onto, which CAN be a different drive to what DJGPP is installed onto.
Now enter the binutils directory (cd binutils-2.9.1) and edit the "configure" script.
Near the top of the script are three lines that read
remove hard_link symbolic_link
alter these lines so they read
remove=rm hard_link=cp symbolic_link=cp
Save the modified configure script.
Execute the bash shell by typing bash, your prompt should change to "bash$ ".
Now you have to setup bash to work with djgpp, enter these commands.
export CC="c:/djgpp/bin/gcc.exe" export LD="c:/djgpp/bin/ld.exe" export BISON="c:/djgpp/bin/bison.exe" export YACC="c:/djgpp/bin/bison.exe -y"
Now you are ready to build your new set of ELF utils. First you have to run configure with some options.
You can choose what targets you want built into your new set of binutils, myself, I built in all targets, just in case I later need something other than elf (some a.out formats for BSD, etc!).
./configure --enable-targets=all --with-gnu-as --with-gnu-ld --with-stabs
After a very long process, if all goes well, you will find no errors, and will be back at the "bash$ " prompt ready to build your new utils.
Now... some more tinkering... the configure process is not 100%, you have to edit the "libtool" file that's in each directories, bfd/libtool, as/libtool, gprof/libtool, ld/libtool and opcodes/libtool. So exit from bash ("exit") and use an editor to open those files, and just re-save them (make no modifications, just save). This seems to fix the crlf/lf/cr unix/dos mechanisms that is a bit broken in libtool.
Re-enter bash and type make and it will build your new utils. If you have enabled all targets the resulting .exe files will be about 6 to 7mb EACH, so strip off the debugging info (strip --strip-all *.exe) and then use the DJP compressor on them and they should come out to about 600 to 900kb each.
Alternatively, if you did not want to build all targets you can run configure without the "--enable-targets=all" option and replace with "--target=i386-unknown-elf".
GCC itself does not output ELF/COFF/a.out files, GCC outputs assembler that gets passed to AS which assembles it to whatever output format is default.
See Also
Articles
External Links
- http://www.delorie.com/djgpp/ - DJGPP website