2. Development tools setup
2.1 Download and unzip the tools
a) The IBM (R) Developer Connection Device Driver Kit for OS/2 (DDK) can be downloaded for free from IBM (R). It includes all the necessary components to build drivers. Go to http://service.boulder.ibm.com/ddk/ and register for a free download.
b) Browse to the download page and get all the components and information you need. For the later discussed DRIVER1$ sample driver, it's enough to get the following parts as ZIP-files:
Microsoft (R) Assembler 6,0 (MASM) -> 2.7 Mbyte
Microsoft (R) C-Compiler 6.0 (MSC) -> 3.5 Mbyte
Input/Output DD - Build Environment -> 3.4 Mbyte
Input/Output DD - Build Tools -> 0.5 Mbyte
Physical Device Driver Reference -> 0.7 Mbyte
'Using your DDK' Build Instructions -> 0.1 Mbyte
Remember! OS/2 PDD's are 16:16 protected mode applications! Neither IBM (R) CSET/2 nor IBM (R) VACPP are able to generate 16 bit code! These are pure 32 bit compilers!
You may use another 16 bit Compiler like Watcom (R) C++ or something similar, but it's more work because the whole environment is set up for using MSC and MASM (some headers are also available for Watcom (R) C++).
c) Unzip all these files in the root directory of the drive you want. After this step you will notice two new directories x:\ddk and x:\ddktools.
2.2 Set up the environment and run the compiler
a) Create a source code directory to put your own driver code in (e.g. x:\ddk\mysource).
b) Create a CMD-file in this directory which sets the environment variables (e.g. x:\ddk\mysource\env.cmd) with the following lines:
set
ipfc=x:\ddk\base\tools;
set
path=x:\ddktools\toolkits\msc60\binp;x:\ddk\tools;x:\ddk\base\tools;%path%
set
include=x:\ddk\base\h;x:\ddk\base\inc;%include%'
set
lib=x:\ddktools\toolkits\msc60\lib;x:\ddk\base\lib;%lib%
c) Place your source files in this directory, start the ENV.CMD script and run NMAKE in this directory. That's all! ;-)
You can use the DRIVER1$ driver samples to get started. This includes the following files:
makefile
The
build rules are defined here.
driver1.c
The
drivers code and data.
driver1.def
The
drivers module definition file. Notice about the segment ordering!
startup.asm
The
startup code, which needs to be written in assembler, because of the
segment ordering rules.
After running NMAKE, the following files will be produced (with the sample makefile):
driver1.sys
The
driver itself (the executable), which needs to be loaded in the
CONFIG.SYS with the statement DEVICE=<path>\driver1.sys
driver1.cod
The
assembler output from the C-Compiler. Useful for debugging!
driver1.map
The
symbolics in ASCII format, produced by the linker. Useful for
debugging!
driver1.sym
The
symbolics in a form, the dump formatter and KDB (kernel debugger)
could use, produced by the utility MAPSYM. Useful for debugging!
driver1.obj
The
object file for the code in the C-file produced by the compiler and
used by the linker.
startup.lst
The
list file with addresses. Useful for debugging!
startup.obj
The
object file for the code in the ASM-file produced by the Assembler
and used by the linker.
Warpstock Europe 1999 |