CM-T335: Linux: Kernel

From Compulab Mediawiki
Revision as of 16:38, 13 December 2015 by Urim (talk)
Jump to: navigation, search

Overview

Linux kernel for the CompuLab CM-T335 System-on-Module / Computer-on-Module 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-T335 modules.

Kernel command line

The Linux kernel for CM-T335 is shipped with built-in command line parameters:

console=ttyO0,115200n8 root=ubi0:rootfs rw rootfstype=ubifs ubi.mtd=rootfs

The default kernel command line defines primary console and root device.

Setting U-Boot bootargs environment variable overrides default kernel command line and can be used to set desired kernel parameters.

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

Cross-Compiler

There are several options for cross-compilation toolchain setup. You can either compile your cross-compiler or use an already built cross-compiler. The cross-compiler should support the ARM embedded-application binary interface ("EABI")

U-Boot mkimage tool

U-Boot mkimage utility is required in order to create kernel images that can be loaded by the CM-T335 bootloader. You can download prebuilt mkimage binary or build it yourself:

mkdir ~/tmp
cd tmp
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
tar -xjvf u-boot-latest.tar.bz2
cd u-boot-20xx.xx
touch include/config.{h,mk}
make tools
sudo install tools/mkimage /usr/local/bin

Getting kernel sources

There are two ways to get Linux kernel sources that can be used as a baseline for CM-T335 kernel. You can create a copy of Linux Integration/Staging git tree for AM33x SoC maintained by Arago Project or download a snapshot and extract it. We assume that you have created /home/development/cm-t335/kernel directory for CM-T335 kernel development.

Snapshot download

  • Download v3.2-staging snapshot with your web browser.
  • Extract the downloaded archive linux-am33x-refs_heads_v3.2-staging.tar.gz
cd /home/development/cm-t335/kernel
tar xvf /path/to/downloaded/linux-am33x-refs_heads_v3.2-staging.tar.gz
mv linux-am33x linux-cm-t335
This will create /home/development/cm-t335/kernel/linux-cm-t335 directory containing linux kernel tree.
  • Apply the CM-T335 patch
cd /home/development/cm-t335/kernel/linux-cm-t335
patch -p1 < /path/to/cm-t335-linux/kernel/linux-3.2.0-cm-t335-4.4.patch

Git clone

  • Install git version control system.
  • Create a clone of linux kernel tree
cd /home/development/cm-t335/kernel
git clone git://arago-project.org/git/projects/linux-am33x.git linux-cm-t335
  • Create a branch for CM-T335 development. The CM-T335 patches are generated vs. b81bf04091986fa3893f31955564594567be3b61 commit in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
git checkout -b cm-t335-dev b81bf04091986fa3893f31955564594567be3b61
  • Apply the CM-T335 patch
cd /home/development/cm-t335/kernel/linux-cm-t335
git apply /path/to/cm-t335-linux/kernel/linux-3.2.0-cm-t335-4.4.patch

Getting Power Management Firmware

  • Download the firmware from Texas Instruments AM335x PSP
  • Copy the firmware to the kernel source tree
cp /path/to/downloaded/bin-am335x-pm-firmware.bin /home/development/cm-t335/kernel/linux-cm-t335/firmware/am335x-pm-firmware.bin

Building the kernel

export ARCH=arm
export CROSS_COMPILE=arm-none-linux-eabi-
make cm_t335_defconfig
make menuconfig
make && make uImage && \
     INSTALL_MOD_PATH=/home/development/cm-t335/rootfs make modules_install

In the example above, the Linux kernel image (uImage) will be created in /home/development/cm-t335/kernel/linux-cm-t335/arch/arm/boot, and the loadable kernel modules will be installed into the /home/development/cm-t335/rootfs/lib/modules directory.

When the CM-T335 is booted with the kernel image created as described above and with networked root filesystem at /home/development/cm-t335/rootfs/, the system will be able to load the kernel modules properly, thus avoiding module version problems.

Basic platform support

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

You can choose to either build it into the kernel or to compile it as a module named can-raw and can-bcm respectively.

  ┌───────────────────── 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 (built into the kernel or as a module named can-dev)
  • CAN bit-timing calculation
  • Bosch D_CAN devices (built into the kernel or as a module named d_can)
  ┌──────────────────────── 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 (built into the kernel or as a module named d_can_platform).
  ┌──────────────────────── 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 >                   │
  └─────────────────────────────────────────────────────────────────────┘

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 following options:

  • cfg80211
  • Common routines for IEEE802.11 drivers
  • mac80211
  ┌────────────────────────── 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                                           │ │
  │ │    <M>   cfg80211 - wireless configuration API            │ │
  │ │    [ ]     nl80211 testmode command                       │ │
  │ │    [ ]     enable developer warnings                      │ │
  │ │    [ ]     cfg80211 regulatory debugging                  │ │
  │ │    [*]     enable powersave by default                    │ │
  │ │    [ ]     cfg80211 DebugFS entries                       │ │
  │ │    [*]     cfg80211 wireless extensions compatibility     │ │
  │ │    [*]   Wireless extensions sysfs files                  │ │
  │ │    <M>   Common routines for IEEE802.11 drivers           │ │
  │ │    [ ]   lib80211 debugging messages                      │ │
  │ │    <M>   Generic IEEE 802.11 Networking Stack (mac80211)  │ │
  │ │          Default rate control algorithm (Minstrel)  --->  │ │
  │ └────v(+)───────────────────────────────────────────────────┘ │
  ├───────────────────────────────────────────────────────────────┤
  │               <Select>    < Exit >    < Help >                │
  └───────────────────────────────────────────────────────────────┘

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

  • TI wl12xx driver support
  ┌──────────────────────── Wireless LAN ─────────────────────────┐
  │  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:   │
  │ ┌────^(-)───────────────────────────────────────────────────┐ │
  │ │    < >   Realtek RTL8192CU/RTL8188CU USB Wireless Network │ │
  │ │    < >   TI wl1251 driver support  --->                   │ │
  │ │    <M>   TI wl12xx driver support  --->                   │ │
  │ │    < >   ZyDAS ZD1211/ZD1211B USB-wireless support        │ │
  │ └───────────────────────────────────────────────────────────┘ │
  ├───────────────────────────────────────────────────────────────┤
  │               <Select>    < Exit >    < Help >                │
  └───────────────────────────────────────────────────────────────┘

Finally, in the kernel configuration menu Device Drivers ---> Network device support ---> Wireless LAN ---> TI wl12xx driver support submenu enable:

  • TI wl12xx support
  • TI wl12xx SPI support
  ┌────────────────── TI wl12xx driver 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:   │
  │ ┌───────────────────────────────────────────────────────────┐ │
  │ │    --- TI wl12xx driver support                           │ │
  │ │    <M>   TI wl12xx support                                │ │
  │ │    <M>     TI wl12xx SPI support                          │ │
  │ │    < >     TI wl12xx SDIO support                         │ │
  │ └───────────────────────────────────────────────────────────┘ │
  ├───────────────────────────────────────────────────────────────┤
  │               <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                                │ │
  │ │    <M>   RFCOMM protocol support                          │ │
  │ │    [*]     RFCOMM TTY support                             │ │
  │ │    <M>   BNEP protocol support                            │ │
  │ │    [*]     Multicast filter support                       │ │
  │ │    [*]     Protocol filter support                        │ │
  │ │    <M>   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 USB driver                                     │ │
  │ │    < > HCI SDIO driver                                    │ │
  │ │    <M> 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                          │ │
  │ └────v(+)───────────────────────────────────────────────────┘ │
  ├───────────────────────────────────────────────────────────────┤
  │               <Select>    < Exit >    < Help >                │
  └───────────────────────────────────────────────────────────────┘

See also