有两种方法可以编译自己写的驱动程序。
第一种方法:加入单个文件到驱动目录下
1.将helloworld_nodir.c的驱动源文件拷到/qemu_arm/linux-kernel/linux-3.16.39/drivers/char目录下
2.修改/qemu_arm/linux-kernel/linux-3.16.39/drivers/char/Kconfig文件.
打开Kconfig在 source "drivers/tty/Kconfig"后添加以下信息:
config HELLO_WORLD_NODIR
tristate "hello world no dir "
default y
help
It test how to add module to kernel
If unsure, it is safe to say Y.
3.修改此驱动目录下的Makefile文件,加入对驱动源码的编译:
obj-$(CONFIG_HELLO_WORLD_NODIR) += helloworld_nodir.o
4.make menuconfig
Device Drivers --->
Char