|
我程序:
#include <linux/init.h>
#include <linux/module.h>
static int hello_init(void)
{
printk(KERN_ALERT "HELLO WORD\n");
return 0;
}
static int hello_exit(void)
{
printk(KERN_ALERT "good bye!\n");
return 0;
}
module_init(hello_init);
module_exit(hello_exit);
我的makefile:
obj-m+=hello.o
[root@localhost temp]# make -C /usr/src/linux-2.4.20-8 SUBDIRS=`pwd` modules
make: Entering directory `/usr/src/linux-2.4.20-8'
make -r -f tmp_include_depends all
make[1]: Entering directory `/usr/src/linux-2.4.20-8'
make[1]: Circular /usr/src/linux-2.4.20-8/include/asm/smplock.h <- /usr/src/linu
x-2.4.20-8/include/linux/interrupt.h dependency dropped.
make[1]: Circular /usr/src/linux-2.4.20-8/include/linux/netfilter_ipv4/ip_conntr
ack.h <- /usr/src/linux-2.4.20-8/include/linux/netfilter_ipv4/ip_conntrack_helpe
r.h dependency dropped.
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/linux-2.4.20-8'
make -C /root/temp CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.20-8/include -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-
frame-pointer -pipe -mpreferred-stack-boundary=2 -march=i686 -DMODULE" MAKING_MO
DULES=1 modules
make[1]: Entering directory `/root/temp'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/root/temp'
make: *** [_mod_/root/temp] Error 2
make: Leaving directory `/usr/src/linux-2.4.20-8' |
|