Difference between revisions of "CM-T3517: Linux: Kernel"

From Compulab Mediawiki
Jump to: navigation, search
(See also)
(Kernel command line)
Line 4: Line 4:
 
== Kernel command line ==
 
== Kernel command line ==
 
The Linux kernel for CM-T3517 is shipped with built-in command line parameters:
 
The Linux kernel for CM-T3517 is shipped with built-in command line parameters:
  ubi.mtd=fs,2048 root=ubi0:rootfs rootfstype=ubifs console=ttyS2,115200 \
+
  ubi.mtd=rootfs,2048 root=ubi0:rootfs rootfstype=ubifs console=ttyS2,115200 \
 
  omapfb.mode=dvi:1024x768-24@60 omapfb.vram=1:4M vram=8M omapdss.def_disp=lcd
 
  omapfb.mode=dvi:1024x768-24@60 omapfb.vram=1:4M vram=8M omapdss.def_disp=lcd
  

Revision as of 14:27, 10 July 2011

Overview

Linux kernel for CM-T3517 modules 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-T3517 modules.

Kernel command line

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

ubi.mtd=rootfs,2048 root=ubi0:rootfs rootfstype=ubifs console=ttyS2,115200 \
omapfb.mode=dvi:1024x768-24@60 omapfb.vram=1:4M vram=8M omapdss.def_disp=lcd

The default kernel command line defines primary console, default display settings, root device and root filesystem type.

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

Building kernel for CM-T3517

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")

  • Pre-built toolchain:
  • Tools for creating cross-compilers:
    • Crosstool-ng: Builds a cross-compiler from source. Non-distribution specific.
    • Crossdev: Gentoo's cross-compiler builder. Needs Gentoo.

U-Boot mkimage tool

U-Boot mkimage utility is required in order to create kernel images that can be loaded by the CM-T3517 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-T3517 kernel. You can create a copy of linux-omap git tree or download a snapshot and extract it. We assume that you have created /home/development/cm-t3517/kernel directory for CM-T3517 kernel development.

Snapshot download

  • Download snapshot with your web browser. Note, that tools like wget and curl will not work here.
  • Extract the downloaded archive linux-omap-2.6-3fd5969.tar.gz
cd /home/development/cm-t3517/kernel
tar xzvf /path/to/downloaded/linux-omap-2.6-3fd5969.tar.gz
This will create /home/development/cm-t3517/kernel/linux-omap-2.6 directory containing linux-omap kernel tree.
  • Apply the CM-T3517 patch
cd /home/development/cm-t3517/kernel/linux-omap-2.6
patch -p1 < /path/to/t3517-linux/kernel/linux-2.6.32-3fd5969a81a9324b58a1c19cf510c0da97c99565-cm-t3517.patch

Git clone

  • Install git version control system.
  • Create a clone of linux-omap kernel tree
cd /home/development/cm-t3517/kernel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git linux-omap-2.6
  • Create a branch for CM-T3517 development. The CM-T3517 patches are generated vs. commit 3fd5969a81a9324b58a1c19cf510c0da97c99565 in the linux-omap tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
git checkout -b cm-t3517-dev 3fd5969a81a9324b58a1c19cf510c0da97c99565
  • Apply the CM-T3517 patch
cd /home/development/cm-t3517/kernel/linux-omap-2.6
git apply /path/to/t3517-linux/kernel/linux-2.6.32-3fd5969a81a9324b58a1c19cf510c0da97c99565-cm-t3517.patch

Building the kernel

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

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

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

Controller–area network (CAN) support

Controller Area Network (CAN) is a slow (up to 1Mbit/s) serial communications protocol used in automotive, marine, industrial and medical applications. The CM-T3517 features a TI High End CAN Controller (HECC), integrated into the Sitara AM3517/05 SoC. The TI HECC implements full CAN protocol version 2.0B. It supports both the base (standard) and the extended frame format as well as a programmable data bit rate with maximum of 1Mbit/s.

