pengp@shlabacsbb06:~/mywork/main/hardware/intel/linux-2.6/drivers/input$ vim helloworld.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
MODULE_LICENSE("GPL");
static int __init hello_init(void)
{
printk(KERN_ALERT "Good morrow");
printk(KERN_ALERT "to this fair assembly.\n");
return 0;
}
static int __exit hello_exit(void)
{
printk(KERN_ALERT "PENGPENG");
printk(KERN_ALERT "SEE YOU!\n");
}
module_init(hello_init);
module_exit(hello_exit);
pengp@shlabacsbb06:~/mywork/main/out/target/product/mfld_pr2$ find . -name *hello*
./root/lib/modules/helloworld.ko
./kernel_build/drivers/input/.helloworld.ko.cmd
./kernel_build/drivers/input/.helloworld.mod.o.cmd
./kernel_build/drivers/input/helloworld.o
./kernel_build/drivers/input/helloworld.ko
./kernel_build/drivers/input/.helloworld.o.cmd
./kernel_build/drivers/input/helloworld.mod.o
./kernel_build/drivers/input/helloworld.mod.c
./kernel_build/.tmp_versions/helloworld.mod
奇怪的是我把helloworld.ko cpy 到手机上,
lsmod //查看运行的模块
insmod helloworld.ko
:会有错误的信息,原来是不匹配,后啦把相应的boot.bin 替换掉之后,加载就没错误了
但是我想要的打印信息确不在;
要用dmesg 去查看消息.
rmmod helloworld.ko