|
|

楼主 |
发表于 2006-4-1 11:05:05
|
显示全部楼层
Post by rickxbx
try 'whereis insmod' to find the insmod command and use the full path of insmod to execute it 谢谢,现在可以加载了!但不知道为什么没有输出啊?
[root@localhost program]# whereis insmod
insmod: /sbin/insmod.static /sbin/insmod /usr/share/man/man8/insmod.8.gz
[root@localhost program]# /sbin/insmod ./hello.ko
查看加载的模块时,能看到hello模块
[root@localhost program]# /sbin/lsmod
Module Size Used by
hello 1664 0
parport_pc 28268 1
lp 13504 0
parport 37704 2 parport_pc,lp
autofs4 20228 2
rfcomm 38804 0
l2cap 25984 5 rfcomm
bluetooth 50020 4 rfcomm,l2cap
sunrpc 153636 1
dm_mod 56724 0
video 15492 0
button 6800 0
battery 9604 0
ac 5124 0
ipv6 260288 16
uhci_hcd 33296 0
shpchp 48192 0
i2c_viapro 9236 0
i2c_core 22272 1 i2c_viapro
snd_via82xx 28824 1
gameport 16008 1 snd_via82xx
snd_ac97_codec 93088 1 snd_via82xx
snd_ac97_bus 2688 1 snd_ac97_codec
snd_seq_dummy 4100 0
snd_seq_oss 33508 0
snd_seq_midi_event 7680 1 snd_seq_oss
snd_seq 53068 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_pcm_oss 51872 0
snd_mixer_oss 18688 1 snd_pcm_oss
snd_pcm 89732 3 snd_via82xx,snd_ac97_codec,snd_pcm_oss
snd_timer 24964 2 snd_seq,snd_pcm
snd_page_alloc 11144 2 snd_via82xx,snd_pcm
snd_mpu401_uart 8448 1 snd_via82xx
snd_rawmidi 26144 1 snd_mpu401_uart
snd_seq_device 9484 4 snd_seq_dummy,snd_seq_oss,snd_seq,snd_rawmidi
snd 54496 13 snd_via82xx,snd_ac97_codec,snd_seq_oss,snd_seq,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer,snd_mpu401_uart,snd_rawmidi,snd_seq_device
soundcore 10080 1 snd
8139too 27776 0
mii 6144 1 8139too
floppy 65340 0
ext3 134408 1
jbd 59284 1 ext3
注:hello.c的内容如下:
#include <linux/module.h>
#include <linux/init.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "hello,world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye\n");
}
module_init(hello_init);
module_exit(hello_exit);
怎么能看到输出啊 请指教谢谢 |
|