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

From Compulab Mediawiki
Jump to: navigation, search
m (1 revision(s))
(Git clone)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
Linux kernel for CM-T3530 modules provides support for on-board peripherals and abstracts the functionality provided by the hardware. Current support coverage is specified at [http://www.compulab.co.il/t3530/html/t3530-os-support.htm 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-T3530 modules.  
+
Linux kernel for CM-T3530 modules provides support for on-board peripherals and abstracts the functionality provided by the hardware.
Most of the CM-T3530 functionality is merged into the mainline kernel. CM-T3530 support is included in [http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git linux-omap git repository] and will be merged into upcoming Linux kernel 2.6.33.
+
Current support coverage is specified at [http://compulab.co.il/products/availability-of-os-and-drivers-for-cm-t3530-sbc-t3530/ 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-T3530 modules.
 +
Most of the CM-T3530 functionality is merged into the mainline kernel starting from 2.6.33 release.
  
 
== Kernel command line ==
 
== Kernel command line ==
 
The Linux kernel for CM-T3530 is shipped with built-in command line parameters:
 
The Linux kernel for CM-T3530 is shipped with built-in command line parameters:
ubi.mtd=4,2048 root=ubi0:cm-t35-rootfs rootfstype=ubifs console=ttyS2,115200 \
+
<pre>
  omapfb.mode=dvi:1024x768-24@60 omapfb.vram=1:4M vram=8M omapdss.def_disp=lcd
+
root=/dev/mmcblk0p2 rootwait console=ttyO2,115200 omapfb.mode=dvi:1024x768-24@60 omapfb.vram=1:4M vram=8M
 +
</pre>
  
The default kernel command line defines primary console, default display settings, root device and root filesystem type.
+
The default kernel command line defines primary console, default display settings, root device and root filesystem type.<br>
 +
Setting U-Boot {{parameter|bootargs}} environment variable overrides default kernel command line and can be used to set desired kernel parameters.
  
Setting U-Boot {{parameter|bootargs}} environment variable overrides default kernel command line and can be used to set desired kernel parameters.
+
{{Note|If the MMC/SD Card is used as your root filesystem device, Linux kernel command line must have the following parameter appended: {{parameter|mmc_core.removable&#61;0}} }}
  
 
== Building kernel for CM-T3530 ==
 
== Building kernel for CM-T3530 ==
 
=== Cross-Compiler ===
 
=== 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 ("[http://en.wikipedia.org/wiki/Application_binary_interface#EABI EABI]")
 
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 ("[http://en.wikipedia.org/wiki/Application_binary_interface#EABI EABI]")
* Pre-built toolchain:
+
* Pre-built toolchain (recommended):
** [http://www.codesourcery.com/sgpp/lite/arm/portal/release324 CodeSourcery]
+
** [http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/editions/lite-edition/ Sourcery CodeBench Lite]
 
* Tools for creating cross-compilers:
 
* Tools for creating cross-compilers:
** [http://ymorin.is-a-geek.org/dokuwiki/projects/crosstool Crosstool-ng]: Builds a cross-compiler from source. Non-distribution specific.
+
** [http://crosstool-ng.org/ Crosstool-ng]: Builds a cross-compiler from source. Non-distribution specific.
 
** [http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1&chap=4 Crossdev]: Gentoo's cross-compiler builder. Needs Gentoo.
 
** [http://www.gentoo.org/proj/en/base/embedded/handbook/index.xml?part=1&chap=4 Crossdev]: Gentoo's cross-compiler builder. Needs Gentoo.
  
Line 29: Line 33:
 
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
 
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
 
tar -xjvf u-boot-latest.tar.bz2
 
tar -xjvf u-boot-latest.tar.bz2
cd u-boot-2009.08
+
cd u-boot-<version>
 
touch include/config.{h,mk}
 
touch include/config.{h,mk}
 
make tools
 
make tools
Line 36: Line 40:
  
 
=== Getting kernel sources ===
 
=== Getting kernel sources ===
There are two ways to get Linux kernel sources that can be used as a baseline for CM-T3530 kernel. You can create a copy of linux-omap git tree or download a snapshot and extract it. We assume that you have created {{filename|/home/development/cm-t35/kernel}} directory for CM-T3530 kernel development
+
There are two ways to get Linux kernel sources that can be used as a baseline for CM-T3530 kernel. You can create a copy of linux-stable git tree or download a snapshot and extract it. We assume that you have created {{filename|/home/development/cm-t3530/kernel}} directory for CM-T3530 kernel development.
 
==== Snapshot download ====
 
==== Snapshot download ====
* Download [http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=snapshot;h=2a20002a83ce565ed16aaec5e64151cae165cb8f;sf=tgz v2.6.32-omap1] snapshot with your web browser. Note, that tools like {{cmd|wget}} and {{cmd|curl}} will not work here.
+
* Download [http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.87.tar.bz2 v3.0.87] snapshot with your web browser.
* Extract the downloaded archive {{filename|linux-omap-2.6-2a20002a83ce565ed16aaec5e64151cae165cb8f.tar.gz}}
+
* Extract the downloaded archive {{filename|linux-3.0.87.tar.bz2}}
 
<pre>
 
<pre>
cd /home/development/cm-t35/kernel
+
cd /home/development/cm-t3530/kernel
tar xzvf /path/to/downloaded/linux-omap-2.6-2a20002a83ce565ed16aaec5e64151cae165cb8f.tar.gz
+
tar xvf /path/to/downloaded/linux-3.0.87.tar.bz2
 +
mv linux-3.0.87 linux-cm-t3530
 
</pre>
 
</pre>
: This will create {{filename|/home/development/cm-t35/kernel/linux-omap-2.6}} directory containing linux-omap kernel tree.
+
: This will create {{filename|/home/development/cm-t3530/kernel/linux-cm-t3530}} directory containing linux kernel tree.
 
* Apply the CM-T3530 patch
 
* Apply the CM-T3530 patch
 
<pre>
 
<pre>
cd /home/development/cm-t35/kernel/linux-omap-2.6
+
cd /home/development/cm-t3530/kernel/linux-cm-t3530
patch -p1 < /path/to/t3530-linux/kernel/linux-2.6.32-omap1-cm-t35.patch
+
patch -p1 < /path/to/cm-t3530-linux/kernel/linux-3.0.87-cm-t35-4.patch
 
</pre>
 
</pre>
 +
 
==== Git clone ====
 
==== Git clone ====
 
* Install [http://git-scm.com/ git] version control system.
 
* Install [http://git-scm.com/ git] version control system.
* Create a clone of linux-omap kenrel tree
+
* Create a clone of linux kernel tree
 
<pre>
 
<pre>
cd /home/development/cm-t35/kernel
+
cd /home/development/cm-t3530/kernel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git linux-omap-2.6
+
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-cm-t3530
 
</pre>
 
</pre>
* Create a branch for CM-T3530 development. The CM-T3530 patches are generated vs. commit 2a20002a83ce565ed16aaec5e64151cae165cb8f in the linux-omap tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
+
* Create a branch for CM-T3530 development. The CM-T3530 patches are generated vs. v3.0.87 tag (61bfa77de71ef9d84614d3a7f0a3ca1c7af82058 commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
 
<pre>
 
<pre>
git checkout -b cm-t35-dev 2a20002a83ce565ed16aaec5e64151cae165cb8f
+
git checkout -b cm-t3530-dev v3.0.87
 
</pre>
 
</pre>
 
* Apply the CM-T3530 patch
 
* Apply the CM-T3530 patch
 
<pre>
 
<pre>
cd /home/development/cm-t35/kernel/linux-omap-2.6
+
cd /home/development/cm-t3530/kernel/linux-cm-t3530
git apply /path/to/t3530-linux/kernel/linux-2.6.32-omap1-cm-t35.patch
+
git apply /path/to/cm-t3530-linux/kernel/linux-3.0.87-cm-t35-4.patch
 
</pre>
 
</pre>
 +
 +
{{Note|Future stable kernel versions of 3.0 can also be used by checking out any later tag of v3.0.y stable kernel tree and applying the {{filename|linux-3.0.87-cm-t35-4.patch}}.}}
  
 
=== Building the kernel ===
 
=== Building the kernel ===
Line 71: Line 79:
 
export ARCH=arm
 
export ARCH=arm
 
export CROSS_COMPILE=arm-none-linux-eabi-
 
export CROSS_COMPILE=arm-none-linux-eabi-
make cm_t35_defconfig
+
make cm_t3x30_defconfig
 
make menuconfig
 
make menuconfig
 
make && make uImage && \
 
make && make uImage && \
     INSTALL_MOD_PATH=/home/development/cm-t35/rootfs make modules_install
+
     INSTALL_MOD_PATH=/home/development/cm-t3530/rootfs make modules_install
 
</pre>
 
</pre>
  
In the example  above, the Linux kernel image ({{filename|uImage}}) will be created in {{filename|/home/development/cm-t35/kernel/linux-omap-2.6/arch/arm/boot}}, and the loadable kernel modules will be installed into the {{filename|/home/development/cm-t35/rootfs/lib/modules}} directory.
+
In the example  above, the Linux kernel image ({{filename|uImage}}) will be created in {{filename|/home/development/cm-t3530/kernel/linux-cm-t3530/arch/arm/boot}}, and the loadable kernel modules will be installed into the {{filename|/home/development/cm-t3530/rootfs/lib/modules}} directory.<br>
 
+
When the CM-T3530 is booted with the kernel image created as described above and with networked root filesystem at {{filename|/home/development/cm-t3530/rootfs/}}, the system will be able to load the kernel modules properly, thus avoiding module version problems.
Now, if you boot CM-T3530 with newly created kernel image and with networked root filesysem at {{filename|/home/development/cm-t35/rootfs/}} the system will be able to properly load kernel modules and you avoid modules versioning problems.
 
  
 
== See also ==
 
== See also ==
 
* [[CM-T3530: Linux: Getting started]]
 
* [[CM-T3530: Linux: Getting started]]
 
* [[CM-T3530: Linux: Angstrom]]
 
* [[CM-T3530: Linux: Angstrom]]
* [[CM-T3530: Linux: Building images]]
+
* [[CM-T3730: Linux: Camera]]
 
* [[U-Boot for CM-T3530]]
 
* [[U-Boot for CM-T3530]]
  
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:CM-T3530]]
 
[[Category:CM-T3530]]

Latest revision as of 13:07, 28 October 2013

Overview

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

Kernel command line

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

root=/dev/mmcblk0p2 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.


Admolition note.png If the MMC/SD Card is used as your root filesystem device, Linux kernel command line must have the following parameter appended: mmc_core.removable=0

Building kernel for CM-T3530

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-T3530 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-T3530 kernel. You can create a copy of linux-stable git tree or download a snapshot and extract it. We assume that you have created /home/development/cm-t3530/kernel directory for CM-T3530 kernel development.

Snapshot download

  • Download v3.0.87 snapshot with your web browser.
  • Extract the downloaded archive linux-3.0.87.tar.bz2
cd /home/development/cm-t3530/kernel
tar xvf /path/to/downloaded/linux-3.0.87.tar.bz2
mv linux-3.0.87 linux-cm-t3530
This will create /home/development/cm-t3530/kernel/linux-cm-t3530 directory containing linux kernel tree.
  • Apply the CM-T3530 patch
cd /home/development/cm-t3530/kernel/linux-cm-t3530
patch -p1 < /path/to/cm-t3530-linux/kernel/linux-3.0.87-cm-t35-4.patch

Git clone

  • Install git version control system.
  • Create a clone of linux kernel tree
cd /home/development/cm-t3530/kernel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-cm-t3530
  • Create a branch for CM-T3530 development. The CM-T3530 patches are generated vs. v3.0.87 tag (61bfa77de71ef9d84614d3a7f0a3ca1c7af82058 commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
git checkout -b cm-t3530-dev v3.0.87
  • Apply the CM-T3530 patch
cd /home/development/cm-t3530/kernel/linux-cm-t3530
git apply /path/to/cm-t3530-linux/kernel/linux-3.0.87-cm-t35-4.patch


Admolition note.png Future stable kernel versions of 3.0 can also be used by checking out any later tag of v3.0.y stable kernel tree and applying the linux-3.0.87-cm-t35-4.patch.

Building the kernel

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

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

See also