The same Makefile succeeded in Ubuntu 10.04 LTS but failed in Angstrom on Beagle Board
I tried to compile chardev.c
from this tutorial using the following Makefile
:
obj-m := chardev.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default :
$(MAKE) -C $(KDIR) M=$(PWD) modules
I got the correct output and it is working fine while I make
in Ubuntu 10.04 LTC:
make -C /lib/modules/2.6.32-33-generic-pae/build M=/home/noge/Desktop/driver- tutorial/IOCTL_example/ioctl_eclipse modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-33-generic-pae'
Building modules, stage 2.
MODPOST 1 modules
LD [M] /home/noge/Desktop/driver-tutorial/IOCTL_example/ioctl_eclipse/chardev.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-33-generic-pae'
However, when I transfer the same files to BeagleBoard that is running Angstrom, and did a make CROSS_COMPILE=arm-angstrom-linux-gnueabi-
, I got the following error:
root@beagleboard:~/Desktop/noge/C-tutorials/hello_world# make CROSS_COMPILE=
arm-angstrom-linux-gnueabi-
make -C /lib/modules/2.6.32/build M=/home/root/Desktop/noge/C-tutorials/hels
make[1]: Entering directory `/usr/src/linux-2.6.32/2.6_kernel'
Makefile:1448: *** mixed implicit and normal rules. Stop.
make[1]: Leaving directory `/usr/src/linux-2.6.32/2.6_kernel'
make: *** [default] Error 2
I'm not sure if this is the cause, but I noticed the version of make
is different for the Ubuntu and Angstrom:
Angstrom's version:
GNU Make 3.82
Built for arm-angstrom-linux-gnueabi
Ubuntu's version:
GNU Make 3.81
This program built for i486-pc-linux-gnu
In short, why the error while doing make
in Beagle Board running Anstrom?
Thanks for any help..!
Update: The content of the Makefile near line 1448:
1447 # Modules
1448 / %/: prepare scripts FORCE
1449 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1450 $(build)=$(build-dir)
1451 %.ko: prepare scripts FORCE
1452 $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
1453 $(build)=$(build-dir) $(@:.ko=.o)
1454 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
I did a check on my kernel version and I got:Linux beagleboard 2.6.32 #3 PREEMPT Thu Jun 23 09:56:19 CEST 2011 armv7l GNU/Linux
, but the kernel source I got from here is of version 2.6.22.18
.
Is it possible for get开发者_开发技巧ting the wrong kernel source code that is causing this ?
I'm fairly sure your Makefile is not at fault here, but there might be a rule name collision. What is at line 1448 of /usr/src/linux-2.6.32/2.6_kernel/Makefile ?
精彩评论