cannot generate .ko file on my linux, although it can generate module.symvers.
But when I copy .c file and Makefile to another linux computer, there's no problem.
The strange thing is: make is successfuly executed, and returned 0;
make output:
make -C /lib/modules/2.6.18-92.el5xen/build
M=/home/ye modules
make[1]: Entering directory `/usr/src/kernels/2.6.18-92.el5-xen-i686'
Building modules, stage 2.
MODPOST
make[1]: Leaving directory `/usr/src/kernels/2.6.18-92.el5-xen-i686'
system: RHEL5
Makefile:
1 ifneq ($(KERNELRELEASE),)
2 obj-m:=hello.o
3 else
4 KDIR:=/lib/modules/$(shell uname -r)/build
5 PWD:=$(shell pwd)
6 default:
7 $(MAKE) -C $(KDIR) M=$(PWD) modules
8 clean:
9 $(MAKE) -C $(KDIR) M=$(PWD) clean
10 endif
hello.c
1 #include<linux/init.h>
2 #include<linux/module.h>
3 #include<linux/moduleparam.h>
4
5 MODULE_LICENSE("GPL");
6
7 static char *my_string = "parameter";
8 static int my_int = 1;
9
10 module_param(my_string,charp,S_IRUGO);
11 module_param(my_int,int,S_IRUGO);
12
13
14 static int hello_init(void){
15
16
17
18 printk(KERN_ALERT "%s %d\n",my_string,my_int);
19 return 0;
20 }
21
22 static void hello_exit(void){
23 printk(KERN_ALERT "goodbye\n");
24 }
25
26 module_init(hello_init);
27 module_exit(hello_exit);