"hello world" module wont compile

Same module install/works on FC6 machine.
here are the out puts.
I have installed
1-linux-kernel-header
2-kernel-source
3-kernel-syms
installed.

MAke file



champ@linux-r9za:~/driver> ls
Makefile  hello-1.c

champ@linux-r9za:~/driver> cat Makefile 

bj-m += hello-1.o

all:
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

clean:
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

Hello world module, it complie runs on my FC6 machine.


champ@linux-r9za:~/driver> 
champ@linux-r9za:~/driver> cat hello-1.c 
#include <linux/module.h>	/* Needed by all modules */
#include <linux/kernel.h>	/* Needed for KERN_INFO */

int init_module(void)
{
	printjkk(KERN_INFO "Hello world 1.
");

	/* 
	 * A non 0 return means init_module failed; module can't be loaded. 
	 */
	return 0;
}

{
void cleanup_module(void)
{
	printk(KERN_INFO "Goodbye world 1.
");
}

Build process:


 make
make -C /lib/modules/2.6.25.5-1.1-pae/build M=/home/champ modules
make[1]: Entering directory `/usr/src/linux-2.6.25.5-1.1-obj/i386/pae'
make[1]: *** No rule to make target `modules'.  Stop.
make[1]: Leaving directory `/usr/src/linux-2.6.25.5-1.1-obj/i386/pae'
make: *** [all] Error 2
champ@linux-i5hb:~&gt; 



I think I have every thing installed

p@linux-i5hb:~> rpm -qa | grep kernel
linux-kernel-headers-2.6.25-8.1
kernel-syms-2.6.25.11-0.1
kernel-pae-2.6.25.5-1.1
kernel-source-2.6.25.11-0.1
champ@linux-i5hb:~> 


Any Ideas?

Thanks.

Some initial observations:

From hello-1.c:
You have misspelled ‘printk’ as ‘printjkk’ in ‘init_module’,
this will cause an error.
You have an extra ‘{’ just prior to ‘void cleanup_module…’,
this will cause an error.
From Makefile:
You are missing the letter ‘o’ on the first line, this should
read ‘obj-m += hello-1.o’

I have fixed these errors to facilitate my testing.

After fixing the above errors, the module compiles cleanly.

Make those changes as noted, should work for you.

Loni


L R Nix
lornix@lornix.com

As an afterthought, your errors you posted reminded me of a recent experience
with a module…

You may need to either reinstall kernel-source (which would reset some
files and links needed) --OR-- execute the following: (as root)

cd /usr/src/linux
make cloneconfig
make
make modules_install
make install

and then reboot.

This will recreate some necessary links and file within the linux and
linux-obj directory structures needed to compile modules.

Loni


L R Nix
lornix@lornix.com

Thanks!
recompiling kernel solved the issue.

But new kernel have issue with ndiswrapper. After I install driver I do
#modprobe ndiswraper
It says driver module not found.

Any idea?

thanks.

On Sun, 17 Aug 2008 20:56:03 GMT
aveceena <aveceena@no-mx.forums.opensuse.org> wrote:

>
> Thanks!
> recompiling kernel solved the issue.
>
> But new kernel have issue with ndiswrapper. After I install driver I do
>
> #modprobe ndiswraper
> It says driver module not found.
>
> Any idea?
>
> thanks.
>
>

Well, you recompiled the kernel…

Did you recompile the ndiswrapper module?

They have to match… and old-kernel ndiswrapper doesn’t match new-kernel.

Yes, it’s that picky. (You can make it less picky… but I doubt you’ll
need to recompile the kernel any more)

Loni


L R Nix
lornix@lornix.com