2009年2月22日 星期日

design the new driver in make menuconfig

design the new driver

1.driver程式中的進入點和結束點要用以下寫法
int __init test_init(void) { }
void __exit test_exit(void) { }
module_init(test_init);
module_exit(test_exit);
2.Modify for menuconfig
Character Driver
– 2.4: kernel/drivers/char/Config.in
– 2.6: Kernel/drivers/char/Kconfig
/usr/src/linux-2.4.x /drivers/char/Config.in
tristate ‘My test module' CONFIG_HELLO
/usr/src/linux-2.6.x /drivers/char/Kconfig
config HELLO
tristate “My test module"
help
This is my test module
3.Add the New Item in the Makefile
Character Driver
– kernel/drivers/char/Makefile
/usr/src/linux-2.4.x /drivers/char/Makefile
obj-$(CONFIG_HELLO) += test.o
/usr/src/linux-2.6.x /drivers/char/Makefile
obj-$(CONFIG_HELLO) += test.o

沒有留言:

張貼留言