基于s3c6410开发板helloworld驱动模块开发
来源:互联网 发布:linux c tcp服务器 编辑:程序博客网 时间:2024/06/12 20:40
PC:win7 x64
VMware:Ubuntu14.04
s3c6410开发板:linux-2.6.28.6
【源代码】
hello.c
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
//Defining __KERNEL__ and MODULE allows us to access kernel-level code not usually available to userspace programs.
#undef __KERNEL__ //为了引用内核数据结构
#define __KERNEL__
#undef MODULE
#define MODULE
// Linux Kernel/LKM headers: module.h is needed by all modules and kernel.h is needed for KERN_INFO.
#include <linux/module.h> // included for all kernel modules
#include <linux/kernel.h> // included for KERN_INFO
#include <linux/init.h> // included for __init and __exit macros
MODULE_LICENSE("Dual BSD/GPL");
static int __init hello_init(void)
{
printk(KERN_INFO "Hello world!\n");
return 0; //Non-zero return means that the module couldn't be loaded
}
static void __exit hello_cleanup(void)
{
printk(KERN_INFO "Cleaning up module! this is exit\n");
}
module_init(hello_init);
module_exit(hello_cleanup);
MODULE_AUTHOR("andrew yue");
MODULE_DESCRIPTION("A hello word module for testing module parameters");
MODULE_VERSION("V1.0");
Makefile
---------------------------------------------------------------------------------------------------------------
ifneq ($(KERNELRELEASE),)
obj-m := hello.o
else
KDIR := /home/yzli/yzli_lib/s3c-linux-2.6.28.6-TOP6410//移植的linux源码目录
all:
make -C $(KDIR) M=$(PWD) modules ARCH=arm CROSS_COMPILE=/home/yzli/yzli_lib/arm-2008q3/bin/arm-none-linux-gnueabi-//交叉编译路径
clean:
rm -f *.ko *.o *.mod.o *.mod.c *.symvers
endif
【问题】
1.error: linux/bounds.h: No such file or directory
-------------------------------------------------------------------------------------
在linux-2.6.28.6源码目录,执行make重新编译一遍(拷贝过来,未编译过)。
2.执行模块卸载时(rmmod hello)提示"rmmod: module 'hello' not found",其实模块已经卸载
---------------------------------------------------------------------------------------------------------------------------
个人理解,是由于移植文件系统时,编译busybox的原因,暂不考虑。详见
http://www.cnblogs.com/feisky/archive/2010/05/29/1746888.html
3.编译后的驱动模块是hello.ko,加载和卸载模块操作如下
-------------------------------------------------------------------------------
加载模块:insmod hello.ko
卸载模块 rmmod hello
- 基于s3c6410开发板helloworld驱动模块开发
- linux 模块驱动开发第一弹 helloworld
- 【分享】基于三星S3C6410开发板android系统下USB wifi的 驱动配置
- 开发Nginx模块Helloworld
- Linux驱动开发HelloWorld
- 基于NanoPi的继电器模块驱动开发
- 详述Android照相功能的实现(基于飞凌S3C6410开发板+单独编译安卓模块)
- 友坚UT-S3C6410开发板 linux下面button 驱动
- S3C6410开发板linux下触摸屏驱动分析
- 第六期 基于模拟器的Helloworld 内核驱动 《手机就是开发板》
- S3C6410开发板
- s3c6410 Linux 驱动开发环境搭建
- apache模块开发之helloworld
- Helloworld内核模块的开发
- apache模块开发之helloworld
- apache模块开发之helloworld
- 1->驱动开发 helloWorld程序
- iPhone基于CYGWIN开发HelloWorld
- soap协议转换成wsdl请求服务器
- delphi 获取元素相对屏幕的位置
- (18)mysql中的分区(开发篇完)
- android中的action
- 2015年浙江省省赛赛后总结
- 基于s3c6410开发板helloworld驱动模块开发
- C Primer Plus 练习 10-2
- VC中实现历史记录的全面清除
- cg profiles,什么是profiles,以及如何使用CGC编译Cg语言
- Spring MVC视图解析器:Spring MVC ResourceBundleViewResolver示例
- 对象不能从 DBNull 转换为其他类型.
- CentOS上搭建Nginx + Mono 运行 asp.net
- python学习笔记1
- mybatis执行批量更新batch update 的方法(oracle,mysql)