How to compile a kernel module to Android Linux Kernel


Last Updated:

  1. neutyz

    neutyz New Member This Topic's Starter

    Joined:
    Aug 3, 2009
    Messages:
    1
    Likes Received:
    0
    Hi,all!
    I'd like to compile a kernel module to Android Linux Kernel. But I donnot know how to build the Makefile for the module.
    Here is my Makefile,and /home/tyz/0728 is source code dir of android:
    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

    After make modules,I get nothing but errors :
    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

    what should I do ?Thanks!
     

    Advertisement

Share This Page

Loading...