Home > MOD and HACK > How to compile Android Device Driver as a Module(.ko)

How to compile Android Device Driver as a Module(.ko)

Here are the quick steps to be followed.

Prerequisite:
1. kernel sources from vendor say HTC wildfire(2.1 update-1)
2. Android source code for Éclair
3. Create a new folder called Kernel and copy the contents from the sources download via vendor

Step1: Copy config.gz from running hardware

adb pull /proc/config.gz
gunzip config.gz
mv config .config

Step 2: Copy/Overwrite the .config file to the kenel root directory

open .config file and search for
CONFIG_MODULE_NAME1=y
CONFIG_MODULE_NAME2=y

and replace ‘y’ with ‘m’, we use CONFIG_MODULE_NAME1 as module

CONFIG_MODULE_NAME1=m
CONFIG_MODULE_NAME2=y

Step 3: Check the active kernel version on the hardware using ‘OR’ if you are using own Boot.img then skip this and move on to step 4:

adb shell
# uname -a

or you may get the details of the kernel from the Settings->Aboutphone->SoftwareInformation: Kernel version

2.6.29-6fb59e13 HTC-kernel@xxxxxxxx

open Makefile in the kernel folder, search and replace “EXTRAVERSION =” with “EXTRAVERSION =-6fb59e13

Step 4: Set the Env variables

export ARCH=arm
exprot CROSS_COMPILE=arm-eabi-
export PATH=$PATH:~/eclair/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/

now perform make modules for make from the kernel sources

kernel:$ make modules or make

after successful compilation, check out the .ko files next to the sources in the same directory

Complete example: How to get LG headset sources compile in to kernel module(.ko)

Advertisements
Categories: MOD and HACK
  1. December 28, 2010 at 3:18 pm

    […] me of follow-up comments via email. Notify me of new posts via email. How to compile Android Device Driver as a Module(.ko) Android – Accessing Input device “msm_pcm_in” from User space […]

  2. April 24, 2011 at 5:14 pm

    pimples are really annoying, you can kill them using benzoyl peroxide but it will also make your skin red.cialis online

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: