[root@Ns lkm]# gcc -c -O3 helloworld.c
[root@Ns lkm]# /sbin/insmod helloworld.o
helloworld.o: kernel-module version mismatch
helloworld.o was compiled for kernel version 2.4.20
while this kernel is version 2.4.20-8.
[root@Ns lkm]#
kernel module compilation can not be done like that. search this forum to see some helloworld example. at least u need a make file or a long gcc command line with enough cflags.