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Äں˵Ä3ÖÖµ÷¶È·½·¨¼ò½éÈçÏ£º
@SCHED_OTHER ·Öʱµ÷¶È²ßÂÔ£¬½ø³ÌµÄȱʡÀàÐÍ£¬²ÉÓö¯Ì¬ÓÅÏȵ÷¶È²ßÂÔ£¬Ñ¡Ôñ½ø³ÌµÄÒÀ¾ÝÖ÷ÒªÊǸù¾Ý½ø³ÌgoognessÖµµÄ´óС£¬ÕâÖÖ½ø³ÌÔÚÔËÐÐʱ£¬¿ÉÒÔ±»¸ßgoodnessÖµµÄ½ø³ÌÇÀÏÈ£»
@SCHED_FIFO ʵʱµ÷¶È²ßÂÔ£¬Ïȵ½ÏÈ·þÎñ£¬×ñÊØPOSIX1.b±ê×¼µÄFIFOµ÷¶È¹æÔò£¬Ëü»áÒ»Ö±Ô ......
1¡¢Í¨¹ýlsmodÀ´»ñµÃÄÚºËÒѼÓÔØÁËÄÇЩģ¿é£¬Õâ¸öÃüÁîÊǶÁÈ¡/proc/modulesÎļþµÄÄÚÈÝÀ´»ñµÃÐÅÏ¢µÄ¡£
2¡¢ÄÚºËÄ£¿é¹ÜÀíÊØ»¤½ø³ÌkmodÖ´ÐÐmodprobeÈ¥¼ÓÔØÄÚºËÄ£¿é¡£modprobeµÄ¹¦ÄܺÍinsmodÀàËÆ£¬µ«ÊÇËü³ýÁË×°ÈëÖ¸¶¨Ä£¿éÍ⣬»¹Í¬Ê±×°ÈëÖ¸¶¨Ä£¿éËùÒÀÀµµÄÆäËûÄ£¿é¡£
3¡¢Èç¹ûÄÚºËÖдò¿ªÁËCONFIG_MODVERSIONSÑ¡Ïî£¬Ô ......
¹¤×÷Öо³£ÐèÒªKill¶à¸ö½ø³Ì£¬Èç¹ûÕâЩ½ø³ÌÓй²Í¬µÄÌص㣬¾Í¿ÉÒÔÓÃÒ»ÌõÃüÁîKillµôËüÃÇ¡£
±ÈÈçÇå³ýOracleÊý¾Ý¿âµÄËùÓÐÔ¶³ÌÁ¬½Ó½ø³Ì£º
ps -efww|grep LOCAL=NO|grep -v grep|cut -c 9-15|xargs kill -9
¡¡¡¡¹ÜµÀ·û“|”ÓÃÀ´¸ô¿ªÁ½¸öÃüÁ¹ÜµÀ·û×ó±ßÃüÁîµÄÊä³ö»á×÷Ϊ¹ÜµÀ·ûÓÒ±ßÃüÁîµÄÊäÈë¡£ÏÂÃæ˵˵Óà ......
Ò»¡¢¼¯ÈºµÄ»ù±¾¸ÅÄî
ÓÐÒ»ÖÖ³£¼ûµÄ·½·¨¿ÉÒÔ´ó·ùÌá¸ß·þÎñÆ÷µÄ°²È«ÐÔ£¬Õâ¾ÍÊǼ¯Èº¡£
Cluster¼¯Èº¼¼Êõ¿ÉÈç϶¨Òå:Ò»×éÏ໥¶ÀÁ¢µÄ·þÎñÆ÷ÔÚÍøÂçÖбíÏÖΪµ¥Ò»µÄϵͳ£¬²¢ÒÔµ¥Ò»ÏµÍ³µÄģʽ¼ÓÒÔ¹ÜÀí¡£´Ëµ¥Ò»ÏµÍ³Îª¿Í»§¹¤×÷Õ¾Ìṩ¸ß¿É¿¿ÐԵķþÎñ¡£
´ó¶àÊýģʽÏ£¬¼¯ÈºÖÐËùÓеļÆËã»úÓµÓÐÒ»¸ö¹²Í¬µÄÃû³Æ£¬¼¯ÈºÄÚÈÎһϵͳÉÏÔËÐеķþÎñ ......