|
我编写了一个hell.c 文件
如下:
#include<linux/kernel.h>
#include<linux/module.h>
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include<linux/modversions.h>
#endif
int init_module()
{
printk("Hello,word-this is the kernel speaking\n");
return 0;
}
void cleanup_module()
{
printk("Short is the life of a kernel module\n");
}
Makefile文件如下:
CC=gcc
MODCFLAGS:= -Wall -DMODULE -D__KERNEL__ -DLINUX
hello.o:hello.c /usr/include/linux/version.h
$(CC) $(MODCFLAGS) -c hello.c
echo insmod hello.o to turn it on
echo rmmod hello to turn if off
echo
echo X and kernel programming do not mix.
echo Do the insmod and rmmod from outside X.
放在/usr下面输入gcc -c hello.c错误如下:
/usr/include/linux/module.h:In function 'print_symbol';
/usr/include/linux/module.h:433:'ESRCH'undeclared
当输入gmake错误如下:
gmake:gcc-Wall:Command not found.
gmake:***[hello.o]error 127
谢谢了先!:help :help |
|