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

From Compulab Mediawiki
Jump to: navigation, search
(Flashing LK-bootable image on storage device)
 
(Flashing LK-bootable image on storage devices)
Line 14: Line 14:
  
 
=== Getting kernel sources ===
 
=== Getting kernel sources ===
 +
The CM-QS600 Linux kernel is based on the Snapdragon 600 Linux Platform Ubuntu-based [http://releases.linaro.org/14.09/ubuntu/ifc6410 release] by Linaro.
 
We assume that you have created {{filename|/home/development/cm-qs600/kernel}} directory for CM-QS600 kernel development.
 
We assume that you have created {{filename|/home/development/cm-qs600/kernel}} directory for CM-QS600 kernel development.
  
Line 21: Line 22:
 
<pre>
 
<pre>
 
cd /home/development/cm-qs600/kernel
 
cd /home/development/cm-qs600/kernel
git clone git://codeaurora.org/kernel/msm linux-cm-qs600
+
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. LNX.LA.2.7-06310-8960.0 tag (c4f1f8cec1e3c7e3526f6666939f22d23fcd8714 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.09 tag (d392f534aee60425fb23868c1164bfbe99e6d52b 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 LNX.LA.2.7-06310-8960.0
+
git checkout -b cm-qs600-dev ubuntu-ifc6410-14.09
 
</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-06310-cm-qs600-1.patch
+
git apply /path/to/cm-qs600-linux/kernel/linux-3.4.0-14.09-cm-qs600-2.patch
 
</pre>
 
</pre>
  
Line 47: Line 48:
 
* The loadable kernel modules will be installed into the {{filename|/home/development/cm-qs600/rootfs/lib/modules}} directory.
 
* The loadable kernel modules will be installed into the {{filename|/home/development/cm-qs600/rootfs/lib/modules}} directory.
  
When the CM-QS600 is booted with the kernel image and Device Tree binary created as described above and with networked root filesystem at {{filename|/home/development/cm-qs600/rootfs/}}, the system will be able to load the kernel modules properly, thus avoiding module version problems.
+
When the CM-QS600 is booted with the kernel image created as described above and with networked root filesystem at {{filename|/home/development/cm-qs600/rootfs/}}, the system will be able to load the kernel modules properly, thus avoiding module version problems.
  
 
== Running developer kernel ==
 
== Running developer kernel ==
Line 100: Line 101:
  
 
=== Flashing LK-bootable image on storage devices ===
 
=== Flashing LK-bootable image on storage devices ===
 +
{{Warning|It is strongly recommended to test the {{filename|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).
 
Once a custom bootable image is created, it can be flashed on the CM-QS600 storage device (e.g. MMC, eMMC).
 
<pre>
 
<pre>
 
fastboot flash boot /home/development/cm-QS600/output/boot.img
 
fastboot flash boot /home/development/cm-QS600/output/boot.img
 
</pre>
 
</pre>
 
: {{Warning|It is strongly recommended to test the {{filename|boot.img}} image priror to flashing it onto the storage device!}}
 
  
 
== See also ==
 
== See also ==

Revision as of 08:40, 29 September 2014

Overview

Linux kernel for CM-QS600 modules provide 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.09 tag (d392f534aee60425fb23868c1164bfbe99e6d52b 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.09
  • Apply the CM-QS600 patch
git apply /path/to/cm-qs600-linux/kernel/linux-3.4.0-14.09-cm-qs600-2.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