linux module Makefile
²»ÖªµÀÔÚʲçÛʱºò£¬×ªÔØLinux ³öÏÖÁË module ÕâÖÖ¶«Î÷£¬µÄÈ·£¬ËüÊÇ Linux µÄÒ»´ó¸ïС£ÓÐÁË module Ö®ºó£¬Ð´
device driver ²»ÔÙÊÇÒ»Ïî¶ñÃΣ¬ÐÞ¸Ä kernel Ò²²»ÔÙÊÇÒ»¼þÍ´¿àµÄÊÂÁË¡£ÒòΪÄã²»ÐèҪÿ´ÎÒª²âÊÔ driver ¾ÍÖØÐÂ
compile kernel Ò»´Î¡£ÄǼòÖ±ÊÇ»áÀÛËÀÈË¡£Module ¿ÉÒÔÔÊÐíÎÒÃǶ¯Ì¬µÄ¸Ä±ä kernel£¬¼ÓÔØ device
driver£¬¶øÇÒËüÒ²ÄÜËõ¶ÌÎÒÃÇ driver development µÄʱ¼ä¡£ÔÚÕâƪÎÄÕÂÀÎÒ½«Òª¸ú¸÷λ½éÉÜһϠmodule
µÄÔÀí£¬ÒÔ¼°ÈçºÎдһ¸ö module¡£
module ·Òë³ÉÖÐÎľÍÊÇÄ£¿é£¬²»¹ý£¬ÊÂʵÉÏÈ¥·ÒëÕâ¸ö×ÖÒ»µã¶¼Ã»ÒâÒå¡£ÔÚ½²Ä£¿é֮ǰ£¬ÎÒÏȾÙÒ»¸öÀý×Ó¡£ÏàÐźܶàÈ˶¼Óùý RedHat¡£ÔÚ
RedHat ÀÎÒÃÇ¿ÉÒÔÖ´ÐÐ sndconfig£¬Ëü¿ÉÒÔ°ïÎÒÃÇ config Éù¿¨¡£config
ÍêÖ®ºóÈç¹û×½µÃµ½ÄãµÄÉù¿¨£¬ÄÇÄãµÄÉù¿¨ÂíÉϾͿÉÒÔ¶¯ÁË£¬¶øÇÒ»¹²»ÓÃÖØ줻î¼ÆËã»ú¡£ÕâÊÇÔõçÛ×öµÄÄØ ? ¾ÍÊÇ¿¿module¡£module
ÆäʵÊÇÒ»°ãµÄ³ÌÐò¡£µ«ÊÇËü¿ÉÒÔ±»¶¯Ì¬Ôص½ kernel Àï³ÉΪ kernelµÄÒ»²¿·Ö¡£Ôص½ kernel ÀïµÄ module Ëü¾ßÓиú
kernel Ò»ÑùµÄȨÁ¦¡£¿ÉÒÔ access ÈκΠkernel µÄ data structure¡£ÄãÌý¹ý kdebug Âð ? ËüÊÇÓÃÀ´
debug kernel µÄ¡£Ëü¾ÍÊÇÏȽ«Ëü±¾ÉíµÄÒ»¸ö module Ôص½ kernel À¶øÔÚ user space µÄ gdb
¾Í¿ÉÒÔ¾ÓɸúÕâ¸ö module ¹µÍ¨£¬µÃÖª kernel ÀïµÄ data structure µÄÖµ£¬³ý´ËÖ®Í⣬»¹¿ÉÒÔ¾ÓÉÔص½ kernel µÄ
module È¥¸ü¸Ä kernel Àï data structure¡£
ÎÒÃÇÖªµÀ£¬ÔÚд C ³ÌÐòµÄʱºò£¬Ò»¸ö³ÌÐòÖ»ÄÜÓÐÒ»¸ö main¡£Kernel ±¾ÉíÆäʵҲÊÇÒ»¸ö³ÌÐò£¬Ëü±¾ÉíÒ²Óиö main£¬½Ð
start_kernel()¡£µ±ÎÒÃÇ°ÑÒ»¸ö module Ôص½ kernel ÀïµÄʱºò£¬Ëü»á¸ú kernel ÕûºÏÔÚÒ»Æ𣬳ÉΪ kernel
µÄÒ»²¿·Ö¡£Çë¸÷λÏëÏ룬ÄÇ module ¿ÉÒÔÓÐ main Âð ? ´ð°¸ºÜÃ÷ÏԵģ¬ÊÇ No¡£ÀíÓɺܼòµ¥¡£Ò»¸ö³ÌÐòÖ»ÄÜÓÐÒ»¸ö main¡£ÔÚʹÓÃ
module ʱ£¬ÓÐÒ»µãÒª¼ÇסµÄÊÇ module ÊÇ´¦ÓÚ±»¶¯µÄ½ÇÉ«¡£ËüÊÇÌṩijЩ¹¦ÄÜÈñðÈËȥʹÓõġ£
Kernel ÀïÓÐÒ»¸ö±äÁ¿½Ð module_list£¬Ã¿µ± user ½«Ò»¸ö module Ôص½ kernel ÀïµÄʱºò£¬Õâ¸ö module
¾Í»á±»¼Ç¼ÔÚ module_list ÀïÃæ¡£µ± kernel ҪʹÓõ½Õâ¸ö module ÌṩµÄ function ʱ£¬Ëü¾Í»áÈ¥ search
Õâ¸ö list£¬ÕÒµ½ module£¬È»ºóÔÙʹÓÃÆäÌṩµÄ function »ò variable¡£Ã¿Ò»¸ö module ¶¼¿ÉÒÔ export
һЩ function »ò±äÁ¿À´ÈñðÈËʹÓᣳý´ËÖ®Í⣬module Ò²¿ÉÒÔʹÓÃÒѾÔص½ kernel ÀïµÄ module ÌṩµÄ
function¡£ÕâÖÖÇéÐνÐ×ö module stack¡£±È·½Ëµ£¬mod
Ïà¹ØÎĵµ£º
Ò»£®Ç°ÑÔ
¡¡¡¡LinuxÓµÓзḻ¸÷ÖÖÔ´´úÂë×ÊÔ´,µ«ÊǴ󲿷ִúÂëÔÚWindowsƽ̨Çé¿öÊÇÎÞ·¨Õý³£±àÒëµÄ¡£Windowsƽ̨¸ù±¾ÎÞ·¨Ö±½ÓÀûÓÃÕâЩԴ´úÂë×ÊÔ´¡£Èç¹ûÏëҪʹÓÃÍêÕûµÄ´úÂ룬¾ÍÒª×öÒÆÖ²¹¤×÷¡£ÒòΪC/C++ LibraryµÄ²»Í¬ºÍÆäËûµÄһЩÔÒò£¬ÒÆÖ²C/C++´úÂëÊÇÒ»ÏîÀ§ÄѵŤ×÷¡£±¾ÎĽ«ÒÔÒ»¸öʵ¼ÊµÄÀý×Ó£¨Tar£©À´ËµÃ÷ÈçºÎ°ÑLinux´úÂëÒÆÖ² ......
¾¹ýÉÏÊöµÄ¼¸¸ö²½Öè¡£µÚÒ»¸öÄ¿±ê£¬´úÂëÄܹ»±àÒëͨ¹ý»ù±¾ÉÏÊDz»»áÓÐʲôÎÊÌâµÄ¡£Ö»Òª°ÑÎպöþ¸öÐ޸ĴúÂëµÄ»ù±¾ÔÔò£¬µÚÒ»¡£ÒýÈëеĴúÂ룬¶ø²»ÐÞ¸ÄÔÓеĴúÂë¡£ÔÚûÓа취½øÐе÷ÊÔÇ°ÐÞ¸ÄÔ´´úÂëÊDz»ÔÊÐíµÄ£¬Ð޸ĵIJ»ºÃ¾Í»áÒýÆð×îºó´úÂëÔËÐÐÂß¼µÄ»ìÂÒ£¬¶øÇÒÔÚ´úÂëÄܹ»ÔËÐÐ֮ǰÊǺÜÄÑ·¢ÏÖÎÊÌâµÄ¡£ËùÒÔ³ý·Ç·Ç³£ÓаÑÎÕ£¬·ñÔò²»Òª ......
linuxÄÚºËÉè¼ÆÓëʵÏÖ£¨9£©¶¨Ê±Æ÷ºÍʱ¼ä¹ÜÀí
ʱ¼ä¹ÜÀíÔÚÄÚºËÖÐÕ¼Óзdz£ÖØÒªµÄµØλ¡£Ïà¶ÔÓÚʼþÇý¶¯£¬ÄÚºËÖÐÓдóÁ¿µÄº¯Êý¶¼ÊÇ»ùÓÚʱ¼äÇý¶¯µÄ¡£Äں˱ØÐë¹ÜÀíϵͳµÄÔËÐÐʱ¼äÒÔ¼°µ±Ç°µÄÈÕÆÚºÍʱ¼ä¡£
ÖÜÆÚ²úÉúµÄʼþ¶¼ÊÇÓÉϵͳ¶¨Ê±Æ÷Çý¶¯µÄ¡£ÏµÍ³¶¨Ê±Æ÷ÊÇÒ»Öֿɱà³ÌÓ²¼þоƬ£¬ËüÒѹ̶¨ÆµÂʲúÉúÖ ......
Linux I2CºËÐÄ¡¢×ÜÏßÓëÉ豸Çý¶¯
×¢:
ÔÚlinux2.6.32°æ±¾ÖÐÓÐÕâÑùµÄ´úÂëÓë×¢ÊÍ:
struct i2c_driver {
unsigned int class;
/* Notifies the driver that a new bus has appeared or is about to be
* removed. You should avoid using this if y ......