shana@shana:~/linux_驱动开发$ make 
make -C /lib/modules/2.6.22-14-generic/build M=/home/shana/linux_驱动开发 modules 
make[1]: Entering directory `/usr/src/linux-headers-2.6.22-14-generic' 
CC [M] /home/shana/linux_驱动开发/hello.o 
Building modules, stage 2. 
MODPOST 1 modules 
CC /home/shana/linux_驱动开发/hello.mod.o 
LD [M] /home/shana/linux_驱动开发/hello.ko 
make[1]: Leaving directory `/usr/src/linux-headers-2.6.22-14-generic' 
shana@shana:~/linux_驱动开发$ 
shana@shana:~/linux_驱动开发$ ls -l 
总用量 124 
-rw-r--r-- 1 shana shana 303 2008-03-16 10:43 hello.c 
-rw-r--r-- 1 shana shana 49039 2008-03-16 12:11 hello.ko 
-rw-r--r-- 1 shana shana 687 2008-03-16 12:11 hello.mod.c 
-rw-r--r-- 1 shana shana 25840 2008-03-16 12:11 hello.mod.o 
-rw-r--r-- 1 shana shana 24360 2008-03-16 12:11 hello.o 
-rw-r--r-- 1 shana shana 8344 2008-03-16 09:17 linux_qudong_qu.txt 
-rw-r--r-- 1 shana shana 266 2008-03-16 12:09 Makefile 
-rw-r--r-- 1 shana shana 0 2008-03-16 12:11 Module.symvers 
shana@shana:~/linux_驱动开发$
然后加载模块 (超级用户)
root@shana:/home/shana/linux_驱动开发# insmod ./hello.ko
按照书上的例子 会在终端显示 hello , world 但是运行后什么都没有出现 (原因不解)
root@shana:/home/shana/linux_驱动开发# insmod ./hello.ko 
root@shana:/home/shana/linux_驱动开发# 
查看加载模块
root@shana:/home/shana/linux_驱动开发# lsmod 
Module Size Used by 
hello 2560 0 
已经加载上咯
删除模块
root@shana:/home/shana/linux_驱动开发# rmmod hello 
root@shana:/home/shana/linux_驱动开发# 
那程序的输出在那呢?书中说明 如果不出现在终端 则会写进 syslog 文件中
shana@shana:~/linux_驱动开发$ cat /var/log/syslog |grep world 
Mar 16 12:14:53 shana kernel: [ 5937.529297] Hello, world 
Mar 16 12:16:05 shana kernel: [ 6009.439036] Goodbye, cruel world 
shana@shana:~/linux_驱动开发$ 
至此 全部工作都完成了。是否对你有用呢?
