在centos 6上的helloworld 模块测试
来源:互联网 发布:电信运营商网络架构 编辑:程序博客网 时间:2024/05/17 23:57
[root@localhost test]# lshelloworld.c Makefile[root@localhost test]# makemake -C /lib/modules/2.6.32-71.29.1.el6.i686/build M=/home/android/test modulesmake[1]: Entering directory `/usr/src/kernels/2.6.32-71.29.1.el6.i686' CC [M] /home/android/test/helloworld.o Building modules, stage 2. MODPOST 1 modules CC /home/android/test/helloworld.mod.o LD [M] /home/android/test/helloworld.ko.unsigned NO SIGN [M] /home/android/test/helloworld.komake[1]: Leaving directory `/usr/src/kernels/2.6.32-71.29.1.el6.i686'[root@localhost test]# lshelloworld.c helloworld.mod.c Makefilehelloworld.ko helloworld.mod.o modules.orderhelloworld.ko.unsigned helloworld.o Module.symvers[root@localhost test]# insmod helloworld.koinsmod: error inserting 'helloworld.ko': -1 File exists[root@localhost test]# rmmod helloworld.ko[root@localhost test]# lshelloworld.c helloworld.mod.c Makefilehelloworld.ko helloworld.mod.o modules.orderhelloworld.ko.unsigned helloworld.o Module.symvers[root@localhost test]# insmod helloworld.ko[root@localhost test]# modinfo helloworld.kofilename: helloworld.koauthor: yuanweilicense: GPLsrcversion: E074EFF1EF4BF929639B50Ddepends:vermagic: 2.6.32-71.29.1.el6.i686 SMP mod_unload modversions 686[root@localhost test]#
附上 helloworld 源码和Makefile
#include <linux/module.h>#include <linux/kernel.h>#include <linux/init.h>static int __init hellokernel_init(void){ printk(KERN_INFO "Hello kernel!\n"); return 0;}static void __exit hellokernel_exit(void){ printk(KERN_INFO "Exit kernel!\n");}module_init(hellokernel_init);module_exit(hellokernel_exit);MODULE_LICENSE("GPL");MODULE_AUTHOR("yuanwei");~~~~
obj-m := helloworld.oPWD := $(shell pwd)all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modulesclean: rm -rf *.o *~ core .*.cmd *.mod.c ./tmp_version *.ko.* modules.* Module.*
如果是CentOS 平台。需要安装kernel头文件
需要用YUM安装
[root@localhost test]# yum install kernel-devel
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: data.nicehosting.co.kr
* extras: data.nicehosting.co.kr
* updates: data.nicehosting.co.kr
Setting up Install Process
Package kernel-devel-2.6.32-71.29.1.el6.i686 already installed and latest version
Nothing to do
- 在centos 6上的helloworld 模块测试
- 在Linux上的Java HelloWorld
- 在Predix上运行Scala的HelloWorld
- 在linux服务器上lamp环境中怎样安装php的扩展模块(centos系统)
- 我的helloworld模块
- nginx的helloworld模块的helloworld
- Centos上sysbench的安装测试
- jQuery的HelloWorld测试
- tigase7.1.0 服务器在centos上搭建spark测试
- 在Android平台上运行Cocos2D-x的HelloWorld
- minigui demo helloworld在arm目标板子上的运行
- 在Centos 6虚拟机上启动FTP服务的步骤
- 在Vmware的CentOS 6上安装kvm
- 如何在 Linode 的 CentOS 6 上部署 WordPress 应用?
- mongodb在centos 6上的安装部署
- Tomcat 7 在 Centos 6 上启动慢的解决办法
- Helloworld内核模块的开发
- memcached 在 centos 的安装测试
- 杂项7
- iphone开发 调用相机拍照
- error C2143: syntax error : missing ';' before '*'
- Ubuntu安装配置Mysql
- 急需要解答JSON问题!...很着急,非常急!
- 在centos 6上的helloworld 模块测试
- 设置NTFS的文件/文件夹安全权限
- sphinxSE+mysql部署实现
- OWC详解,以及OWC生成柱图,线图,饼图示例
- hdu 3046
- oracle-xe fedora14安装
- wingdb开发过程中遇到一个比较“头疼”的bug
- 学习ojective之一
- wcsf