首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

Linux内核驱动程序的配置3

Linux内核驱动程序的配置3

在新增的 test 目录下,应该包含如下 Makefile 文件:#drivers/test/Makefile # Makefile for the TEST # obj-$(CONFIG_TEST) +=test.o test_queue.o test_client.o obj-$(CONFIG_TEST_USER) += test_ioctl.o obj-$(CONFIG_PROC_FS) += test_proc.o obj-¥(CONFIG_TEST_CPU) +=cpu/该脚本根据配置变量的取值构建 obj-* 列表。由于 test 目录中包含一个子目录 cpu,当 CONFIG_TEST_CPU=y 时,需要将 cpu 目录加入列表。
test 目录中 cpu 子目录也需要包含如下的 Makefile 文件:#drivers/test/test/Makefile #Makefile for the TEST CPU obj-$(CONFIG_TEST_CPU) +=cpu.o为了使得整个 test 目录能够被编译命令作用到,test 目录父目录中的 Makefile 文件也需要新增如下脚本:obj-$(CONFIG_TEST) +=test/在 drivers/Makefile 中加入 obj-$(CONFIG_TEST) +=test/,使得用户在进行内核编译时能够进入 test 目录。
增加了 Kconfig 和 Makefile 文件之后的新的 test 树型目录如下所示:|——test |——cpu |——cpu.c |——test.c |——test_client.c |——test_ioctl.c |——test_proc.c |——test_queue.c |——Makefile |——Kconfig
返回列表