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

From Compulab Mediawiki
Jump to: navigation, search
(Git clone)
(Git clone)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
Linux kernel for CM-T54 modules provides support for on-board peripherals and abstracts the functionality provided by the hardware.
+
Linux kernel for the CompuLab CM-T54 System-on-Module / Computer-on-Module provides support for on-board peripherals and abstracts the functionality provided by the hardware.
 
Current support coverage is specified at [http://compulab.co.il/operating-systems-and-drivers-for-cm-t54-and-sbc-t54/ O/S support coverage map] page.
 
Current support coverage is specified at [http://compulab.co.il/operating-systems-and-drivers-for-cm-t54-and-sbc-t54/ 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-T54 modules.
 
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-T54 modules.
 +
 +
== Device Tree ==
 +
 +
Device Tree (DT), is a data structure and language for describing hardware. More specifically, it is a description of hardware that is readable by an operating system so that the operating system doesn't need to hard code details of the machine.
 +
 +
A device tree file, named *.dts, is a text file that describes the hardware platform. It is compiled into a device tree blob, *.dtb, which is loaded into memory before the Linux kernel is started. The Linux kernel then uses that device tree blob to initialize itself at runtime.
 +
 +
CM-T54 DT related files are :
 +
 +
* {{filename | arch/arm/boot/dts/omap5-cm-t54.dts }} - CM-T54 core CoM Device Tree
 +
* {{filename | arch/arm/boot/dts/omap5-sbc-t54.dts }} - SBC-T54 single board computer (eval board) Device Tree
 +
 +
For more details visit official [http://devicetree.org/Device_Tree_Usage Device Tree WiKi] pages and make an overview of a [http://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf  Device Tree tutorial]
  
 
== Building kernel for CM-T54 ==
 
== Building kernel for CM-T54 ==
Line 14: Line 27:
  
 
=== Getting kernel sources ===
 
=== Getting kernel sources ===
We assume that you have created {{filename|/home/development/cm-t54/kernel}} directory for CM-T54 kernel development.
 
  
==== Git clone ====
+
==== Kernel v4.0.5 ====
 +
 
 +
There are various ways to get Linux kernel sources that can be used as a baseline for CM-T54 kernel.
 +
For instance, a copy of linux-stable git tree can be created or a Linux kernel sources snapshot can be downloaded.
 +
 
 +
Assuming that the {{filename|/home/development/cm-t54/kernel}} directory structure has been created for CM-T54 kernel development.
 +
 
 +
===== Snapshot download =====
 +
* Download [https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.0.5.tar.gz v4.0.5] snapshot with a web browser.
 +
* Extract the downloaded archive {{filename|linux-4.0.5.tar.gz}}
 +
<pre>
 +
cd /home/development/cm-t54/kernel
 +
tar xvf /path/to/downloaded/linux-4.0.5.tar.gz
 +
mv linux-4.0.5 linux-cm-t54
 +
</pre>
 +
: This will create {{filename|/home/development/cm-t54/kernel/linux-cm-t54}} directory containing linux kernel tree.
 +
* Apply the CM-T54 patch
 +
<pre>
 +
cd /home/development/cm-t54/kernel/linux-cm-t54
 +
patch -p1 < /path/to/cm-t54-linux/kernel/v4.0.5-cm-t54-5/linux-4.0.5-cm-t54-5.patch
 +
</pre>
 +
 
 +
===== 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 kernel tree
 
* Create a clone of linux kernel tree
Line 23: Line 57:
 
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-cm-t54
 
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-cm-t54
 
</pre>
 
</pre>
* Create a branch for CM-T54 development. The CM-T54 patches are generated vs. v3.14.8 tag (0c5b3b80f7aeba9b8d25e12f7b321d148a1b1cb9 commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
+
* Create a branch for CM-T54 development. The CM-T54 patches are generated vs. v4.0.5 tag (be4cb235441a691ee63ba5e00843a9c210be5b8a commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
 
<pre>
 
<pre>
 
cd /home/development/cm-t54/kernel/linux-cm-t54
 
cd /home/development/cm-t54/kernel/linux-cm-t54
git checkout -b cm-t54-dev v3.14.8
+
git checkout -b cm-t54-dev v4.0.5
 
</pre>
 
</pre>
 
* Apply the CM-T54 patch
 
* Apply the CM-T54 patch
 
<pre>
 
<pre>
git apply /path/to/cm-t54-linux/kernel/linux-3.14.8-cm-t54-2.patch
+
git apply /path/to/cm-t54-linux/kernel/v4.0.5-cm-t54-5/linux-4.0.5-cm-t54-5.patch
 
</pre>
 
</pre>
  
{{Note|Future stable kernel versions of 3.14 can also be used by checking out any later tag of v3.14.y stable kernel tree.}}
+
{{Note|Future stable kernel versions of 4.0 can also be used by adding the Linux kernel stable repository as a remote and checking out any later tag of the v4.0.y stable kernel branch.}}
 +
 
 +
==== Kernel v3.8.13 ====
 +
 
 +
TI GLSDK kernel v3.8.13 for OMAP5 System-On-Chip is used as a baseline for CM-T54 Linux kernel. This kernel incorporate various IPU/GPU features support which are not available in the mainline Linux kernel.
 +
TI kernel repository is located at [http://omapzoom.org omapzoom.org]. The sources of the kernel can be obtained by creating a copy of the git tree.
 +
 
 +
Assuming that the {{filename|/home/development/cm-t54/kernel}} directory structure has been created for CM-T54 kernel development.
 +
 
 +
===== Git clone =====
 +
* Install [http://git-scm.com/ git] version control system.
 +
* Create a clone of linux kernel tree
 +
<pre>
 +
cd /home/development/cm-t54/kernel
 +
git clone git://git.omapzoom.org/kernel/omap.git linux-cm-t54
 +
</pre>
 +
* Create a branch for CM-T54 development. The CM-T54 patches are generated vs. commit 89927f5573872cada07d07c714e24a71ed6c29c3 in the OMAP5 GLSDK Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
 +
<pre>
 +
cd /home/development/cm-t54/kernel/linux-cm-t54
 +
git checkout -b cm-t54-dev 89927f5573872cada07d07c714e24a71ed6c29c3
 +
</pre>
 +
* Apply the CM-T54 patch
 +
<pre>
 +
git apply /path/to/cm-t54-linux/kernel/v3.8.13-cm-t54-5/linux-3.8.13-cm-t54-5.patch
 +
</pre>
  
 
=== Building the kernel ===
 
=== Building the kernel ===
Line 52: Line 110:
  
 
When the CM-T54 is booted with the kernel image and Device Tree binary created as described above and with networked root filesystem at {{filename|/home/development/cm-t54/rootfs/}}, the system will be able to load the kernel modules properly, thus avoiding module version problems.
 
When the CM-T54 is booted with the kernel image and Device Tree binary created as described above and with networked root filesystem at {{filename|/home/development/cm-t54/rootfs/}}, the system will be able to load the kernel modules properly, thus avoiding module version problems.
 +
 +
=== Building SGX DDK ===
 +
 +
OMAP5 SGX driver development kit (DDK) is a part of the official [http://downloads.ti.com/dsps/dsps_public_sw/glsdk/6_03_00_01/index_FDS.html TI OMAP5 GLSDK 6.03.00.01].
 +
 +
SGX kernel driver ({{cmd|omapdrm_pvr}}) is required to support a hardware accelerated 2D graphics, 3D graphics, vector graphics, and programmable GPU functions.
 +
 +
{{Note| SGX kernel driver is compatible with kernel release based on v3.8.13 and user space libraries shipped with [[CM-T54: Linux: Arago Project | Arago Project]] Linux image.}}
 +
 +
The driver sources can be obtained by creating a copy of the git tree:
 +
 +
<pre>
 +
cd /home/development/cm-t54/
 +
git clone git://git.ti.com/graphics/omap5-sgx-ddk-linux omap5-sgx-ddk-linux
 +
</pre>
 +
 +
Create a branch for CM-T54 development.
 +
 +
<pre>
 +
cd /home/development/cm-t54/omap5-sgx-ddk-linux
 +
git checkout -b cm-t54-dev 7e084e0452bfaa495d2a9c06c7a420bac35d8d99
 +
</pre>
 +
 +
Set the environment variables
 +
<pre>
 +
export ARCH=arm
 +
export CROSS_COMPILE=arm-none-linux-eabi-
 +
export KERNELDIR=/home/development/cm-t54/kernel/linux-cm-t54
 +
export DISCIMAGE=/home/development/cm-t54/rootfs
 +
</pre>
 +
 +
Build and install the driver
 +
 +
<pre>
 +
cd /home/development/cm-t54/omap5-sgx-ddk-linux/eurasia_km/eurasiacon/build/linux2/omap5430_linux
 +
make
 +
sudo -E make kbuild_install
 +
</pre>
  
 
== See also ==
 
== See also ==
 
* [[CM-T54: Linux: Getting started]]
 
* [[CM-T54: Linux: Getting started]]
 
* [[CM-T54: Linux: Debian]]
 
* [[CM-T54: Linux: Debian]]
 +
* [[CM-T54: Linux: Arago Project]]
  
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:CM-T54]]
 
[[Category:CM-T54]]

Latest revision as of 04:40, 19 October 2016

Overview

Linux kernel for the CompuLab CM-T54 System-on-Module / Computer-on-Module 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-T54 modules.

Device Tree

Device Tree (DT), is a data structure and language for describing hardware. More specifically, it is a description of hardware that is readable by an operating system so that the operating system doesn't need to hard code details of the machine.

A device tree file, named *.dts, is a text file that describes the hardware platform. It is compiled into a device tree blob, *.dtb, which is loaded into memory before the Linux kernel is started. The Linux kernel then uses that device tree blob to initialize itself at runtime.

CM-T54 DT related files are :

  • arch/arm/boot/dts/omap5-cm-t54.dts - CM-T54 core CoM Device Tree
  • arch/arm/boot/dts/omap5-sbc-t54.dts - SBC-T54 single board computer (eval board) Device Tree

For more details visit official Device Tree WiKi pages and make an overview of a Device Tree tutorial

Building kernel for CM-T54

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.

Getting kernel sources

Kernel v4.0.5

There are various ways to get Linux kernel sources that can be used as a baseline for CM-T54 kernel. For instance, a copy of linux-stable git tree can be created or a Linux kernel sources snapshot can be downloaded.

Assuming that the /home/development/cm-t54/kernel directory structure has been created for CM-T54 kernel development.

Snapshot download
  • Download v4.0.5 snapshot with a web browser.
  • Extract the downloaded archive linux-4.0.5.tar.gz
cd /home/development/cm-t54/kernel
tar xvf /path/to/downloaded/linux-4.0.5.tar.gz
mv linux-4.0.5 linux-cm-t54
This will create /home/development/cm-t54/kernel/linux-cm-t54 directory containing linux kernel tree.
  • Apply the CM-T54 patch
cd /home/development/cm-t54/kernel/linux-cm-t54
patch -p1 < /path/to/cm-t54-linux/kernel/v4.0.5-cm-t54-5/linux-4.0.5-cm-t54-5.patch
Git clone
  • Install git version control system.
  • Create a clone of linux kernel tree
cd /home/development/cm-t54/kernel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-cm-t54
  • Create a branch for CM-T54 development. The CM-T54 patches are generated vs. v4.0.5 tag (be4cb235441a691ee63ba5e00843a9c210be5b8a commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
cd /home/development/cm-t54/kernel/linux-cm-t54
git checkout -b cm-t54-dev v4.0.5
  • Apply the CM-T54 patch
git apply /path/to/cm-t54-linux/kernel/v4.0.5-cm-t54-5/linux-4.0.5-cm-t54-5.patch


Admolition note.png Future stable kernel versions of 4.0 can also be used by adding the Linux kernel stable repository as a remote and checking out any later tag of the v4.0.y stable kernel branch.

Kernel v3.8.13

TI GLSDK kernel v3.8.13 for OMAP5 System-On-Chip is used as a baseline for CM-T54 Linux kernel. This kernel incorporate various IPU/GPU features support which are not available in the mainline Linux kernel. TI kernel repository is located at omapzoom.org. The sources of the kernel can be obtained by creating a copy of the git tree.

Assuming that the /home/development/cm-t54/kernel directory structure has been created for CM-T54 kernel development.

Git clone
  • Install git version control system.
  • Create a clone of linux kernel tree
cd /home/development/cm-t54/kernel
git clone git://git.omapzoom.org/kernel/omap.git linux-cm-t54
  • Create a branch for CM-T54 development. The CM-T54 patches are generated vs. commit 89927f5573872cada07d07c714e24a71ed6c29c3 in the OMAP5 GLSDK Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
cd /home/development/cm-t54/kernel/linux-cm-t54
git checkout -b cm-t54-dev 89927f5573872cada07d07c714e24a71ed6c29c3
  • Apply the CM-T54 patch
git apply /path/to/cm-t54-linux/kernel/v3.8.13-cm-t54-5/linux-3.8.13-cm-t54-5.patch

Building the kernel

export ARCH=arm
export CROSS_COMPILE=arm-none-linux-eabi-
make cm_t54_defconfig
make menuconfig
make && make zImage && make omap5-sbc-t54.dtb \
     INSTALL_MOD_PATH=/home/development/cm-t54/rootfs make modules_install

In the example above:

  • The Linux kernel image zImage will be created in /home/development/cm-t54/kernel/linux-cm-t54/arch/arm/boot
  • The Device Tree binary omap5-sbc-t54.dtb will be created in /home/development/cm-t54/kernel/linux-cm-t54/arch/arm/boot/dts
  • The loadable kernel modules will be installed into the /home/development/cm-t54/rootfs/lib/modules directory.

When the CM-T54 is booted with the kernel image and Device Tree binary created as described above and with networked root filesystem at /home/development/cm-t54/rootfs/, the system will be able to load the kernel modules properly, thus avoiding module version problems.

Building SGX DDK

OMAP5 SGX driver development kit (DDK) is a part of the official TI OMAP5 GLSDK 6.03.00.01.

SGX kernel driver (omapdrm_pvr) is required to support a hardware accelerated 2D graphics, 3D graphics, vector graphics, and programmable GPU functions.


Admolition note.png SGX kernel driver is compatible with kernel release based on v3.8.13 and user space libraries shipped with Arago Project Linux image.

The driver sources can be obtained by creating a copy of the git tree:

cd /home/development/cm-t54/
git clone git://git.ti.com/graphics/omap5-sgx-ddk-linux omap5-sgx-ddk-linux

Create a branch for CM-T54 development.

cd /home/development/cm-t54/omap5-sgx-ddk-linux
git checkout -b cm-t54-dev 7e084e0452bfaa495d2a9c06c7a420bac35d8d99

Set the environment variables

export ARCH=arm
export CROSS_COMPILE=arm-none-linux-eabi-
export KERNELDIR=/home/development/cm-t54/kernel/linux-cm-t54
export DISCIMAGE=/home/development/cm-t54/rootfs

Build and install the driver

cd /home/development/cm-t54/omap5-sgx-ddk-linux/eurasia_km/eurasiacon/build/linux2/omap5430_linux
make
sudo -E make kbuild_install

See also