[分享]编译内核模块

软件和网站开发以及相关技术探讨
回复
abigriver
帖子: 95
注册时间: 2006-07-07 16:49

[分享]编译内核模块

#1

帖子 abigriver » 2007-03-01 19:20

按照linux device driver 3版, 第一个hello world程序的编译
编译环境:
安装
build-essential
linux-header-......(你自己使用的内核版本,可以用uname -r查看)
linux-source-...

下载ldd的example,解压, 到其中的misc-modules目录下有 hello.c和Makefile
直接make就可以了
生成了hello.ko
然后终端运行
sudo insmod hello.ko
按照ldd的说法,此时是没有输出的, 输出在/var/log/kern.log中, 你可以看到Hello World
卸载内核模块类似
头像
titainium
帖子: 689
注册时间: 2006-12-02 12:25

#2

帖子 titainium » 2007-03-08 20:17

还在学习写“Hello,World”,暂时看不到那么高深的东西 :em66
Titainium
回复