CM-T335: Linux: Kernel

From Compulab Mediawiki
Revision as of 13:10, 23 December 2013 by Ilya (talk) (Git clone)
Jump to: navigation, search

Overview

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

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

  • Pre-built toolchain (recommended):
  • 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-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-2.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-2.patch

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.


See also