在ubuntu 8.10下如何编译和追踪usbhid驱动
1.首先需要知道内核版本
luther@gliethttp:~$ uname -r
2.6.27-7-generic
2.去下载该版本内核
luther@gliethttp:~$ wget http:///pub/linux/kernel/v2.6/linux-2.6.27.7.tar.bz2
luther@gliethttp:~$ apt-get install libncurses5-dev
3.安装ubuntu 8.10内核include头文件
luther@gliethttp:~$ sudo apt-get install linux-headers-2.6.27-7-generic
4.可以执行编译了
luther@gliethttp:/vobs/works/linux-2.6.27.7/drivers/hid/usbhid$ make -C /lib/modules/`uname -r`/build M=`pwd` modules
或者
luther@gliethttp:~$ cp -r /vobs/works/linux-2.6.27.7/drivers/hid/usbhid .
luther@gliethttp:~$ cd usbhid/
luther@gliethttp:~/usbhid$ make -C /lib/modules/`uname -r`/build M=`pwd` modules
make: Entering directory `/usr/src/linux-headers-2.6.27-7-generic'
CC [M] /home/luther/usbhid/hid-core.o
CC [M] /home/luther/usbhid/hid-quirks.o
CC [M] /home/luther/usbhid/hiddev.o
LD [M] /home/luther/usbhid/usbhid.o
CC [M] /home/luther/usbhid/usbkbd.o
CC [M] /home/luther/usbhid/usbmouse.o
Building modules, stage 2.
MODPOST 3 modules
CC /home/luther/usbhid/usbhid.mod.o
LD [M] /home/luther/usbhid/usbhid.ko
CC /home/luther/usbhid/usbkbd.mod.o
LD [M] /home/luther/usbhid/usbkbd.ko
CC /home/luther/usbhid/usbmouse.mod.o
LD [M] /home/luther/usbhid/usbmouse.ko
make: Leaving directory `/usr/src/linux-headers-2.6.27-7-generic'
luther@gliethttp:~/usbhid$
你可以在需要的地方加入dump_stack()或者printk();
阅读(1995) | 评论(0) | 转发(0) |