scull 加载

[root@localhost scull]# make DEBUG=y
make -C /lib/modules/2.6.35.6-45.fc14.i686/build M=/opt/examples/scull LDDINC=/opt/examples/scull/../include modules
make[1]: Entering directory `/root/rpmbuild/BUILD/kernel-2.6.35.fc14/linux-2.6.35.i686'
  CC [M]  /opt/examples/scull/main.o
  CC [M]  /opt/examples/scull/pipe.o
  CC [M]  /opt/examples/scull/access.o
  LD [M]  /opt/examples/scull/scull.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /opt/examples/scull/scull.mod.o
  LD [M]  /opt/examples/scull/scull.ko
make[1]: Leaving directory `/root/rpmbuild/BUILD/kernel-2.6.35.fc14/linux-2.6.35.i686'
生成一个scull.ko
可以手动加载模块insmod scull.ko再去mknod,但不如用下面的脚本
加载
[root@localhost scull]# ./scull_load 
[root@localhost scull]# ll /dev/scull*
lrwxrwxrwx. 1 root root        6 Sep 12 13:43 /dev/scull -> scull0
crw-rw-r--. 1 root wheel 248,  0 Sep 12 13:43 /dev/scull0
crw-rw-r--. 1 root wheel 248,  1 Sep 12 13:43 /dev/scull1
crw-rw-r--. 1 root wheel 248,  2 Sep 12 13:43 /dev/scull2
crw-rw-r--. 1 root wheel 248,  3 Sep 12 13:43 /dev/scull3
lrwxrwxrwx. 1 root root       10 Sep 12 13:43 /dev/scullpipe -> scullpipe0
crw-rw-r--. 1 root wheel 248,  4 Sep 12 13:43 /dev/scullpipe0
crw-rw-r--. 1 root wheel 248,  5 Sep 12 13:43 /dev/scullpipe1
crw-rw-r--. 1 root wheel 248,  6 Sep 12 13:43 /dev/scullpipe2
crw-rw-r--. 1 root wheel 248,  7 Sep 12 13:43 /dev/scullpipe3
crw-rw-r--. 1 root wheel 248, 11 Sep 12 13:43 /dev/scullpriv
crw-rw-r--. 1 root wheel 248,  8 Sep 12 13:43 /dev/scullsingle
crw-rw-r--. 1 root wheel 248,  9 Sep 12 13:43 /dev/sculluid
crw-rw-r--. 1 root wheel 248, 10 Sep 12 13:43 /dev/scullwuid
[root@localhost scull]# ./scull_unload 
[root@localhost scull]# ll /dev/scull*
ls: cannot access /dev/scull*: No such file or directory
或者
[root@localhost scull]# ./scull.init  start
Loading scull (loading file ./scull.ko).
[root@localhost scull]# ll /dev/scull*
crw-r--r--. 1 root root 248,  0 Sep 12 13:41 /dev/scull0
crw-r--r--. 1 root root 248,  1 Sep 12 13:41 /dev/scull1
crw-r--r--. 1 root root 248,  2 Sep 12 13:41 /dev/scull2
crw-r--r--. 1 root root 248,  3 Sep 12 13:41 /dev/scull3
crw-r--r--. 1 root root 248, 32 Sep 12 13:41 /dev/scullpipe0
crw-r--r--. 1 root root 248, 33 Sep 12 13:41 /dev/scullpipe1
crw-r--r--. 1 root root 248, 34 Sep 12 13:41 /dev/scullpipe2
crw-r--r--. 1 root root 248, 35 Sep 12 13:41 /dev/scullpipe3
crw-r--r--. 1 root root 248, 16 Sep 12 13:41 /dev/scullpriv
crw-r--r--. 1 root root 248, 48 Sep 12 13:41 /dev/scullsingle
crw-r--r--. 1 root root 248, 64 Sep 12 13:41 /dev/sculluid
crw-r--r--. 1 root root 248, 80 Sep 12 13:41 /dev/scullwuid
[root@localhost scull]# ./scull.init  stop
Unloading scull.
[root@localhost scull]# ls /dev/scull*
ls: cannot access /dev/scull*: No such file or directory
另外
[root@localhost scull]# cat /proc/devices 
Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
  6 lp
  7 vcs
 10 misc
 13 input
 14 sound
 21 sg
 29 fb
 68 capi20
 99 ppdev
116 alsa
128 ptm
136 pts
162 raw
180 usb
189 usb_device
202 cpu/msr
203 cpu/cpuid
248 scull
248 scullp
248 sculla
249 capi
250 vmci
251 hidraw
252 usbmon
253 bsg
254 rtc

[root@localhost scull]# ll /proc/scull*
-r--r--r--. 1 root root 0 Sep 12 14:00 /proc/scullmem
-r--r--r--. 1 root root 0 Sep 12 14:00 /proc/scullpipe
-r--r--r--. 1 root root 0 Sep 12 14:00 /proc/scullseq



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值