On Aug 3, 8:21 am, 永振 田 <[email protected]> wrote:
> Hi,all!
> I'd like to compile a kernel module to Android Linux Kernel,but I have
> no idea how to write the Makefile for the kernel module.
> Here is my Makefile(just like pc):
>
>    obj-m= test_k.o
>    KERNELDIR= /home/tyz/0728/kernel/
>    CROSS_COMPILE= /home/tyz/0728/prebuilt/linux-x86/toolchain/arm-
> eabi-4.2.1/bin/arm-eabi-
>    CC= $(CROSS_COMPILE)gcc
>    PWD= $(shell pwd)
> modules:
>         $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
>
> modules_install:
>         $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
> clean:
>             rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
>             rm Module.symvers
>
> when make modules,the Makefile do nothing but list errors as follows:
> t...@debian:~/NetBeansProjects/test3GNetlink$ make modules
> make -C /home/tyz/0728/kernel/  M=/home/tyz/NetBeansProjects/
> test3GNetlink modules
> make[1]: Entering directory `/home/tyz/0728/kernel'
>
>   ERROR: Kernel configuration is invalid.
>          include/linux/autoconf.h or include/config/auto.conf are
> missing.
>          Run 'make oldconfig && make prepare' on kernel src to fix it.
>
>   WARNING: Symbol version dump /home/tyz/0728/kernel/Module.symvers
>            is missing; modules will have no dependencies and
> modversions.
>
>   CC [M]  /home/tyz/NetBeansProjects/test3GNetlink/test_k.o
> cc1: error: unrecognized command line option "-m64"
> cc1: error: unrecognized command line option "-mno-red-zone"
> cc1: error: unrecognized command line option "-mcmodel=kernel"
> cc1: error: unrecognized command line option "-maccumulate-outgoing-
> args"
> cc1: error: unrecognized command line option "-mno-sse"
> cc1: error: unrecognized command line option "-mno-mmx"
> cc1: error: unrecognized command line option "-mno-sse2"
> cc1: error: unrecognized command line option "-mno-3dnow"
> make[2]: *** [/home/tyz/NetBeansProjects/test3GNetlink/test_k.o] error
> 1
> make[1]: *** [_module_/home/tyz/NetBeansProjects/test3GNetlink] error
> 2
> make[1]: Leaving directory `/home/tyz/0728/kernel'
> make: *** [modules] error 2

Why do you have to write a Makefile for the compiling the kernel, it
is already there in kernel sources. So go there and just do a "make"
after setting the cross-compiler option.
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [email protected]
website: http://groups.google.com/group/android-kernel
-~----------~----~----~----~------~----~------~--~---

Reply via email to