CM-T335: Android: Kernel

From Compulab Mediawiki
Jump to: navigation, search

Overview

Linux kernel supplied with the CM-T335 Android Demo package provides support for the on-board peripherals and abstracts the functionality provided by the hardware. Current support coverage is specified on the 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-T335 modules. The kernel binary is optimized for using with Android, however can be used with any Linux ARM compatible distribution as well.

Kernel command line

Kernel command line defines primary console, root device and other important parameters. Setting U-Boot bootargs environment variable determines kernel command line.

The recommended kernel command line parameters for booting from a NAND flash is as follows:

console=ttyO0,115200n8 androidboot.console=ttyO0 root=ubi0:rootfs rootfstype=ubifs ubi.mtd=rootfs,2048 rw rootwait init=/init ip=off

The recommended kernel command line parameters for booting from a micro SD card flash is as follows:

console=ttyO0,115200n8 androidboot.console=ttyO0 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait init=/init ip=off

Select video output

Default CM-T335 video output device is DVI. Other video output devices can be used as well.

  • LCD video output can be enabled by adding the following boot options to the kernel command line parameters:
cm_t335_disp=lcd
  • LVDS video output can be enabled by adding the following boot options to the kernel command line parameters:
cm_t335_disp=lvds

Building kernel for CM-T335

In this article we assume that the /home/development/cm-t335/android directory is used for CM-T335 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-t335/android
git clone -b rowboat-jb https://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-t335/android
git clone https://gitorious.org/rowboat/kernel.git
  • Create a branch for CM-T335 development. The CM-T335 patches are generated vs. rowboat-jb-am335x-4.1.2 tag (996686459db1181a5deaf5d493681ecb5bf43ad7 commit) in the Rowboat kernel tree. It is recommended to use exactly the same baseline to avoid merge conflicts:
git checkout -b cm-t335-dev rowboat-jb-am335x-4.1.2
  • Apply the CM-T335 patch:
cd /home/development/cm-t335/android/kernel
git apply /path/to/cm-t335-android/kernel/linux-3.2.0-cm-t335-3.1.patch


Admolition note.png If the Rowboat Android source repository hosted on the Rowboat Gitorious website is inaccessible download TI customized sources for Android JB 4.1.2 from the TI website.

Extract Android JB 4.1.2 sources by executing the downloaded binary in a terminal:

./TI-Android-JB-4.1.2_AM335x_4.0.1.bin
...

As a result a directory named TI-Android-JB-4.1.2_AM335x_4.0.1 is created. Copy TI-Android-JB-4.1.2_AM335x_4.0.1/kernel directory into /path/to/cm-t335-android/ directory:

cp -a TI-Android-JB-4.1.2_AM335x_4.0.1/kernel /path/to/cm-t335-android/

As TI customized sources for Android JB 4.1.2 downloaded from the TI website have no git repositories, use patch utility for applying CM-T335 patch:

cd /path/to/cm-t335-android/kernel
patch -p1 < /path/to/cm-t335-android/kernel/linux-3.2.0-cm-t335-3.1.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-t335/android/kernel
make cm_t335_android_defconfig
make menuconfig
make uImage

In the example above, the Linux kernel image (uImage) will be created in /home/development/cm-t335/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-T335, as all the kernel driver modules are compiled in the kernel binary.

Basic platform support

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

Analog Audio Support

In the kernel configuration menu choose Device Drivers ---> Sound card support ---> Advanced Linux Sound Architecture ---> ALSA for SoC audio support submenu and enable:

  • SoC Audio for the AM33XX chip
  • SoC Audio support for Compulab CM-T335
  ┌──────────────── 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: │
  │ ┌─────────────────────────────────────────────────────────┐ │
  │ │    --- ALSA for SoC audio support                       │ │
  │ │    [ ]   Support LZO compression for register caches    │ │
  │ │    <*>   SoC Audio for the AM33XX chip                  │ │
  │ │    < >   SoC Audio support for AM335X EVM               │ │
  │ │    <*>   SoC Audio support for Compulab CM-T335         │ │
  │ │    < >   SoC Audio for the Texas Instruments OMAP chips │ │
  │ │    < >   Build all ASoC CODEC drivers                   │ │
  │ └─────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────┤
  │              <Select>    < Exit >    < Help >               │
  └─────────────────────────────────────────────────────────────┘

Controller–area network (CAN) support

The CM-T335 features a TI DCAN Controller Area Network (DCAN), integrated into the Sitara AM335X SoC. The TI DCAN module supports bitrates up to 1 Mbit/s and is compliant to the CAN 2.0B protocol specification.

In the kernel configuration menu choose Networking support submenu and enable:

  • CAN bus subsystem support
  ┌───────────────────── CAN bus 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      │
  │ ┌─────────────────────────────────────────────────────────────────┐ │
  │ │    [ ]   Amateur Radio support  --->                            │ │  
  │ │    <*>   CAN bus subsystem support  --->                        │ │  
  │ │    < >   IrDA (infrared) subsystem support  --->                │ │  
  │ └─────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────┤
  │                  <Select>    < Exit >    < Help >                   │
  └─────────────────────────────────────────────────────────────────────┘

In the kernel configuration menu choose Networking support ---> CAN bus subsystem support submenu and enable CAN protocol support:

  • Raw CAN Protocol
  • Broadcast Manager CAN Protocol
  ┌───────────────────── CAN bus 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      │
  │ ┌─────────────────────────────────────────────────────────────────┐ │
  │ │    --- CAN bus subsystem support                                │ │
  │ │    <*>   Raw CAN Protocol (raw access with CAN-ID filtering)    │ │
  │ │    <*>   Broadcast Manager CAN Protocol (with content filtering)│ │
  │ │    < >   CAN Gateway/Router (with netlink configuration)        │ │
  │ │          CAN Device Drivers  --->                               │ │
  │ └─────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────┤
  │                  <Select>    < Exit >    < Help >                   │
  └─────────────────────────────────────────────────────────────────────┘

Next, in the kernel configuration menu choose Networking support ---> CAN bus subsystem support ---> CAN Device Drivers submenu and enable following options:

  • Platform CAN drivers with Netlink support
  • CAN bit-timing calculation
  • Bosch D_CAN devices
  ┌──────────────────────── CAN 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      │
  │ ┌─────────────────────────────────────────────────────────────────┐ │
  │ │    < > Virtual Local CAN Interface (vcan)                       │ │
  │ │    < > Serial / USB serial CAN Adaptors (slcan)                 │ │
  │ │    <*> Platform CAN drivers with Netlink support                │ │
  │ │    [*]   CAN bit-timing calculation                             │ │
  │ │    < >   TI High End CAN Controller                             │ │
  │ │    < >   Microchip MCP251x SPI CAN controllers                  │ │
  │ │    < > Philips/NXP SJA1000 devices  --->                        │ │
  │ │    < > Bosch C_CAN devices  --->                                │ │
  │ │    <*> Bosch D_CAN devices  --->                                │ │
  │ │        CAN USB interfaces  --->                                 │ │
  │ └────v(+)─────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────┤
  │                  <Select>    < Exit >    < Help >                   │
  └─────────────────────────────────────────────────────────────────────┘

Finally, in the kernel configuration menu choose Networking support ---> CAN bus subsystem support ---> CAN Device Drivers ---> Bosch D_CAN devices submenu and enable:

  • Generic Platform Bus based D_CAN driver
  ┌──────────────────────── Bosch D_CAN devices ────────────────────────┐
  │  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      │
  │ ┌─────────────────────────────────────────────────────────────────┐ │
  │ │    --- Bosch D_CAN devices                                      │ │
  │ │    <M>   Generic Platform Bus based D_CAN driver                │ │
  │ └─────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────┤
  │                  <Select>    < Exit >    < Help >                   │
  └─────────────────────────────────────────────────────────────────────┘

Touchscreen Support

In the kernel configuration menu choose Device Drivers ---> Input device support submenu and enable:

  • Touchscreens
  ┌─────────────────────── Input 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      │
  │ ┌────^(-)─────────────────────────────────────────────────────────┐ │
  │ │    [ ]   Joysticks/Gamepads  --->                               │ │
  │ │    [ ]   Tablets  --->                                          │ │
  │ │    [*]   Touchscreens  --->                                     │ │
  │ │    [*]   Miscellaneous devices  --->                            │ │
  │ │        Hardware I/O ports  --->                                 │ │
  │ └─────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────┤
  │                  <Select>    < Exit >    < Help >                   │
  └─────────────────────────────────────────────────────────────────────┘

Next, in the kernel configuration menu choose Device Drivers ---> Input device support ---> Touchscreens submenu and enable:

  • TI Touchscreen Interface
  ┌───────────────────────────── Touchscreens ──────────────────────────┐
  │  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      │  
  │ ┌────^(-)─────────────────────────────────────────────────────────┐ │  
  │ │    < >   Touchright serial touchscreen                          │ │  
  │ │    < >   Touchwin serial touchscreen                            │ │  
  │ │    <*>   TI Touchscreen Interface                               │ │  
  │ │    < >   USB Touchscreen Driver                                 │ │  
  │ │    < >   Sahara TouchIT-213 touchscreen                         │ │  
  │ └────v(+)─────────────────────────────────────────────────────────┘ │  
  ├─────────────────────────────────────────────────────────────────────┤  
  │                    <Select>    < Exit >    < Help >                 │  
  └─────────────────────────────────────────────────────────────────────┘  

Finally, in the kernel configuration menu choose Device Drivers ---> Multifunction device drivers submenu and enable

  • TI ADC / Touch Screen chip support
  ┌─────────────────── Multifunction 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      │
  │ ┌─────────────────────────────────────────────────────────────────┐ │
  │ │    < > TPS6507x Power Management / Touch Screen chips           │ │
  │ │    <*> TI ADC / Touch Screen chip support                       │ │
  │ │    < > TPS65217 Power Management / White LED chips              │ │
  │ │    [ ] TPS6586x Power Management chips                          │ │
  │ └────v(+)─────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────┤
  │                  <Select>    < Exit >    < Help >                   │
  └─────────────────────────────────────────────────────────────────────┘

USB Gadget

The CM-T335 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 connecting to a PC workstation.
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 messages (DEVELOPMENT)                                 │ │
  │ │    [ ]   Debugging information files (DEVELOPMENT)                        │ │
  │ │    [ ]   Debugging information files in debugfs (DEVELOPMENT)             │ │
  │ │    (2)   Maximum VBUS Power usage (2-500 mA)                              │ │
  │ │    (2)   Number of storage pipeline buffers                               │ │
  │ │    <*>   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 (DEPRECATED)                │ │  
  │ │     ( ) Mass Storage Gadget                                    │ │  
  │ │     ( ) Serial Gadget (with CDC ACM and CDC OBEX support)      │ │  
  │ │     ( ) MIDI Gadget (EXPERIMENTAL)                             │ │  
  │ │     ( ) Printer Gadget                                         │ │  
  │ │     (X) Android Gadget                                         │ │  
  │ └─────────v(+)───────────────────────────────────────────────────┘ │  
  ├────────────────────────────────────────────────────────────────────┤  
  │                       <Select>      < Help >                       │  
  └────────────────────────────────────────────────────────────────────┘  

WLAN and Bluetooth

CM-T335 has WLAN and Bluetooth support based on TI WL1271.

WLAN

In the kernel configuration menu choose Networking support ---> Wireless submenu and enable:

  • 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:   │
  │ ┌───────────────────────────────────────────────────────────┐ │
  │ │    [*]   Wireless extensions sysfs files                  │ │
  │ └────v(+)───────────────────────────────────────────────────┘ │
  ├───────────────────────────────────────────────────────────────┤
  │               <Select>    < Exit >    < Help >                │
  └───────────────────────────────────────────────────────────────┘

Next, in the kernel configuration menu choose Device Drivers ---> Network device support submenu and enable:

  • 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:   │
  │ ┌────^(-)───────────────────────────────────────────────────┐ │
  │ │          USB Network Adapters  --->                       │ │
  │ │    [*]   Wireless LAN  --->                               │ │
  │ │          *** Enable WiMAX (Networking options) to see the │ │
  │ └───────────────────────────────────────────────────────────┘ │
  ├───────────────────────────────────────────────────────────────┤
  │               <Select>    < Exit >    < Help >                │
  └───────────────────────────────────────────────────────────────┘

Bluetooth

In the kernel configuration menu choose Networking support ---> Bluetooth subsystem support submenu and enable following options:

  ┌───────────────── 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:   │
  │ ┌───────────────────────────────────────────────────────────┐ │
  │ │    --- 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 >                │
  └───────────────────────────────────────────────────────────────┘

Next, in the kernel configuration menu choose Networking support ---> Bluetooth subsystem support ---> Bluetooth device drivers submenu and enable following 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:   │
  │ ┌───────────────────────────────────────────────────────────┐ │
  │ │    < > HCI SDIO driver                                    │ │
  │ │    <*> HCI UART driver                                    │ │
  │ │    [*]   UART (H4) protocol support                       │ │
  │ │    [ ]   BCSP protocol support                            │ │
  │ │    [ ]   Atheros AR300x serial support                    │ │
  │ │    [*]   HCILL protocol support                           │ │
  │ │    < > HCI BCM203x USB driver                             │ │
  │ │    < > HCI BPA10x USB driver                              │ │
  │ │    < > HCI BlueFRITZ! USB driver                          │ │
  │ │    < > HCI VHCI (Virtual HCI device) driver               │ │
  │ │    < > Marvell Bluetooth driver support                   │ │
  │ │    <*> Texas Instruments WiLink7 driver                   │ │
  │ └───────────────────────────────────────────────────────────┘ │
  ├───────────────────────────────────────────────────────────────┤
  │               <Select>    < Exit >    < Help >                │
  └───────────────────────────────────────────────────────────────┘

Next, in the kernel configuration menu choose Device Drivers ---> Misc devices ---> Texas Instruments shared transport line discipline submenu and enable:

  • 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:   │
  │ ┌───────────────────────────────────────────────────────────┐ │
  │ │    <*> Shared transport core driver                       │ │
  │ └───────────────────────────────────────────────────────────┘ │
  ├───────────────────────────────────────────────────────────────┤
  │               <Select>    < Exit >    < Help >                │
  └───────────────────────────────────────────────────────────────┘

See also