How to compile the driver in Linux

Source: Internet
Author: User

Driver source file name:/work/driver/test. c

Driver target file name: Test. Ko

Kernel source code Directory:/work/linux2.6.30This directory is the root directory of the board source code.

Step 1: Enter make oldconfig & make prepare & make scripts in the kernel source code (/work/linux2.6.30 ).

Part 2: There are two compilation methods

(1) In the/work/driver/directory # Make-C/work/linux2.6.30 M = $ PWD modules

(2) Write a makefile file in the/work/driver/directory and enter the make command

obj-m :=test.oKDIR :=/work/linux2.6.30all :        make -C $(KDIR) M=$(shell pwd) modulesclean:        make -C $(KDIR) M=$(shell pwd) clean

[Statement] due to my limited level, if the description of the article is incorrect, please correct me. E-mail: embed001@gmail.com QQ technology exchange group: 179012822 reprint please indicate the source of http://blog.csdn.net/embedded_hunter

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.