To enable CAN functionality of the CM-T3517, the following dependencies must be met:

  • CAN bus subsystem support enabled
  • Platform CAN drivers with Netlink support enabled
  • TI HECC device driver compiled into the kernel or as a module
  • Raw CAN protocol support enabled
  • CAN bit-timing calculation enabled

CAN bus subsystem support

In the kernel configuration menu choose "Networking Support" submenu and enable "CAN bus subsystem support". You can choose to either build it into the kernel or to compile it as a module. In the last case the module name will be can.

┌────────────────────────────── 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  --->                                       │ │   
│ │    <M>   CAN bus subsystem support  --->                                   │ │   
│ │    < >   IrDA (infrared) subsystem support  --->                           │ │   
│ │    <M>   Bluetooth subsystem support  --->                                 │ │   
│ │    < >   RxRPC session sockets                                             │ │   
│ │    -*-   Wireless  --->                                                    │ │   
│ │    < >   WiMAX Wireless Broadband support  --->                            │ │   
│ │    < >   RF switch subsystem support  --->                                 │ │   
│ │    < >   Plan 9 Resource Sharing Support (9P2000) (Experimental)  --->     │ │   
│ │                                                                            │ │   
│ └────────────────────────────────────────────────────────────────────────────┘ │   
├────────────────────────────────────────────────────────────────────────────────┤   
│                        <Select>    < Exit >    < Help >                        │   
└────────────────────────────────────────────────────────────────────────────────┘

Raw CAN protocol support

In the kernel configuration menu choose Networking Support ---> CAN bus subsystem support submenu and enable "Raw CAN Protocol". If "CAN bus subsystem support" is built into the kernel, you can choose to build Raw CAN protocol into the kernel or as a module. The module name will be can-raw. For more information, please read Loading CAN modules chapter.

┌────────────────────────── 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  <M> module  < > module capable                    │   
│ ┌────────────────────────────────────────────────────────────────────────────┐ │   
│ │    --- CAN bus subsystem support                                           │ │   
│ │    <M>   Raw CAN Protocol (raw access with CAN-ID filtering)               │ │   
│ │    < >   Broadcast Manager CAN Protocol (with content filtering)           │ │   
│ │          CAN Device Drivers  --->                                          │ │   
│ │                                                                            │ │   
│ └────────────────────────────────────────────────────────────────────────────┘ │   
├────────────────────────────────────────────────────────────────────────────────┤   
│                        <Select>    < Exit >    < Help >                        │   
└────────────────────────────────────────────────────────────────────────────────┘

Platform CAN drivers

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

  • Platform CAN drivers with Netlink support
  • CAN bit-timing calculation
  • TI High End CAN Controller

If "Platform CAN drivers with Netlink support" or "TI High End CAN Controller" are built as modules, then the module names are can-dev and ti_hecc respectively.

┌────────────────────────────── 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  <M> module  < > module capable                    │   
│ ┌────────────────────────────────────────────────────────────────────────────┐ │   
│ │    < > Virtual Local CAN Interface (vcan)                                  │ │   
│ │    <M> Platform CAN drivers with Netlink support                           │ │   
│ │    [*]   CAN bit-timing calculation                                        │ │   
│ │    <M>   TI High End CAN Controller                                        │ │   
│ │    < >   Microchip MCP251x SPI CAN controllers                             │ │   
│ │    < >   Philips/NXP SJA1000 devices  --->                                 │ │   
│ │          CAN USB interfaces  --->                                          │ │   
│ │    [ ] CAN devices debugging messages                                      │ │   
│ │                                                                            │ │   
│ └────────────────────────────────────────────────────────────────────────────┘ │   
├────────────────────────────────────────────────────────────────────────────────┤   
│                        <Select>    < Exit >    < Help >                        │
└────────────────────────────────────────────────────────────────────────────────┘


Admolition note.png Protocol, platform and device driver modules must be loaded prior to configuring CAN interface.

See also