First, the steps to write a Linux driver1. Build Linux Drive skeleton: that is, load and unload Linux drivers. In the Linux driver, you need to provide two functions to handle the operation of the driver initialization and exit separately. These two functions are specified by Module_init and module_exit macros, respectively.2, registration and destruction of equipment files: Any Linux driver requires a device file, because the devices in Linux exist a
itself. When using floating-point numbers in the kernel, there are other trivial things to do in addition to manually saving and recovering floating-point registers. If you want to answer bluntly, that is: Don't do this, except in some rare cases, do not use floating-point operations in the kernel.Unlike the user-space API, the API inside the kernel changes, and drivers written for this kernel version may not run in another version.Internal and devel
From one point of view, the role of a device driver is to provide a mechanism, not a policy. When writing drivers, programmers should pay particular attention to the following basic concept: When writing kernel code to access hardware, do not impose any specific policy on the user. Because different users have different needs, the driver should handle the problem of how to make the hardware available, and how to use the hardware problem left to the up
contiguous and the corresponding data block on disk is also adjacent, then the general block layer can be merged with them, this way to produce a larger memory area is the physical segment.Common block Layer:1. The common block layer is a kernel component that handles requests from all block devices in the systemI\O Scheduler:1. Block device drivers can transmit one sector at a time, but the block i\o layer does not do so because it is time-consuming
vm_area_struct *vma, unsigned long virt_addr, unsigned long phys_addr, unsigned long size, pgprot_t prot);
Vma
Virtual Memory Area
Virt_addr
The starting user virtual address when remapping
Pfn
The page frame number corresponding to the physical memory that the virtual memory will be mapped to
The page frame number simply shifts the physical address to the right page_shift bit
Introduction plan for linux Device Drivers-general Linux technology-Linux programming and kernel information. For details, see the following section. Ldd2, that is, linux device driver 2nd. This book helps you understand the implementation of most hardware work through the Linux OpenSource OS. It is suitable for C programmer which is not very clear about the underlying hardware mechanism and implementation.
Unfortunately, I have read only the chapter
The original Article from: http://skywalkersoftwaredevelopment.net/blog/a-closer-look-at-content-types-drivers-shapes-and-placement
In this article, we will look at the concepts that enable me to stay awake at night, because my life cannot find out the concepts related to: shapes, content types, parts, fields, drivers and placement. If you have some experience using orchard but still feel a little clumsy ab
1. Copy the fusion folder to the driver/Char directory of the kernel;
2. Configure driver/Char/makefile:
# Makefile for the kernel character device drivers.### This file contains the font map for the default (hardware) font#FONTMAPFILE = cp437.uniobj-y += mem.o random.o tty_io.o n_tty.o tty_ioctl.o tty_ldisc.o tty_buffer.o tty_port.oobj-$(CONFIG_FUSION_DEVICE) += fusion
3. Configure driver/Char/kconfig:
source "
ZZ: http://www.cnblogs.com/lzjsky/archive/2010/11/19/1881911.html
In different scenarios, many driver writers need to share the memory between the driver and the user program. The two easiest technologies are:
1. The application sends IOCTL to the driver and provides a pointer to the memory. Then the driver and application can share the memory. (Application allocates shared memory)2. The driver allocates memory pages, maps these memory pages to the address space of the specified user mode proces
Introduction: from 2.4 to 2.6, the Linux kernel has greatly changed in terms of the module mechanism, device model, and some core APIs that can be loaded, device driver developers are faced with porting drivers from 2.4 to 2.6 kernels, or enabling drivers to support both 2.4 and 2.6 kernels... news nbsp
Introduction: from 2.4 to 2.6, the Linux kernel has greatly changed in terms of the module mechanism, de
external representation in the Code, the Code does not need to be changed even if the internal data type changes again in the future.
Common macros are:
The official registry cannot statically allocate these additional available device numbers, which can only be used when handling special requirements for device numbers. In fact, for assigning device numbers and creating device files, it is more likely to process device files in a highly dynamic manner.
3.2 dynamically allocat
Document directory
A quick tour of the hardware
The various modules and their interrelations
How URBS keep it all together
Input Handling
Even though UNIX traditionally considers a device as either a "char device" or a "Block device" (as outlined by the 'C' or 'B' in their/DevEntry points), new classes of device are being introduced as technology advances. One of such classes is that of ''usb devices ''.
An USB device is still, at its lowest levels, a ''char devic'' or a ''block devic''
of the LCD controller.
Specifically:
Fill in a fbinfo Structure
Use reigster_framebuffer (fbinfo *) to register the fbinfo structure to the kernel
For the fbinfo structure, the most important thing is its fs_ops member. You need to implement interfaces in fs_ops for specific devices.
Whether to use interrupt handling
Memory Access
If the video card does not have its own video memory, the system memory is allocated as the video memory.
The graphics card comes with a vide
Under Linux, the drive device has character device driver, block device driver and network device drive three kinds, before learning the character device driver, now began to learn block device driver. First of all to compare the two device drivers why not pass, why to split into different types of drivers. Take an example to illustrate the need to introduce block device drivers:If you construct the drive i
);
The filter function is called when the kernel is about to generate an event for the specified Kobject, and if 0 is returned, no event is generated
Bus, device, and driver
Bus
A bus is a channel between a processor and one or more devices
struct BUS_TYPE
Char *name;
struct subsystem Subsys;
struct Kset drivers;
struct Kse
The complex device drivers mentioned here involve PCI, USB, network devices, block devices, and so on (strictly speaking, these devices are conceptually not parallel, for example, a character device is tied to a block device, and a PCI, USB device, etc. may be part of a character device). Some of the more complex data structures and program structures associated with specific device types are also involved in the
Linux Kernel "drivers/scsi/gdth. c" IOCTL Local Privilege Escalation Vulnerability
Release date:Updated on:
Affected Systems:Linux kernel 2.6.0-2.6.37Description:--------------------------------------------------------------------------------Bugtraq id: 44648Cve id: CVE-2010-4157
Linux Kernel is the Kernel used by open source Linux.
Linux Kernel has a vulnerability in implementation. Attackers can exploit this vulnerability to execute arbitrary code a
The compiling process of Linux kernel modules and drivers-general Linux technology-Linux programming and kernel information. The following is a detailed description. The Linux kernel is an integral structure, so it is very difficult to add anything to or delete some features to the kernel. The kernel mechanism is introduced to solve this problem. This allows you to dynamically add or delete modules in the kernel.
The module is not compiled in the ker
Four main types of Linux drivers-general Linux technology-Linux programming and kernel information. Character device: a device that uses the RST stream to access the device, such as a character terminal or serial port. It generally accesses the device sequentially, but it can also move the access pointer, such as a frame capture card.
Common development scenarios include touch screen, custom keyboard, video capturing device, and audio device.
Bl
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.