CM-A510: Linux: Kernel

From Compulab Mediawiki
Revision as of 13:15, 31 August 2015 by Grinberg (talk | contribs) (Custom kernel command line options)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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 DVI 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.

Custom kernel command line options

The default command line can be extended with the parameters below to enable additional CM-A510 kernel functionality:

  • Enable VGA output:

video=dovefb:lcd1:1024x768-16@60-edid clcd.lcd1_enable=1 clcd.lcd0_enable=0

  • Enable DVI output (default):

video=dovefb:lcd0:1024x768-16@60-edid clcd.lcd0_enable=1 clcd.lcd1_enable=0

  • Enable USB0 device functionality:

usb0Mode=device

  • Enable USB0 host functionality (default):

usb0Mode=host


Admolition note.png Current kernel release does not support dual head output. Ensure that only one interface (VGA or DVI) is active.

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 xjvf /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-dove-5.4.2-cm-a510-2.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-dove-5.4.2-cm-a510-2.patch

Building the kernel

export ARCH=arm
export CROSS_COMPILE=/path/to/cross-compiler/arm-none-linux-gnueabi-
make cm_a510_defconfig
make uImage && make modules && \
     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.

Building WiFi driver

Building Wireless SiP module WM-N-BM-01 driver, based on Broadcom 4319 chipset.

  • Extract broadcom-wlan.zip archive from the CM-A510 Linux package utilities directory
cd /home/development/cm-a510/
unzip /path/to/cm-a510-linux/utilities/broadcom-wlan.zip
cd broadcom-wlan/bcm4329/src/dhd/linux
  • Compile and install the driver
export ARCH=arm
export CROSS_COMPILE=/path/to/cross-compiler/arm-none-linux-gnueabi-
export LINUXDIR=/home/development/cm-a510/kernel
export LINUX_BUILD_DIR=/home/development/cm-a510/kernel
export INSTALL_MOD_PATH=/home/development/cm-a510/rootfs/lib/modules/

make clean
make dhd-cdc-sdmmc-gpl-debug
cp ./dhd-cdc-sdmmc-gpl-debug-2.6.32.9-dove-5.4.2-cm-a510-2/dhd.ko $INSTALL_MOD_PATH

See also