Add a Driver to Kernel by menuconfig

From ESS-WIKI
Revision as of 03:47, 28 September 2016 by Zhengguang.yang (talk | contribs) (Created page with "{{DISPLAYTITLE:Add a Driver to Kernel by menuconfig}} __TOC__ = Add a Driver to Kernel by menuconfig = You can add a driver to kernel by menuconfig. Here is an example to gui...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Add a Driver to Kernel by menuconfig

You can add a driver to kernel by menuconfig. Here is an example to guide you how to add a RTC driver (Seiko Instruments S-35390A) to Linux kernel. we still use the RSB-4220 as demo. Please refer to the following steps:

  • Open "Terminal" on Ubuntu host PC.
  • $ sudo su (Change to “root” authority)
  • Input user password.
  • # cd $(BSP)/scripts/
  • # source setenv.sh (To configure the developing environment automatically)
  • # ./cfg_kernel.sh am335x_rsb4220_defconfig
  • # ./cfg_kernel.sh menuconfig

Then you will see a GUI screen (Linux Kernel Configuration) as below: Menuconfig.png

  • Select “Device Drivers”->”Real Time Clock”, you will see an option “Seiko Instruments S-35390A” on the list. Choose this option then exit and save your configuration.

Menu2.png

  • Change directory to “source/linux-3.2.0-psp04.06.00.11/arch/arm/mach-omap2”, edit the “board-rsb4220.h” and “board-advantech.c”. Please add below codes to source/linux-3.2.0-psp04.06.00.11/arch/arm/mach-omap2/board-rsb4220.h :
/* I2C */
static struct i2c_board_info mxc_i2c0_board_info[] __initdata = {
{
I2C_BOARD_INFO("s35390a", 0x30),
},
}
  • Please add below codes to source/linux-3.2.0-psp04.06.00.11/arch/arm/mach-omap2/board-advantech.c:
omap_register_i2c_bus(1, 100, am335x_i2c0_boardinfo,
ARRAY_SIZE(am335x_i2c0_boardinfo));
  • Please refer to BSP Building Guide to rebuild the kernel with RTC driver (Seiko Instruments S-35390A) after completing above steps.