CM-T3730: Android: Kernel

From Compulab Mediawiki
Revision as of 15:30, 9 October 2013 by Ilya (talk) (Bluetooth)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Linux kernel supplied with the CM-T3730 Android Demo package provides support for on-board peripherals and abstracts the functionality provided by the hardware. Current support coverage is specified at O/S support coverage map page. CompuLab provides ready-to-run binary kernel images, and source code of the modifications and additions made to the Linux kernel to work properly with CM-T3730 modules. The kernel binary is optimized for using with Android, however can be used with any Linux root filesystem as well.

Building kernel for CM-T3730

In this article we assume that the /home/development/cm-t3730/android directory is used for CM-T3730 kernel development.

Getting cross-compiler

The recommended pre-built toolchain repository is hosted on the Rowboat Gitorious website.

  • Clone the toolchain repository. By default it will be created in the directory named prebuilts-gcc-linux-x86-arm-arm-eabi-4_6/.
cd /home/development/cm-t3730/android
git clone -b rowboat-jb git://gitorious.org/rowboat/prebuilts-gcc-linux-x86-arm-arm-eabi-4_6.git

Getting kernel sources

The Rowboat Kernel sources repository is hosted on the Rowboat Gitorious website.

  • Clone the kernel sources repository. By default it will be created in the directory named kernel/.
cd /home/development/cm-t3730/android
git clone git://gitorious.org/rowboat/kernel.git
  • Create a branch for CM-T3730 development. The CM-T3730 patches are generated vs. rowboat-jb-am37x-4.1.2 tag (c83d5f31dd92832fd83db48c073d82546c23eeab commit) in the Rowboat kernel tree. It is recommended to use exactly the same baseline to avoid merge conflicts:
git checkout -b cm-t3730-dev rowboat-jb-am37x-4.1.2
  • Apply the CM-T3730 patch:
cd /home/development/cm-t3730/android/kernel
git apply /path/to/cm-t3730-android/kernel/linux-2.6.37-cm-t3730-3.patch

Building the kernel

  • Setup the toolchain
export PATH=/patch/to/cross/compiler/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6:$PATH
export ARCH=arm
export CROSS_COMPILE=arm-eabi-
  • Build the kernel
cd /home/development/cm-t3730/android/kernel
make cm_t3730_android_defconfig
make menuconfig
make uImage

In the example above, the Linux kernel image (uImage) will be created in /home/development/cm-t3730/android/kernel/arch/arm/boot directory.

Admolition note.png There is no need to build and install any kernel modules into the Android Demo image for CM-T3730, as all the kernel driver modules are compiled in the kernel binary.

Basic platform support

The CM-T3730 basic platform support is implemented in the arch/arm/mach-omap2/board-cm-t35.c file of Linux kernel source tree. This file includes default setup of multi-functional pins, registration of the devices integrated in the CM-T3530/CM-T3730 modules and definitions of platform-specific configuration for these devices.

Audio

The CM-T3730 uses the audio module of the TPS65930 PMIC for analog audio input and output. The audio module is interfaced to the main processor through the TDM / I2S interface and used to transmit and receive audio data. The audio codec is connected via Multi-Channel Buffered Serial Port (McBSP) interface.
The CM-T3730 audio support is based on the Overo SoC Audio driver sound/soc/omap/overo.c. To enable/disable it in the kernel configuration menu choose Device Drivers--->Sound card support--->Advanced Linux Sound Architecture--->ALSA for SoC audio support submenu. Then enable/disable the SoC Audio support for Gumstix Overo and CompuLab CM-T35/CM-T3730.

  ┌───────────────────────── ALSA for SoC audio support ──────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌───────────────────────────────────────────────────────────────────────────┐ │  
  │ │    --- ALSA for SoC audio support                                         │ │  
  │ │    <*>   SoC Audio for the Texas Instruments OMAP chips                   │ │  
  │ │    <*>   SoC Audio support for Gumstix Overo and CompuLab CM-T35/CM-T3730 │ │  
  │ │    < >   Build all ASoC CODEC drivers                                     │ │  
  │ │    <*>   WL1271 Bluetooth Codec support                                   │ │  
  │ │                                                                           │ │  
  │ └───────────────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘

Keypad

The matrix keypad is supplied with the CM-T3730 Evaluation Kit.
The default Linux Kernel keypad configuration is defined in the CM-T3530/CM-T3730 board file kernel/arch/arm/mach-omap2/board-cm-t35.c as follows:

static uint32_t cm_t35_keymap[] = {
	KEY(0, 0, KEY_A),	KEY(0, 1, KEY_B),	KEY(0, 2, KEY_LEFT),
	KEY(1, 0, KEY_UP),	KEY(1, 1, KEY_ENTER),	KEY(1, 2, KEY_DOWN),
	KEY(2, 0, KEY_RIGHT),	KEY(2, 1, KEY_C),	KEY(2, 2, KEY_D),
};

The keypad is supported by the TWL4030 Keypad driver kernel/drivers/input/keyboard/twl4030_keypad.c. To enable/disable it in the kernel configuration menu choose Device Drivers--->Input device support--->Keyboards submenu. Then enable/disable the TI TWL4030/TWL5030/TPS659x0 keypad support .

  ┌────────────────────────────────── Keyboards ──────────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌────^(-)───────────────────────────────────────────────────────────────────┐ │  
  │ │    < >   Newton keyboard                                                  │ │  
  │ │    < >   OpenCores Keyboard Controller                                    │ │  
  │ │    < >   Stowaway keyboard                                                │ │  
  │ │    < >   Sun Type 4 and Type 5 keyboard                                   │ │  
  │ │    <*>   TI TWL4030/TWL5030/TPS659x0 keypad support                       │ │  
  │ │    < >   XT keyboard                                                      │ │  
  │ └───────────────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘

USB Gadget

