Hello People, I am listing my problem here.
I have a Google Nexus one a.k.a. "passion" phone with me. Fastboot and adb tools are installed in the phone. And the boot loader is unlocked. My task: I have to add a linux kernel module to the Android kernel. What I have done: I followed the steps in http://source.android.com/source/initializing.html and downloaded the kernel for android-2.3.6_r1 (passion) and have built it. I am also able to flash it on the phone and the new android kernel also works fine. Now what I want is to modify the kernel and add my own kernel module and then flash it on the phone, so that the kernel on the phone is my modified kernel. Now I have come across two approaches to do this. 1) Cross Compile my kernel module with the android kernel and push it on the device with adb command. The Makefile I use in the kernel is as follows. VERSION = 2 PATCHLEVEL = 3 SUBLEVEL = 6 EXTRAVERSION = -00054-g5f01537 obj-m += hello-1.o KDIR=/home/apurva/android_dir PWD := $(shell pwd) all: make -C $(KDIR) ARCH=arm CROSS_COMPILE=/home/apurva/ android_dir/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- SUBDIRS=$(PWD) modules clean: make -C $(KDIR) ARCH=arm CROSS_COMPILE=/home/apurva/ android_dir/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- SUBDIRS=$(PWD) clean Now this is not able to generate new hello-1.ko. I do not know why, I guess there is some problem with the VERSION, PATCHLEVEL, SUBLEVEL and EXTRAVERSION values. Are these necessary? I tried these value from android-2.3.6_r1 also but still it does not work. I am not sure what is this EXTRAVERSION value? I even tried with the hello-1.ko generated from the compiler in my ubuntu. I pushed this hello-1.ko into the emulator with the following adb command. /root/bin/src/out/host/linux-x86/bin/adb shell mount /root/bin/src/out/host/linux-x86/bin/adb push hello-1.ko /data /root/bin/src/out/host/linux-x86/bin/adb insmod /data/hello-1.ko But that hello-1.ko is not able to insmod and I get the following error. insmod : Error in init_module() hello-1.ko function not implemented Whereas the hello-1.c is quite simple: /* * hello-1.c - The simplest kernel module. */ #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_INFO */ int init_module(void) { printk(KERN_INFO "Hello world 1.\n"); /* * A non 0 return means init_module failed; module can't be loaded. */ return 0; } void cleanup_module(void) { printk(KERN_INFO "Goodbye world 1.\n"); } 2) The second approach of doing this can be placing my source files of the kernel module in the kernel directory of android. May be in the system directory or somewhere else and ask the make to build these source files also along with the other source. But I am not sure where to ask the make process to do so. I tried to do so in main.mk and created a Android.mk file in the source directory of my source files but it did not work. May be this is a better solution but I could not find any help on this. After doing this, my kernel modules should be able to control the wnic (Wireless Network Interface device) of the android phone. It should be able to put the wnic in sleep mode and then wake it up after receiving command from my kernel module. If you have some pointers on how to do this, that will be a help. I have found that on Android it is controlled through wpa_supplicant private driver. Commands, like: wpa_cli driver powermode 0 - auto wpa_cli driver powermode 1 - active can do my task, but I am not sure since I have not tried. I have not reached that stage. Please look into this and provide some help/guidance. Thanks, Apurva Jaiswal -- unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel