CM-T335: Android: Kernel

From Compulab Mediawiki
Revision as of 11:27, 26 December 2013 by Ilya (talk) (Getting kernel sources)
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.

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 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-t335/android
git clone git://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-2.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.

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

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

See also