Concept
As part of the system kernel, the driver works in a nuclear mindset while the application works in a user state. In other words, the program cannot directly pass the pointer, the data address of the user space to the kernel Linux kernel to divide the driver into 3 types: Character device, block device and network device. Character devices and block devices can be accessed like files. The main difference is not in the ability to seek, but in the way the system manages the two types of devices. Every I/O operation of the application for the character device is passed directly to the driver of the system kernel, and the operation of the application for the block device is managed by the system buffer and passed to the driver processing indirectly. This management of block devices is optimized for storage, while character devices are managed in a way that optimizes operations. As for the network device, it is a kind of special device in Linux system, it is not accessed by the corresponding device file node like character device or block device, and the kernel no longer accesses network device through calls such as read and write. Linux network system is mainly based on the BSD UNIX socket mechanism, between the system and the driver has a special data structure to transmit data, the system supports the sending and receiving cache of data, provide flow control mechanism, provide more protocol support.
In Linux systems, drivers are made into modules, the module. Simply put, a module provides a feature that can be loaded into the kernel space and unloaded from the kernel space at any time as needed. Therefore, kernel modules are designed to give the kernel dynamic additions and deletions, and are not limited to drivers.
I learned some basic things through this chapter and felt like I was getting started.
Android system porting and driving development case Chapter I.