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

From Compulab Mediawiki
Jump to: navigation, search
(Overview)
(Git clone)
Line 24: Line 24:
 
git clone git://git.linaro.org/landing-teams/working/qualcomm/kernel.git
 
git clone git://git.linaro.org/landing-teams/working/qualcomm/kernel.git
 
</pre>
 
</pre>
* Create a branch for CM-QS600 development. The CM-QS600 patches are generated vs. ubuntu-ifc6410-14.09 tag (d392f534aee60425fb23868c1164bfbe99e6d52b commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
+
* Create a branch for CM-QS600 development. The CM-QS600 patches are generated vs. ubuntu-ifc6410-14.10 tag (602a30a57d9d3807df758221c2224e64a29e6fc7 commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
 
<pre>
 
<pre>
 
cd /home/development/cm-qs600/kernel/linux-cm-qs600
 
cd /home/development/cm-qs600/kernel/linux-cm-qs600
git checkout -b cm-qs600-dev ubuntu-ifc6410-14.09
+
git checkout -b cm-qs600-dev ubuntu-ifc6410-14.10
 
</pre>
 
</pre>
 
* Apply the CM-QS600 patch
 
* Apply the CM-QS600 patch
 
<pre>
 
<pre>
git apply /path/to/cm-qs600-linux/kernel/linux-3.4.0-14.09-cm-qs600-2.patch
+
git apply /path/to/cm-qs600-linux/kernel/linux-3.4.0-14.10-cm-qs600-3.patch
 
</pre>
 
</pre>
  

Revision as of 12:22, 24 December 2014

Overview

Linux kernel for the CompuLab CM-QS600 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-QS600 modules.

Building kernel for CM-QS600

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

The CM-QS600 Linux kernel is based on the Snapdragon 600 Linux Platform Ubuntu-based release by Linaro. We assume that you have created /home/development/cm-qs600/kernel directory for CM-QS600 kernel development.

Git clone

  • Install git version control system.
  • Create a clone of linux kernel tree
cd /home/development/cm-qs600/kernel
git clone git://git.linaro.org/landing-teams/working/qualcomm/kernel.git
  • Create a branch for CM-QS600 development. The CM-QS600 patches are generated vs. ubuntu-ifc6410-14.10 tag (602a30a57d9d3807df758221c2224e64a29e6fc7 commit) in the Linux tree. It is recommended to use exactly the same baseline to avoid merge conflicts.
cd /home/development/cm-qs600/kernel/linux-cm-qs600
git checkout -b cm-qs600-dev ubuntu-ifc6410-14.10
  • Apply the CM-QS600 patch
git apply /path/to/cm-qs600-linux/kernel/linux-3.4.0-14.10-cm-qs600-3.patch

Building the kernel

export ARCH=arm
export CROSS_COMPILE=arm-none-linux-eabi-
make cm_qs600_defconfig
make menuconfig
make && INSTALL_MOD_PATH=/home/development/cm-qs600/rootfs make modules_install

In the example above:

  • The Linux kernel image zImage will be created in /home/development/cm-qs600/kernel/linux-cm-qs600/arch/arm/boot
  • The loadable kernel modules will be installed into the /home/development/cm-qs600/rootfs/lib/modules directory.

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

Running developer kernel

CM-QS600 currently uses Little Kernel (LK) based application bootloader. The main aim of the application bootloader (LK) is loading and executing boot images from CM-QS600 storage device. The LK supports USB driver and fastboot protocol that enable obtaining developer images from remote host machine over USB connection. Images are obtained over USB can be either executed on the device or flashed onto main storage device (e.g. MMC, eMMC).

Getting Fastboot

CM-QS600 board comes with fastboot support, which means that the application bootloader (LK) implements the fastboot protocol. There are two sides to using fastboot

  • a host machine side,
  • and a target device side connected to the host via a USB cable.

In general fastboot is provided within the Android SDK. Also some Linux disributions provide fastboot within their package repositories. For example, on Ubuntu platform, fastboot may be obtained via android-tools-fastboot package.

Booting a developer kernel

Once a custom developer kernel image is built, it can be booted on CM-QS600. To boot CM-QS600 with a custom kernel image run the following fastboot command on the host machine:

fastboot boot -c <cmdline> -b 0x80200000 /home/development/cm-qs600/kernel/linux-cm-qs600/arch/arm/boot/zImage

Preparing LK-bootable image

Usually LK deals with special formatted boot.img images. Such image consists of boot header, kernel image, ramdisk and second stage images. Header and kernel sections.

  • Boot header describes the boot.img image layout, can carry other useful data, like board name and kernel command line.
  • Kernel is a required part of the boot.img file.
  • Ramdisk and Second stage images are optional.
Admolition note.png CM-QS600 default Linux does not use either Ramdisk or Second stage images.

A special utility named mkbootimg is used to create boot.img files. In general mkbootimg is provided within the Android SDK. Alternatively you can use a pre-built binary provided within the CM-QS600 Linux package. To create boot.img using a custom developer kernel image run the following command on the host machine:

/path/to/cm-qs600-linux/utilities/mkbootimg/linux-x86/mkbootimg  \
     --kernel /home/development/cm-qs600/kernel/linux-cm-qs600/arch/arm/boot/zImage \
     --ramdisk NONE --cmdline <cmdline> --base 0x80200000 --pagesize 2048 --output /home/development/cm-qs600/output/boot.img

In the example above the LK-bootable image boot.img will be created in the /home/development/cm-QS600/output directory. We assume this directory is created to hold custom bootable images.

Booting an LK-bootable image

Once a custom bootable image is created, it can be booted on CM-QS600. To boot CM-QS600 with a custom boot.img run the following fastboot command on the host machine:

fastboot boot /home/development/cm-QS600/output/boot.img

Flashing LK-bootable image on storage devices

Admolition warning.png It is strongly recommended to test the boot.img image priror to flashing it onto the storage device!

Once a custom bootable image is created, it can be flashed on the CM-QS600 storage device (e.g. MMC, eMMC).

fastboot flash boot /home/development/cm-QS600/output/boot.img

See also