AnsweredAssumed Answered

Custom driver not building with the package

Question asked by chandra sekhar on Jul 25, 2016
Latest reply on Aug 19, 2016 by chandra sekhar

I am writing my own driver for switches for IMX6ulEVK. I followed the below steps while writing the driver

  1. 1. Create a directory like my_drvr inside drivers(which is in the Linux source code) for your driver and put your driver (my_driver.c) file inside this directory. It will looks like /linux_source_code/drivers/my_drvr/my_driver.c
  2. 2. Create one Makefile inside your driver directory (using vi any editor) and inside this put obj-$(CONFIG_MY_DRIVER) += my_driver.o and save this file. This will appears like /linux_source_code/drivers/my_drvr/Makefile
  3. 3. Create one Kconfig file inside your driver directory (using vi any editor) and inside this put
  4. 4.  config MY_DRIVER
  5. 5.  tristate "my driver" //gives your driver description like vendor name etc.
  6. 6.  depends on ARM
  7. 7.  default y if ARM
  8. 8.  help

  my driver module.

  1. 9. Save this file, this will appears like /linux_source_code/drivers/my_drvr/Kconfig
  2. 10. Add both Makefile and Kconfig file in the Linux source drivers Makefile and Kconfig file which are at /linux_source_code/drivers/Makefile and /linux_source_code/drivers/Kconfig
  3. 11. In the Makefile add below in last line

obj-y += my_drvr/

or

obj-$(CONFIG_MY_DRIVER)   += my_drvr/

  1. 12. In Kconfig file add below in last line

source "drivers/my_drvr/Kconfig"

  1. 13. Finally have to add Kconfig file into architecture specific config file which will be at kernel_source/arch/arm/configs/--defconfig in this add below line in the last

CONFIG_MY_DRIVER=y

After compiling the kernel using bitbake linux-imx i am able to see my driver gopt compiled and .ko file is generated. But it is not included in the sdcard package. Is there anything I need to do additionally other than the above steps. I am using bitbake core-image-base for 3.14.38 bsp version

Outcomes