The CM-T3730 Android Demo image supports both USB host and USB device ports. USB host can be used to connect Keyboard/Mouse, Mass storage device, etc. The USB device port is used for adb and USB accessory gadgets.
To enable/disable USB Gadget support in the kernel configuration menu choose Device Drivers--->USB support--->USB Gadget Support submenu. Then enable/disable USB Gadget Drivers:

  ┌───────────────────────────── USB Gadget Support ──────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌───────────────────────────────────────────────────────────────────────────┐ │  
  │ │    --- USB Gadget Support                                                 │ │  
  │ │    [ ]   Debugging information files (DEVELOPMENT)                        │ │  
  │ │    [ ]   Debugging information files in debugfs (DEVELOPMENT)             │ │  
  │ │    (2)   Maximum VBUS Power usage (2-500 mA)                              │ │  
  │ │          USB Peripheral Controller (Inventra HDRC USB Peripheral (TI, ADI,│ │  
  │ │    <*>   USB Gadget Drivers (Android Gadget)  --->                        │ │  
  │ └───────────────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘

Finally choose Android Gadget option:

  ┌──────────────────────── USB Gadget Drivers ────────────────────────┐
  │  Use the arrow keys to navigate this window or press the hotkey of │  
  │  the item you wish to select followed by the <SPACE BAR>. Press    │  
  │  <?> for additional information about this option.                 │  
  │ ┌─────────^(-)───────────────────────────────────────────────────┐ │  
  │ │     ( ) File-backed Storage Gadget                             │ │  
  │ │     ( ) Mass Storage Gadget                                    │ │  
  │ │     ( ) Serial Gadget (with CDC ACM and CDC OBEX support)      │ │  
  │ │     ( ) MIDI Gadget (EXPERIMENTAL)                             │ │  
  │ │     ( ) Printer Gadget                                         │ │  
  │ │     (X) Android Gadget                                         │ │  
  │ └─────────v(+)───────────────────────────────────────────────────┘ │  
  ├────────────────────────────────────────────────────────────────────┤  
  │                       <Select>      < Help >                       │  
  └────────────────────────────────────────────────────────────────────┘

Wireless LAN

The CM-T3730 uses the TI WL1271 device. To enable/disable WLAN support in the kernel configuration menu choose Device Drivers--->Network device support submenu. Then enable/disable Wireless LAN:

  ┌─────────────────────────── Network device support ────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌────^(-)───────────────────────────────────────────────────────────────────┐ │  
  │ │    [*]   Ethernet (10000 Mbit)  --->                                      │ │  
  │ │    [*]   Wireless LAN  --->                                               │ │  
  │ │          *** Enable WiMAX (Networking options) to see the WiMAX drivers **│ │  
  │ │          USB Network Adapters  --->                                       │ │  
  │ │    [ ]   Wan interfaces support  --->                                     │ │  
  │ │          *** CAIF transport drivers ***                                   │ │  
  │ └────v(+)───────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘  

Additionally, in the kernel configuration menu choose Networking support--->Wireless submenu. Then enable/disable Wireless extensions sysfs files:

  ┌────────────────────────────────── Wireless ───────────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌────^(-)───────────────────────────────────────────────────────────────────┐ │  
  │ │    [*]   Wireless extensions sysfs files                                  │ │  
  │ │    < >   Common routines for IEEE802.11 drivers                           │ │  
  │ │    <M>   Generic IEEE 802.11 Networking Stack (mac80211)                  │ │  
  │ │    [ ]   PID controller based rate control algorithm                      │ │  
  │ │    [*]   Minstrel                                                         │ │  
  │ │    [*]     Minstrel 802.11n support                                       │ │  
  │ └────v(+)───────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘


The relevant initialization including the pin-muxing for MMC bus is done in the CM-T3730 board file. Please refer to the CM-T3530/CM-T3730 board file kernel/arch/arm/mach-omap2/board-cm-t35.c for more details.

Bluetooth

The CM-T3730 uses the Bluetooth module on the TI WL1271 device. To enable/disable Bluetooth support in the kernel configuration menu choose Device Drivers--->Misc devices--->Texas Instruments shared transport line discipline submenu. Then enable/disable Shared transport core driver.

  ┌───────────── Texas Instruments shared transport line discipline ──────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌───────────────────────────────────────────────────────────────────────────┐ │  
  │ │    <*> Shared transport core driver                                       │ │  
  │ │                                                                           │ │  
  │ │                                                                           │ │  
  │ └───────────────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘  

Additionally, in the kernel configuration menu choose Networking support submenu. Then enable/disable Bluetooth subsystem support:

  ┌───────────────────────────── Networking support ──────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌───────────────────────────────────────────────────────────────────────────┐ │  
  │ │    --- Networking support                                                 │ │  
  │ │          Networking options  --->                                         │ │  
  │ │    [ ]   Amateur Radio support  --->                                      │ │  
  │ │    < >   CAN bus subsystem support  --->                                  │ │  
  │ │    < >   IrDA (infrared) subsystem support  --->                          │ │  
  │ │    <*>   Bluetooth subsystem support  --->                                │ │  
  │ │    < >   RxRPC session sockets                                            │ │  
  │ │    -*-   Wireless  --->                                                   │ │  
  │ │    < >   WiMAX Wireless Broadband support  --->                           │ │  
  │ └────v(+)───────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘  

Next, for enabling Bluetooth support enter the Networking support--->Bluetooth subsystem support and choose the following configuration:

  ┌───────────────────────── Bluetooth subsystem support ─────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌───────────────────────────────────────────────────────────────────────────┐ │  
  │ │    --- Bluetooth subsystem support                                        │ │  
  │ │    <*>   L2CAP protocol support                                           │ │  
  │ │    <*>   SCO links support                                                │ │  
  │ │    <*>   RFCOMM protocol support                                          │ │  
  │ │    [*]     RFCOMM TTY support                                             │ │  
  │ │    <*>   BNEP protocol support                                            │ │  
  │ │    [*]     Multicast filter support                                       │ │  
  │ │    [*]     Protocol filter support                                        │ │  
  │ │    <*>   HIDP protocol support                                            │ │  
  │ │          Bluetooth device drivers  --->                                   │ │  
  │ └───────────────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘  

Eventually, in the Networking support--->Bluetooth subsystem support--->Bluetooth device drivers submenu enable HCI UART driver with UART (H4) protocol support and HCILL protocol support options:

  ┌────────────────────────── Bluetooth device drivers ───────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted   │  
  │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes   │  
  │  features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend:  │  
  │  [*] built-in  [ ] excluded  <M> module  < > module capable                   │  
  │ ┌────^(-)───────────────────────────────────────────────────────────────────┐ │  
  │ │    < > HCI SDIO driver                                                    │ │  
  │ │    <*> HCI UART driver                                                    │ │  
  │ │    [*]   UART (H4) protocol support                                       │ │  
  │ │    [ ]   BCSP protocol support                                            │ │  
  │ │    [ ]   Atheros AR300x serial support                                    │ │  
  │ │    [*]   HCILL protocol support                                           │ │  
  │ │    < > HCI BCM203x USB driver                                             │ │  
  │ └────v(+)───────────────────────────────────────────────────────────────────┘ │  
  ├───────────────────────────────────────────────────────────────────────────────┤  
  │                       <Select>    < Exit >    < Help >                        │  
  └───────────────────────────────────────────────────────────────────────────────┘  

See also