The complete process of adding a device driver in uClinux (zt)

Source: Internet
Author: User

The following example describes how to add a device driver. Block devices and network devices can be processed accordingly.

1. Put the original file in the linux-2.4.x/driver/Char/; in this example, the file name is xyz. c

2. the device driver's original file must include such a function:
Void xyz_init (void) {register (254, 'xyz', & xyz_fops)} This function completes registration. It will be called in linux-2.4.x/driver/MEM. C.
This function can also be written as follows:
Void _ init xyz_init (void) {register (254, 'xyz', & xyz_fops)} does not have to call it in linux-2.4.x/driver/MEM. c

3. Modify the linux-2.4.x/driver/Char/makefile to add a row at the appropriate position:
OBJ _ $ (config_xyz) + = xyz. o

4. Modify linux-2.4.x/driver/Char/config. In and add a line:
Bool 'xyz hahahahaha' config_xyz
It is easy to select when make menuconfig

5. Modify linux-2.4.x/driver/Char/MEM. c
Add:
# Ifdef config_xyz
Extern void xyz_init (void );
# Endif
Add the following in the chr_dev_init () function:
# Ifdef config_xyz
Xyz_init ();
# Endif
6. Modify the vendor/Samsung/4510b/makefile to create a device node;
Add the following content to the device section between 12-35 and 12-35:
Xzy, C, 254,0

7. Make menuconfig select XYZ Hahahaha,
Compile and download. After startup, you will see that the character device in/proc/devices has one more XYZ 254

 

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.