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