First published in: http://www.top-e.org/jiaoshi/html? 125. html
1. First of all, you need to be familiar with C language programming, which is the basic condition for programming in Linux.
2. Write a simple makefile, write a simple application, and write a makefile so that it can be compiled properly. Makefile is mainly used to manage and compile large code files.
3. Understand the directory structure of the Linux kernel, especially the driver directory structure under the kernel directory. Here, drivers in the kernel are generally stored.
4. Learn how to configure and compile the Linux kernel.
5. Write a simple char driver. The makefile is compiled and can be insmod, lsmod, or rmmod. Add a print string to the driver's init function. After insmod, you can see the output through dmesg.
6. Write a complete char driver, and implement the driver of various operation functions such as read, write, and IOCTL. In ioctl, the structure is transferred from the user space to the kernel space.
7. Write a block drive, such as a disk drive. Add read, write, ioctl, Poll and other functions.
8. Learn how to implement the interrupt mechanism in Linux. This is a common technology used in writing drivers.
9. Learn about memory management and understand the implementation details of various memory alloc functions. This is one of the basic functions of Linux development.
10. Application of the learning lock mechanism, such as semaphores and spin locks. The lock is mainly used to solve many synchronization and concurrency problems.
11. You think you have mastered the above knowledge. Next, let's look at the driver code of the actual application in the kernel. You will find that the most basic thing you know is that the big frameworks are the same. It is nothing more than the implementation of functions such as read, write, and IOCTL, but it contains a lot of small implementation details that were previously unknown, such as the design logic and algorithm of the program. At this time, we need to consider many practical problems, not just the implementation of basic functions.
12. The last step is to keep learning and summarizing.
In short, you will actually improve your learning by following the above steps, but one more thing is the most important thing: you must have a consistent learning spirit and confidence in solving any problems.