Android ndk kernel module compile in windows

i would like to compile android lkm. my compile environment is windows. i saw many other tips for compile in linux, but no tips for windows. how could i set android.mk files ?

KERNELDIR = /lib/modules/$(shell    uname   -r)/build

obj-m   := sample.o

KDIR    :=  /lib/modules/$(shell    uname   -r)/build
PWD :=  $(shell pwd)

default:
    $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
    rm  -rf *.ko
    rm  -rf *.mod.*
    rm  -rf .*.cmd
    rm  -rf *.o
    rm  -rf .tmp_versions

Answers


In order to compile LKM, you need:

  1. Linux environment (necessary, I recommend you to at least have Linux in a VirtualBox)
  2. Android's linux kernel source code (same version with your target ROM or else later on you will have problem with Version Magic). In my case, I got HTC Nexus one with CyanogenMod 7.2, so my kernel is 2.6.37.6-cyanogenmod
  3. A GCC that was used with your kernel source code. In my case, it is Sourcery Mentor's GCC

You can check my previous question here Unable to compile LKM for Android I provided steps and procedures to compile the LKM


They say you only can build Android source code under Linux http://source.android.com/source/initializing.html

If you went as far as recompiling the android source it would be better to have Linux

I wouldn't recommend using Cygwin, you can surely use Oracle VM Box but then why do you need Windows anyway


Need Your Help

How do I automatically export a WAR after Java build in Eclipse?

java eclipse deployment war

I have a J2EE project in Eclipse 3.2 and at the end of every build I want to automatically create and deploy a WAR file. At the moment I have to do this by hand which is 5 or 6 mouse-cliks and it ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.