CL-SOM-AM57x: Linux: Kernel

From Compulab Mediawiki
Revision as of 16:21, 24 March 2016 by Grinberg (talk | contribs) (TI SDK kernel v4.1.13)
Jump to: navigation, search

Overview

Linux kernel for the CompuLab CL-SOM-AM57x System-on-Module / Computer-on-Module provides support for on-board peripherals and abstracts the functionality provided by the hardware. 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 CL-SOM-AM57x modules.

Building kernel for CL-SOM-AM57x

Getting kernel sources

There are various ways to get Linux kernel sources that can be used as a baseline for CL-SOM-AM57x 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/cl-som-am57x/kernel directory structure has been created for CL-SOM-AM57x kernel development.

Snapshot download

Mainline kernel v4.4
  • Download v4.4 snapshot with a web browser.
  • Extract the downloaded archive linux-4.4.tar.gz
cd /home/development/cl-som-am57x/kernel
tar xvf /path/to/downloaded/linux-4.4.tar.gz
mv linux-4.4 linux-cl-som-am57x
This will create /home/development/cl-som-am57x/kernel/linux-cl-som-am57x directory containing linux kernel tree.
  • Apply the CL-SOM-AM57x patch
cd /home/development/cl-som-am57x/kernel/cl-som-am57x
patch -p1 < /path/to/cl-som-am57x/kernel/linux-4.4-cl-som-am57x-2.1.patch
TI SDK kernel v4.1.13
  • Download v4.1.13 snapshot with a web browser.
cd /home/development/cl-som-am57x/kernel
tar xvf /path/to/downloaded/processor-sdk-processor-sdk-linux-processor-sdk-linux-02.00.01.tar.gz
mv processor-sdk-linux linux-cl-som-am57x-ti
This will create /home/development/cl-som-am57x/kernel/linux-cl-som-am57x-ti directory containing linux kernel tree.
  • Apply the CL-SOM-AM57x patch
cd /home/development/cl-som-am57x/kernel/cl-som-am57x-ti
patch -p1 < /path/to/cl-som-am57x/kernel/ti-sdk-4.1.13/linux-4.1.13-cl-som-am57x-2.1.patch

Git clone

  • Install git version control system.
Mainline kernel v4.4
  • Create a clone of linux kernel tree
cd /home/development/cl-som-am57x/kernel
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-cl-som-am57x
  • Create a branch for CL-SOM-AM57x development. The CL-SOM-AM57x patches are generated vs. v4.4 tag (b5be40b90dbaa6bd337f3b77de361bfc0723468b commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
cd /home/development/cl-som-am57x/kernel/linux-cl-som-am57x
git checkout -b cl-som-am57x-dev v4.4
  • Apply the CL-SOM-AM57x patch
git apply /path/to/cl-som-am57x-linux/kernel/linux-4.4-cl-som-am57x-2.1.patch


Admolition note.png Future stable kernel versions of 4.4 can also be used by adding the Linux kernel stable repository as a remote and checking out any later tag of the v4.4.y stable kernel branch.
TI SDK kernel v4.1.13
  • Create a clone of linux kernel tree
cd /home/development/cl-som-am57x/kernel
git clone git://git.ti.com/processor-sdk/processor-sdk-linux.git linux-cl-som-am57x-ti
  • Create a branch for CL-SOM-AM57x development. The CL-SOM-AM57x patches are generated vs. processor-sdk-linux-rt-02.00.01 branch in the TI Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
cd /home/development/cl-som-am57x/kernel/linux-cl-som-am57x-ti
git checkout -b cl-som-am57x-dev-ti origin/processor-sdk-linux-02.00.01
Admolition note.png As an alternative, the TI SDK kernel can be added as an additional remote to the mainline kernel git repository.
  • Apply the CL-SOM-AM57x patch
git apply /path/to/cl-som-am57x-linux/kernel/ti-sdk-4.1.13/linux-4.1.13-cl-som-am57x-2.1.patch

Building the kernel

  • Run the following commands:
export ARCH=arm
export CROSS_COMPILE=arm-none-linux-eabi-
make cl-som-am57x_defconfig && make menuconfig
make && make zImage && make am57xx-sbc-am57x.dtb \
     INSTALL_MOD_PATH=/home/development/cl-som-am57x/rootfs make modules_install

In the example above:

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

When the CL-SOM-AM57x is booted with the kernel image and Device Tree binary created as described above and with networked root filesystem at /home/development/cl-som-am57x/rootfs/, the system will be able to load the kernel modules properly, thus avoiding module version problems.

See also