LINUX内核与驱动的最新编译方法

 驱动编译有两种方法:

1. 编译到内核中

2. 编译为独立模块

建立方法:

1) 在     linux   源码树的驱动目录增加自己的驱动目录,比如:现在新增一个网络设备驱动

 LINUX内核与驱动的最新编译方法_设计制作_RF/无线

mkdir linux_tree/drive     rs   /net/poker_driver -p

cd linux_tree/drivers/net/poker_driver

2) 编写驱动源码

vi  poker_drv_part1.c

vi  poker_drv_part2.c

vi  poker_drv_part3.c

3) 编写源码目录Kconfig

vi Kconfig

config POKER_DRV
trista     te   "poker_driver support"
default n
---help---
If you say Y here, the kernel will support poker_driver.
If you say M here, the kernel not support poker_driver, must perform "insmod poker_driver.ko".
If you say N here, the kernel not support poker_driver.

4) 编写源码目录Makefile

vi Makefile

obj-$(CONFIG_POKER_DRV) += poker_drv.o
poker_drv-objs += poker_drv_part1.o poker_drv_part2.o poker_drv_part3.o

5) 修改上级Kconfig

vi linux_tree/drivers/net/Kconfig

source "drivers/net/poker_driver/Kconfig"

6) 修改上级Makefile

vi linux_tree/drivers/net/Makefile

obj-$(CONFIG_POKER_DRV) += poker_driver/

7) 配置内核

make menuconfig

Device Drivers  --->

[*] Network device support  --->

<>poker_driver support

1. 编译到内核中:

<*>poker_driver support

linux_tree# make uImage

2. 编译为独立模块

poker_driver support

linux_tree# make modules

括号问题:

[]   可选项 * 空

<> 可选项 * M 空



68
3
0
95

相关资讯

  1. 1、人工智能和机器人技术如何改变农业2030
  2. 2、Marvell推出组合广泛的TrueWi-Fi6解决方案3905
  3. 3、条码扫描器的特点以及其接口的类型4866
  4. 4、机器学习在贷款承销中如何更具适应性?3372
  5. 5、​LED路灯规模持续增长但“市场混乱”怪圈谁来破?230
  6. 6、石家庄海关去年减免税款5.32亿元增长63.77%2110
  7. 7、RFID技术是制造业的必需品吗?1330
  8. 8、借助激光雷达来看透云雾693
  9. 9、高管总结2019年人工智能技术趋势19年那些经历亏损的机器人公司1543
  10. 10、​中国科研人员开发出磁性微游动机器人,可像蚁群协同作业3810
全部评论(0)
我也有话说
0
收藏
点赞
顶部