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

From Compulab Mediawiki
Jump to: navigation, search
 
m (1 revision(s))
(No difference)

Revision as of 11:35, 3 November 2010

Overview

The CM-A510 Linux kernel 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-A510 modules.

Kernel command line

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

ubi.mtd=1,2048 root=ubi0_0 rootfstype=ubifs useNandHal=4bitecc pm_disable console=ttyS0,115200 

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-A510

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-A510 boot-loader. You can download pre-built 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-2009.08
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-A510 kernel. You can create a copy of linux-2.6.32.y git tree or download a snapshot and extract it. We assume that you have created /home/development/cm-a510/kernel directory for CM-A510 kernel development.

Snapshot download

  • Download linux-v2.6.32.9 snapshot with your web browser.
  • Extract the downloaded archive linux-2.6.32.9.tar.bz2
cd /home/development/cm-a510/kernel
tar xzvf /path/to/downloaded/linux-2.6.32.9.tar.bz2
This will create /home/development/cm-a510/kernel/linux-2.6.32.9 directory containing linux-2.6.32.9 kernel tree.
  • Apply the CM-A510 patch
cd /home/development/cm-a510/kernel/linux-2.6.32.9
patch -p1 < /path/to/cm-a510-linux/kernel/linux-2.6.32.9-cm-a510.patch

Git clone

  • Install git version control system.
  • Create a clone of linux-2.6.32.y kernel tree
cd /home/development/cm-a510/kernel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.32.y.git linux-2.6.32.9
  • Create a branch for CM-A510 development. The CM-A510 patches are generated vs. tag v2.6.32.9 in the linux-2.6.32.y tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
git checkout -b cm-a510-dev v2.6.32.9
  • Apply the CM-A510 patch
cd /home/development/cm_a510/kernel/linux-2.6.32.9
git apply /path/to/cma510-linux/kernel/linux-2.6.32.9-cm-a510.patch

Building the kernel

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

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

Now, if you boot CM-A510 with newly created kernel image and with networked root filesysem at /home/development/cm-a510/rootfs/ the system will be able to properly load kernel modules and you avoid modules versioning problems.

See also