Search code examples
androidlinux-device-driverkernelandroid-source

Reference for installing driver in android source code


I have android source code with kernel. i want to add or remove driver in source code . Like adding camera drive,BT(bluetooth) device driver in source code and make the code. Where to start from . Some one guide me.


Solution

  • Well AFAIK there are two things you need to decide here.

    1. Where should you place the driver code in the source tree:
      Taking Camera driver for eg. The driver code may be placed in drivers/media/video/ for instance. (The qualcomm chipset that I work on places it at drivers/media/video/msm/ folder in the source). There is another thing to keep in mind here. There could be a need to place Camera related code in board files as well.
    2. Select the config that is meant for drivers and build the kernel Here you need to edit the config file related to your device (under arch/arm/configs/). Select the config option related to your driver by equating it to "y" or "m" like this:

    CONFIG_CAMERA_XXX=y //just an example. pick the right config option for your driver

    This way your camera driver will be part of the kernel image. Else you can also set it "=m" and compile it as a module that you may insert/remove at runtime.