Fedora Core 5 内核模块编译
2008-02-28 17:58
260 查看
Fedora Core 5 内核模块编译
到http://download.fedora.redhat.com/pub/fedora/linux/core/5/source/SRPMS/kernel-2.6.15-1.2054_FC5.src.rpm下载kernel-2.6.15-1.2054_FC5.src的安装包。(我的内核版本是这个所以就下载的这个版本,你可以用uname -r这个命令来查看你内核版本号)
# rpm –Uvh kernel-2.6.15-1.2054_FC5.src.rpm
# cd /usr/src/redhat/SPECS
# rpmbuild -bp --target $(uname -m) kernel-2.6.spec
# ls /usr/src/redhat/BUILD/kernel-2.6.15/
Config.mk linux-2.6.15.i686 vanilla xen xen-vanilla
# cd /usr/src/redhat/BUILD/kernel-2.6.15/linux-2.6.15.i686
# cp configs/kernel-2.6.15-i686.config .config
cp:是否覆盖“.config”? y
继续编译:
#make mrproper
#make oldconfig
#make
#make modules_install
到此我们要用的内核编译完成,可以开始编写内核模块了。
/*hello.c*/
#include <linux/init.h>
#include <linux/module.h>
static int hello_init(void)
{
printk(KERN_ALERT "hello,world/n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "bye/n");
}
module_init(hello_init);
module_exit(hello_exit);
MODULE_LICENSE("GPL");
/*makefile*/
KERNELDIR = /usr/src/redhat/BUILD/kernel-2.6.15/linux-2.6.15.i686/
SUBDIR = /home/driver
all:modules
obj-m:=module.o
module-objs:=hello.o
modules:
$(MAKE) -C $(KERNELDIR) M=$(SUBDIR) modules
相关文章推荐
- 单独编译某个内核模块
- kbuild系统-编译到内核和编译成模块的区别
- kernel 内核模块编译
- SystemTap----将SystemTap脚本编译成内核模块
- 2.4内核编译添加单独的模块!
- 2.6.32内核 模块 编译。。
- Linux 内核模块编译 Makefile
- 在Linux 2.6内核下编译可以加载的内核模块
- 两个编译2.4与2.6内核模块
- 基于linux2.6.30.4内核的DM9000网卡驱动编译成模块成功ping通
- 内核子系统或设备驱动可以直接编译到内核,也可以编译成模块,如果编译到内核,可以使用前一节介绍的方法通过内核启动参数来向它们传递参数,如果编译成模块,则可以通过命令行在插入模块时传递参数,或者在运行时,
- 内核模块编译说明
- 浅谈linux性能调优之二十:模块管理与内核编译
- 如何把自己的驱动编译进内核或模块
- 通过hello world介绍2.6内核模块编译的最基本原理 .
- 编译一个自己的内核模块,并加载进内核
- raspberry内核编译和模块开发
- Linux学习记录--内核|内核模块编译 推荐
- 模块编译KO文件Makefile 2.6内核通用
- linux 2.6内核 编译模块Makefile 详解