Small white Linux character driver

Source: Internet
Author: User

about how to compile a test-type character driver, online a search or a lot of here give a good tutorial http://blog.chinaunix.net/uid-11829250-id-337300.html

I was mainly in the search for the IOCTL when I wrote a character-driven idea, because just when the work of a colleague in the use of the IOCTL, at that time in the online search under the IOCTL also did not understand how. The original IOCTL is now found to be the IOCTL function in the corresponding device driver. Well, that's not a lot of crap. The main significance of writing this document is to give the drivers later to write a hint of some of the problems that may be encountered, hoping to be helpful to everyone, after the car's teacher.

Question 1: Follow the above tutorial code is finished, compile the hint header file can not find, what ghost!

Answer:

At first I thought it was the header file contains the path is wrong, so the modification to the absolute path seems to have not resolved.

to view the gcc/g++ default include path: ' Gcc-print-prog-name=cc1plus '-v

later found that the original compiler driver is best to refer to the other driver module makefile files, copied over to fix this problem.

Issue 2: Modified according to 1 of the answer, but do make the prompt error, the reason is that there is no rule to generate makefile

Answer:

Just started thinking must be in the Linux source code in the Drivers folder to write, thought this is too impersonal, and later found that the original driver corresponding to the Makefile file name must be "Makefile", modify the next name can be compiled through.


Finally, I would like to highlight the last paragraph of the tutorial author's description of makefile: The makefile I wrote was called two times, the first time I called the Else branch, I found the makefile file in the linux/directory and executed the modules rule, The. o file is generated during this process. Because the M option is specified, Midway returns the path specified by M to find and execute the IF branch in makefile. That is , two times into your own makefile file .

Small white Linux character driver

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.