pepoとネットワークを語ろう

40年前からこれまでとこれからのネットワークを語る

LinuxのUSB Driverのdebugやでー!

2011-04-27 19:48:15 | Linux

4年以上前に、こんなことやったきがするけど あかんわー、いちからや

FOMA携帯のModem Driver acm-FOMAの開発を4年位前にやってたけど、その時はこんなことも分かって、てんやろなー

と嘆いていてもしゃーないのでここで一からの覚書を

まずは、Kernelのdebugを有効へ
---------------------------- Kernel debugging -----------------------------
   CONFIG_DEBUG_KERNEL:                                                    
                                                                           
   Say Y here if you are developing drivers or trying to debug and         
   identify kernel problems.                                               
                                                                           
   Symbol: DEBUG_KERNEL [=y]                                               
   Prompt: Kernel debugging                                                
     Defined at lib/Kconfig.debug:140                                      
     Location:                                                             
       -> Kernel hacking

ついでにUSBのdebugメッセージも有効へ
-------------------------- USB verbose debug messages ------------------
  CONFIG_USB_DEBUG:                                                       
                                                                          
  Say Y here if you want the USB core & hub drivers to produce a bunch    
  of debug messages to the system log. Select this if you are having a    
  problem with USB support and want to see more of what is going on.      
                                                                          
  Symbol: USB_DEBUG [=y]                                                  
  Prompt: USB verbose debug messages                                      
    Defined at drivers/usb/core/Kconfig:4                                 
    Depends on: USB_SUPPORT [=y] && USB [=y]                              
    Location:                                                             
      -> Device Drivers                                                   
        -> USB support (USB_SUPPORT [=y])                                 
         -> Support for Host-side USB (USB [=y]) 

Driverソースのdebug行を有効へ                        
/*
 * acm-FOMA.c
*
/
// #undef DEBUG
// #undef VERBOSE_DEBUG
#define DEBUG
#define VERBOSE_DEBUG

Driverをmake
[root@p-4 linux-2.6.35.6-pepo]# make modules
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC [M]  drivers/usb/class/acm-FOMA.o
  Building modules, stage 2.
  MODPOST 906 modules
WARNING: modpost: Found 1 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'
  CC      drivers/usb/class/acm-FOMA.mod.o
  LD [M]  drivers/usb/class/acm-FOMA.ko
[root@p-4 linux-2.6.35.6-pepo]#
デバッグコードを含んだDriverが出来る
[root@p-4 linux-2.6.35.6-pepo]# sz drivers/usb/class/acm-FOMA.ko
適当に取り出し、開発環境へ持って行く
後編に続くよ

pepo

                                                  


最新の画像もっと見る

コメントを投稿

ブログ作成者から承認されるまでコメントは反映されません。