How to compile the driver

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.