Basic Steps for Linux driver development and learning

Source: Internet
Author: User

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.

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.