Driver compilation is totally different from upper-layer application compilation. As a beginner, you should first understand how to write the driver, even if you do not know how to write the driver.
Install DDK first, and find an example to test it. Find the Build Environment menu in the menu for execution, and use different build environments for different systems. A DOS window will be opened. Then, CD will go to the example program and enter build-CZ and press Enter.
The driver is compiled by a tool called build.exe of ddk.exe. This program uses a file named sources as the input. The file contains the name, type, and path of the target executable file, Note that this file has no suffix.
SourcesFile Format:
Targetname = drivername,
- This parameter is used to specify the name of the generated Device Driver (without a suffix), the generated file
- Is drivername. sys.
Targetpath =./lib
- This parameter is used to specify the path where the generated device driver is stored. It generally uses./lib.
Targettype = driver
- Build can generate many different target objects. Driver is generally used for device drivers.
Required des = path1; path2 ;...
- This parameter is optional and is used to specify the search path for other # include files.
Targetlibs = lib1; lib2 ;...
- This parameter is optional and is used to specify the search path for other lib library files.
Sources = file1.c file2.c...
- This parameter is used to specify the names of all source files to be compiled. The extension names cannot be omitted, and names are separated by spaces.
The sources file is required. Without it, no source file needs to be compiled.
You can use'/'Symbol, indicating the continuation of the previous line.
You can also create a dirs file, which is used to specify the subdirectories that must be created under the current directory.
DirsFile Format:
The dirs file consists of a series of directory names separated by spaces.
Dirs =/
Subdir1/
Subdir2/
Subdir3
Dirs files are optional.
Sometimes, the system will prompt that the dependent files (. H,. Lib, and so on) cannot be found. In fact, the source file's
Includes and targetlibs can be used. I encountered this problem during the first compilation. It is quite different from the VC environment, but it is good to get used to it.