make: *** /lib/modules//build: 没有那个文件或目录。 停止。
这时需要安装kernel-devel
[root@embedded dnw]# sudo yum install kernel-devel
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-devel.i686 0:2.6.32-71.el6 set to be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
kernel-devel i686 2.6.32-71.el6 base 6.4 M
Transaction Summary
================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 6.4 M
Installed size: 22 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : kernel-devel-2.6.32-71.el6.i686 1/1
Installed:
kernel-devel.i686 0:2.6.32-71.el6
Complete!
然后使用
[root@embedded secbulk]# make -C /lib/modules/`uname -r`/build M=`pwd` modules
make: Entering directory `/usr/src/kernels/2.6.32-71.el6.i686‘
CC [M] /arm11/dnw_linux/secbulk/secbulk.o
/arm11/dnw_linux/secbulk/secbulk.c: 在函数‘secbulk_write’中:
/arm11/dnw_linux/secbulk/secbulk.c:58: 警告:比较不相关的指针时缺少类型转换
Building modules, stage 2.
MODPOST 1 modules
CC /arm11/dnw_linux/secbulk/secbulk.mod.o
LD [M] /arm11/dnw_linux/secbulk/secbulk.ko.unsigned
NO SIGN [M] /arm11/dnw_linux/secbulk/secbulk.ko
make: Leaving directory `/usr/src/kernels/2.6.32-71.el6.i686‘
[root@embedded secbulk]# ls
Makefile Module.symvers secbulk.ko secbulk.mod.c secbulk.o
modules.order secbulk.c secbulk.ko.unsigned secbulk.mod.o
[root@embedded secbulk]# insmod ./sec
[root@embedded secbulk]# dmesgbulk.ko
usb 2-2.2: new full speed USB device using uhci_hcd and address 8
usb 2-2.2: New USB device found, idVendor=1a86, idProduct=7523
usb 2-2.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
usb 2-2.2: Product: USB2.0-Ser!
usb 2-2.2: configuration #1 chosen from 1 choice
ch341 2-2.2:1.0: ch341-uart converter detected
usb 2-2.2: ch341-uart converter now attached to ttyUSB0
hrtimer: interrupt took 12195662 ns
usb 2-2.2: USB disconnect, address 8
ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
ch341 2-2.2:1.0: device disconnected
usb 2-2.2: new full speed USB device using uhci_hcd and address 9
usb 2-2.2: New USB device found, idVendor=1a86, idProduct=7523
usb 2-2.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
usb 2-2.2: Product: USB2.0-Ser!
usb 2-2.2: configuration #1 chosen from 1 choice
ch341 2-2.2:1.0: ch341-uart converter detected
usb 2-2.2: ch341-uart converter now attached to ttyUSB0
secbulk: disagrees about version of symbol module_layout
secbulk:secbulk loaded
usbcore: registered new interface driver secbulk
原文:http://blog.csdn.net/u011046042/article/details/38628663