About my own kernel module file compilation

Hi,

I installed Ubuntu on my Beagle Board xM RevC, and the kernel version is 3.0.4-x3.
I applied 'build_kernel.sh' which was downloaded from https://github.com/RobertCNelson/stable-kernel/blob/3.0.4-x3/build_kernel.sh
After execute it, I got the source code, headers and zImage.

Then I want to make my own kernel module.
aubuntu@omap:~/tom$ cat Makefile
obj-m := tom_test.o

The source code
ubuntu@omap:~/tom$ cat tom_test.c
...

Then with below command(1) the tom_test.ko could be generated.
make ARCH=arm CROSS_COMPILE= -C RobertCNelson-stable-kernel-2e4170d/KERNEL M=$(pwd) modules
...

But with below command(2) there is error.
make ARCH=arm CROSS_COMPILE= -C RobertCNelson-stable-kernel-2e4170d/deploy/headers/usr M=$(pwd) modules
make: Entering directory `/home/ubuntu/tom/RobertCNelson-stable-kernel-2e4170d/deploy/headers/usr'
make: *** No rule to make target `modules'. Stop.
make: Leaving directory `/home/ubuntu/tom/RobertCNelson-stable-kernel-2e4170d/deploy/headers/usr'

Why? I think this command(2) should be the right way to make kernel module. Because it uses the kernel headers while above command(1) uses all kernel source code.
Thanks!

BR, Tom

Tom,

have you tried this?

make ARCH=arm CROSS_COMPILE= -C RobertCNelson-stable-kernel-2e4170d/deploy/headers/ M=$(pwd) modules

Hi,

Thank you for your help!

The result is below.

make: Entering directory `/home/ubuntu/tom/RobertCNelson-stable-kernel-2e4170d/deploy/headers’

make: *** No rule to make target `modules’. Stop.

make: Leaving directory `/home/ubuntu/tom/RobertCNelson-stable-kernel-2e4170d/deploy/headers’

And I noticed that in the path RobertCNelson-stable-kernel-2e4170d/deploy/headers, there is no any Makefile.

While in my Ubuntu, N900 scratchbox, I can find some Makefile.

Is this the reason caused my errors? If so, why the Makefile disappear in RobertCNelson-stable-kernel-2e4170d/deploy/headers?

BR, Tom

While in my Ubuntu, N900 scratchbox, I can find some Makefile.

Is this the reason caused my errors?

yes, you need the Makefile to tell make what to do.

If so, why the Makefile disappear in RobertCNelson-stable-kernel-2e4170d/deploy/headers?

I’ve never used RNelson’s development tree before, so i would not know.

Thank you for your reply!

Let’s see who could give further explanation and solution?

BR, Tom

Why CROSS_COMPILE is empty?