The popularity of Microsoft Windows 7 won't squeeze out Linux, Which is unquestionable. If you are a Linux user, you want to learn more. If you encounter Linux driver development problems, here we will introduce the necessary steps for Linux driver development and share them with you.
1. Learn to write simple makefile
2. Compile an application and run it with makefile.
3. Learn to write the driver makefile
4. Write a simple char driver. The makefile is compiled and can be insmod, lsmod, or rmmod. Print hello world in the init function of the driver. After insmod, you should be able to see the output through dmesg.
5. write a complete driver, and implement various functions such as read, write, ioctl, and polling. In ioctl, the structure is transferred from the user space to the kernel space.
6. write a block driver, and implement various functions such as read, write, ioctl, and poll.
7. It is the most difficult to learn about memory management and understand the implementation details of various memory alloc functions. This is a basic skill in Linux development.
8. The application of the learning lock mechanism is not the most difficult but error-prone, and involves many synchronization and concurrency problems.
9. view 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 I did not know before. At this time, we need to consider many other problems, not just the implementation of basic functions.
We recommend that you refer to one of the integrated kvm drivers in 2.6.20. Remember that it is very interesting in driver/lguest, that is, the virtual machine driver in Linux. The code is not long, but the function is powerful. If you have the ability, you can write an operating system to make a disk image as required and load it into a virtual machine. Then, the client can have its own 4G virtual address space.
10. After reading the driver, welcome to the Linux kernel learning.
In this way, you can easily complete the Linux driver development steps.
- Linux vs uCLinux
- Yuan Meng explained "little Linux" to you"
- Abandon the Linux operating system and select Microsoft?
- Better online shopping for Linux Online Banking
- Linux open-source projects are brilliant