For the first time, write the driver-general Linux technology-Linux programming and kernel information. For details, refer to the following. The first time I learned the write driver, I tried to write a driver according to linuxdevicedriver3.
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
# Include
Unsigned int test_major = 0;
Static int read_test (struct inode * inode, struct file * file, char * buf, int count ){
Int left;
If (verify_area (VERIFY_WRITE, buf, count) =-EFAULT)
Return-EFAULT;
For (left = count; left> 0; left --){
_ Put_user (1, buf, 1 );
Buf ++;
}
Return count;
}
Can a device driver write such a. c file? (I really don't know. I didn't even mention such a complete driver example ),????
Then execute:
Gcc-O2-DMODULE-d1_kenel _-c test. c
Error:
Linux/module. h: No such file or director
Linux/mm. h: No such file or directory
Linux/error. h: No such file or directory
Linux/config. h: No such file or directory
Asm/segment. h: No such file or directory
Why? Why can't gcc find the lib file? I have installed linux-headers-
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