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

From Compulab Mediawiki
Jump to: navigation, search
(Building the kernel)
 
(See also)
Line 95: Line 95:
 
* [[CM-T3730: Linux: Getting started]]
 
* [[CM-T3730: Linux: Getting started]]
 
* [[CM-T3730: Linux: Angstrom]]
 
* [[CM-T3730: Linux: Angstrom]]
 +
* [[CM-T3730: Linux: Camera]]
 
* [[U-Boot for CM-T3730]]
 
* [[U-Boot for CM-T3730]]
  
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:CM-T3730]]
 
[[Category:CM-T3730]]

Revision as of 11:29, 3 April 2012

Overview

Linux kernel for CM-T3730 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-T3730 modules. Most of the CM-T3730 functionality is merged into the mainline kernel starting from 3.1 release.

Kernel command line

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

root=/dev/mmcblk0p3 rootwait console=ttyO2,115200 omapfb.mode=dvi:1024x768-24@60 omapfb.vram=1:4M vram=8M

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

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-T3730 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-<version>
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-T3730 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-t3730/kernel directory for CM-T3730 kernel development.

Snapshot download

  • Download v3.0 snapshot with your web browser. Note, that tools like wget and curl will not work here.
  • Extract the downloaded archive linux-02f8c6a.tar.gz
cd /home/development/cm-t3730/kernel
tar xzvf /path/to/downloaded/linux-02f8c6a.tar.gz
mv linux-02f8c6a linux-cm-t3730
This will create /home/development/cm-t3730/kernel/linux-cm-t3730 directory containing linux kernel tree.
  • Apply the CM-T3730 patch
cd /home/development/cm-t3730/kernel/linux-cm-t3730
patch -p1 < /path/to/t3730-linux/kernel/linux-3.0-cm-t3730-1.patch
  • Copy the CM-T3730 kernel configuration file
cd /home/development/cm-t3730/kernel/linux-cm-t3730
cp /path/to/t3730-linux/kernel/linux-3.0-cm-t3730-1.defconfig arch/arm/configs/cm_t3730_defconfig

Git clone

  • Install git version control system.
  • Create a clone of linux kernel tree
cd /home/development/cm-t3730/kernel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-cm-t3730
  • Create a branch for CM-T3730 development. The CM-T3730 patches are generated vs. v3.0 tag (02f8c6aee8df3cdc935e9bdd4f2d020306035dbe commit) in the linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
git checkout -b cm-t3730-dev v3.0
  • Apply the CM-T3730 patch
cd /home/development/cm-t3730/kernel/linux-cm-t3730
git apply /path/to/t3730-linux/kernel/linux-3.0-cm-t3730-1.patch
  • Copy the CM-T3730 kernel configuration file
cd /home/development/cm-t3730/kernel/linux-cm-t3730
cp /path/to/t3730-linux/kernel/linux-3.0-cm-t3730-1.defconfig arch/arm/configs/cm_t3730_defconfig

Building the kernel

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

In the example above, the Linux kernel image (uImage) will be created in /home/development/cm-t3730/kernel/linux-cm-t3730/arch/arm/boot, and the loadable kernel modules will be installed into the /home/development/cm-t3730/rootfs/lib/modules directory.
When the CM-T3730 is booted with the kernel image created as described above and with networked root filesystem at /home/development/cm-t3730/rootfs/, the system will be able to load the kernel modules properly, thus avoiding module version problems.

See also