Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

How to write a Linux driver

1. wrote driver function file(s) .
2. stored in the proper folder, eg: character driver stored in folder  drivers/char/
3. modified Makefile in this folder(eg: drivers/char/)
        -added configuration at somewhere: type like that "obj-$(CONFIG_TESTDRIVER) += testdriver.o"
4. modified config.in in the same folder
        -added configuration at somewhere: type like that "bool 'Mytestdriver' CONFIG_TESTDRIVER"
5. modified mem.c in the same folder
        -added initial function of my driver into mem.c with same rule within it.
5. added device node in Makefile in folder vendors/Samsung/4510B
        -added parameters(same as command mknod's parameters) in DEVICES section, eg: test, c, 254, 0, which stands for the register driver name, device type(char), major device number, minor device number
6. used command make menuconfig at linux root folder(eg: uClinux-dist) to let my driver choice available
7. re-compiled linux with some commands
That's all!


Ïà¹ØÎĵµ£º

ÍêÉÆLinuxϵͳ

 
ÍêÉÆLinuxϵͳ
1.¿ª»ú×Ô¶¯¹ÒÔØwindow·ÖÇø
   
fedora10ËäÈ»ÄÜ×Ô¶¯¹ÒÔØ,µ«ÊǹÒÔØµÄ·ÖÇøÓÐʱ»á²»ÈϺº×ÖÎļþ¼Ð
 
 ´ÓÖÕ¶ËÓÃvi»ògedit´ò¿ª/etc/fstab£¬ÔÚÆäÖÐÌí¼Ó£º
 /dev/sda1 /mnt/1 ntfs default 0 0
 ×¢£ºµÚÒ»ÏîÊÇ·ÖÇøÇý¶¯µØÖ·
   ......

The Linux Kernel Module Programming Guide±Ê¼Ç

1¡¢Í¨¹ýlsmodÀ´»ñµÃÄÚºËÒѼÓÔØÁËÄÇЩģ¿é£¬Õâ¸öÃüÁîÊǶÁÈ¡/proc/modulesÎļþµÄÄÚÈÝÀ´»ñµÃÐÅÏ¢µÄ¡£
 
2¡¢ÄÚºËÄ£¿é¹ÜÀíÊØ»¤½ø³ÌkmodÖ´ÐÐmodprobeÈ¥¼ÓÔØÄÚºËÄ£¿é¡£modprobeµÄ¹¦ÄܺÍinsmodÀàËÆ£¬µ«ÊÇËü³ýÁË×°ÈëÖ¸¶¨Ä£¿éÍ⣬»¹Í¬Ê±×°ÈëÖ¸¶¨Ä£¿éËùÒÀÀµµÄÆäËûÄ£¿é¡£
 
3¡¢Èç¹ûÄÚºËÖдò¿ªÁËCONFIG_MODVERSIONSÑ¡Ïî£¬Ô ......

ǶÈëʽlinux½Ìѧ´ó¸Ù

1¡¢Linux »ù´¡
°²×°Linux²Ù×÷ϵͳ
LinuxÎļþϵͳ
Linux³£ÓÃÃüÁî
LinuxÆô¶¯¹ý³ÌÏê½â
ÊìϤLinux·þÎñÄܹ»¶ÀÁ¢°²×°Linux²Ù×÷ϵͳ
Äܹ»ÊìÁ·Ê¹ÓÃLinuxϵͳµÄ»ù±¾ÃüÁî
ÈÏʶLinuxϵͳµÄ³£Ó÷þÎñ°²×°Linux²Ù×÷ϵͳ
Linux»ù±¾ÃüÁîʵ¼ù
ÉèÖÃLinux»·¾³±äÁ¿
¶¨ÖÆLinuxµÄ·þÎñ Shell ±à³Ì»ù´¡Ê¹ÓÃvi±à¼­Îļþ
ʹÓÃEmac ......

LinuxÏ»ñµÃϵͳʱ¼äµÄCÓïÑÔµÄʵÏÖ·½·¨

 LinuxÏ»ñµÃϵͳʱ¼äµÄCÓïÑÔµÄʵÏÖ·½·¨
#include<time.h>  //CÓïÑÔµÄÍ·Îļþ
#include<stdio.h>  //CÓïÑÔµÄI/O
void main()
{
time_t now;    //ʵÀý»¯time_t½á¹¹
struct tm  *timenow;    //ʵÀý»¯tm½á¹¹Ö¸Õë
time(&now);
//timeº¯Êý¶ÁÈ¡ÏÖÔÚµ ......

LinuxµÚÒ»²½——°²×°Linux

ÆäʵÎÄÕÂËã²»ÉÏÔ­´´£¬ÊÇÅöµ½ÎÊÌâµÄʱºòÉÏÍø¶«ËÑËÑÎ÷ËÑËѵÄÄÚÈÝ£¬ËãÊǽ軨Ï×·ðÁ˰ɣ¬¸Ðлԭ´´Õß¡£
1. °²×°ÐéÄâ»ú£¬ÎÒÓõÄÊÇÒ»¸öÂÌ»¯°æ¡£Ð½¨ÐéÄâ»úµÄ¹ý³ÌÈçÏ£º
Õª×Ô£ºhttp://blog.163.com/zongbin521/blog/static/10217990200981094622635/
ÎÒÃÇÒÔ´´½¨LINUXϵͳΪÀý¡£
µÚÒ»²½:Æô¶¯VMware£¬ÔÚÆäÖ÷½çÃæ“Ö÷Ò³” ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