CM-QS600: Linux: Kernel

From Compulab Mediawiki
Jump to: navigation, search

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.4.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

Basic platform support

The CM-QS600 basic platform support is implemented in several files with common prefix board-8064*.c found in the arch/arm/mach-msm/ directory of Linux kernel source tree. These files include default setup of multi-functional pins, registration of devices integrated in the CM-QS600 and platform-specific configuration.

HDMI and LVDS support

CM-QS600 module can be used with HDMI or LVDS display interfaces.

HDMI support

To enable HDMI support, in the kernel configuration menu choose Device Drivers ---> Graphics support submenu and enable:

  • MSM DRM - CONFIG_DRM_MSM
    • Enable legacy fbdev support for MSM modesetting driver - CONFIG_DRM_MSM_FBDEV
  ┌─────────────────────────── Graphics support ────────────────────────────┐
  │ ┌────^(-)─────────────────────────────────────────────────────────────┐ │
  │ │    < > DRM Support for bochs dispi vga interface (qemu stdvga)      │ │
  │ │    <*> MSM DRM                                                      │ │
  │ │    [*]   Enable legacy fbdev support for MSM modesetting driver     │ │
  │ │    [ ]   MSM DRM register logging                                   │ │
  │ │        Display Panels  --->                                         │ │
  │ │    < > Intel GMA500 Stub Driver                                     │ │
  │ └────┴(+)─────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Additionally, in the kernel configuration menu choose Device Drivers ---> Graphics support ---> Display Panels submenu and enable:

  • support for simple panels - CONFIG_DRM_PANEL_SIMPLE
  ┌──────────────────────────── Display Panels ─────────────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    <*> support for simple panels                                    │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

LVDS support

The CM-QS600 LVDS support has been tested with LVDS Chimei WXGA Panel. To enable LVDS support, in the kernel configuration menu choose Device Drivers ---> Graphics support submenu and enable:

  • MSM Framebuffer support - CONFIG_FB_MSM
    • Support for triple frame buffer - CONFIG_FB_MSM_TRIPLE_BUFFER
    • MDP HW version (MDP HW ver4.0) - CONFIG_FB_MSM_MDP40
    • MDP4 overlay support - CONFIG_FB_MSM_OVERLAY
    • Do not use mdp_pipe_ctrl - CONFIG_FB_MSM_NO_MDP_PIPE_CTRL
    • MDP overlay0 write back mode enable - CONFIG_FB_MSM_OVERLAY0_WRITEBACK
    • MDP overlay1 write back mode enable - CONFIG_FB_MSM_OVERLAY1_WRITEBACK
    • MDP overlay write back panel enable - CONFIG_FB_MSM_WRITEBACK_MSM_PANEL
  ┌─────────────────────────── Graphics support ────────────────────────────┐
  │ ┌────^(-)─────────────────────────────────────────────────────────────┐ │
  │ │    [ ] Enable Content Protection                                    │ │
  │ │    <*> MSM Framebuffer support                                      │ │
  │ │    [ ]   Support for backlight control                              │ │
  │ │    [ ]   MSM Frame Buffer Logo (NEW)                                │ │
  │ │    [*]   Support for triple frame buffer                            │ │
  │ │          MDP HW version (MDP HW ver4.0)  --->                       │ │
  │ │    [*]   MDP4 overlay support                                       │ │
  │ │    [ ]   LCDC ST1.5 Panel (NEW)                                     │ │
  │ │    [ ]   LCDC Truly HVGA PT Panel (NEW)                             │ │
  │ │    [ ]   LVDS Chimei WXGA Panel using Toshiba MIPI DSI-to-LVDS bridg│ │
  │ │    [ ]   LVDS Chimei WUXGA Panel using Toshiba MIPI DSI-to-LVDS brid│ │
  │ │    [*]   Do not use mdp_pipe_ctrl                                   │ │
  │ │    [*]   MDP overlay0 write back mode enable                        │ │
  │ │    [*]   MDP overlay1 write back mode enable                        │ │
  │ │    [*]   MDP overlay write back panel enable                        │ │
  │ │          LCD Panel (LVDS Chimei WXGA Panel)  --->                   │ │
  │ └────┴(+)─────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Additionally, in the kernel configuration menu choose Device Drivers ---> Graphics support ---> MSM Framebuffer support (LCD Panel) submenu and enable:

  • LVDS Chimei WXGA Panel - CONFIG_FB_MSM_LVDS_CHIMEI_WXGA_PANEL
     ┌──────────────────────────── LCD Panel ─────────────────────────────┐
     │ ┌──────────────^(-)──────────────────────────────────────────────┐ │
     │ │          ( ) LCDC Samsung OLED PT Panel                        │ │
     │ │          (X) LVDS Chimei WXGA Panel                            │ │
     │ │          ( ) LVDS LGE WVGA Panel                               │ │
     │ └──────────────┴(+)──────────────────────────────────────────────┘ │
     ├────────────────────────────────────────────────────────────────────┤
     │                       <Select>      < Help >                       │
     └────────────────────────────────────────────────────────────────────┘

Next, in the kernel configuration menu choose Device Drivers ---> Generic Driver Options submenu and enable:

  • Synchronization framework - CONFIG_SYNC
    • Software synchronization objects - CONFIG_SW_SYNC
  ┌──────────────────────── Generic Driver Options ─────────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    [*]   Enable a misc-device for userspace to access the genlock en│ │
  │ │    [*] Synchronization framework                                    │ │
  │ │    [*]   Software synchronization objects                           │ │
  │ │    [ ]     Userspace API for SW_SYNC (NEW)                          │ │
  │ │    [ ] Contiguous Memory Allocator (EXPERIMENTAL)                   │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Finally, in the kernel configuration menu choose Device Drivers ---> Graphics support ---> Console display driver support submenu and disable:

  • Framebuffer Console support - CONFIG_FRAMEBUFFER_CONSOLE
  ┌──────────────────── Console display driver support ─────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    < > Framebuffer Console support                                  │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Select video output

Default CM-QS600 video output device is HDMI. Other video output devices can be selected as shown below.

  • LVDS video output can be enabled by adding the following boot options to the kernel command line parameters:
prim_display=lvds_chimei_wxga

USB 3G Modem

USB 3G modem with mini PCIe adapter can be used by CM-QS600 for mobile broadband connections. Point-to-Point Protocol (PPP) is the protocol used for establishing internet links over dial-up modems, DSL connections, and many other types of point-to-point links. The pppd daemon works together with the kernel PPP driver to establish and maintain a PPP link with another system (called the peer) and to negotiate Internet Protocol (IP) addresses for each end of the link.

To enable PPP support, in the kernel configuration menu choose Device Drivers ---> Network device support submenu and enable:

  • PPP (point-to-point protocol) support - CONFIG_PPP
    • PPP BSD-Compress compression - CONFIG_PPP_BSDCOMP
    • PPP Deflate compression - CONFIG_PPP_DEFLATE
    • PPP support for async serial ports - CONFIG_PPP_ASYNC
    • PPP support for sync tty ports - CONFIG_PPP_SYNC_TTY
  ┌──────────────────────── Network device support ─────────────────────────┐
  │ ┌────^(-)─────────────────────────────────────────────────────────────┐ │
  │ │    <M>   PPP (point-to-point protocol) support                      │ │
  │ │    <M>     PPP BSD-Compress compression                             │ │
  │ │    <M>     PPP Deflate compression                                  │ │
  │ │    [*]     PPP filtering                                            │ │
  │ │    < >     PPP MPPE compression (encryption) (EXPERIMENTAL)         │ │
  │ │    [ ]     PPP multilink support (EXPERIMENTAL)                     │ │
  │ │    < >     PPP over Ethernet (EXPERIMENTAL)                         │ │
  │ │    < >     PPP on L2TP Access Concentrator                          │ │
  │ │    < >     PPP on PPTP Network Server                               │ │
  │ │    <M>     PPP support for async serial ports                       │ │
  │ │    <M>     PPP support for sync tty ports                           │ │
  │ └────┴(+)─────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Additionally, to enable USB modem support, in the kernel configuration menu choose Device Drivers ---> USB support submenu and enable:

  • USB Modem (CDC ACM) support - CONFIG_USB_ACM
  ┌────────────────────────────── USB support ──────────────────────────────┐
  │ ┌────^(-)─────────────────────────────────────────────────────────────┐ │  
  │ │    < >   Inventra Highspeed Dual Role Controller (TI, ADI, ...)     │ │  
  │ │          *** USB Device Class drivers ***                           │ │  
  │ │    <M>   USB Modem (CDC ACM) support                                │ │  
  │ │    < >   USB Printer support                                        │ │  
  │ └────┴(+)─────────────────────────────────────────────────────────────┘ │  
  ├─────────────────────────────────────────────────────────────────────────┤  
  │                    <Select>    < Exit >    < Help >                     │  
  └─────────────────────────────────────────────────────────────────────────┘  

WiFi and Bluetooth

CM-QS600 has WiFi and Bluetooth support based on QCA6234 WiFi/BT combo chip.

WiFi

CM-QS600 features 802.11b/g/n wireless interface, implemented with the QCA6234 Wireless module.

To enable WiFi support, in the kernel configuration menu choose Networking support ---> Wireless submenu and enable:

  • cfg80211 - wireless configuration API - CONFIG_CFG80211
  ┌─────────────────────────────── Wireless ────────────────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    --- Wireless                                                     │ │
  │ │    <M>   cfg80211 - wireless configuration API                      │ │
  │ │    [ ]     nl80211 testmode command                                 │ │
  │ │    [ ]     enable developer warnings                                │ │
  │ │    [ ]     cfg80211 regulatory debugging                            │ │
  │ │    [ ]     enable powersave by default                              │ │
  │ │    [ ]     cfg80211 DebugFS entries                                 │ │
  │ │    [ ]     use statically compiled regulatory rules database        │ │
  │ │    -*-     cfg80211 wireless extensions compatibility               │ │
  │ │    [ ]   Wireless extensions sysfs files                            │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

In the kernel configuration menu choose Device Drivers ---> Network device support ---> Wireless LAN submenu and enable:

  • Atheros Wireless Cards - CONFIG_ATH_COMMON
  ┌───────────────────────────── Wireless LAN ──────────────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    --- Wireless LAN                                                 │ │
  │ │    < >   Qualcomm WCNSS CORE driver                                 │ │
  │ │    <M>   Atheros Wireless Cards  --->                               │ │
  │ │    < >   Broadcom 4329/30 wireless cards support                    │ │  
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

In the kernel configuration menu choose Device Drivers ---> Network device support ---> Wireless LAN ---> Atheros Wireless Cards submenu and enable:

  • Atheros mobile chipsets support - CONFIG_ATH6KL
    • Atheros ath6kl SDIO support - CONFIG_ATH6KL_SDIO
  ┌──────────────────────── Atheros Wireless Cards ─────────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    --- Atheros Wireless Cards                                       │ │
  │ │    [ ]   Atheros wireless debugging                                 │ │
  │ │    [ ]   Atheros 5xxx PCI bus support                               │ │
  │ │    <M>   Atheros mobile chipsets support                            │ │
  │ │    <M>     Atheros ath6kl SDIO support                              │ │
  │ │    < >     Atheros ath6kl USB support                               │ │
  │ │    [ ]     Atheros ath6kl debugging                                 │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Bluetooth

CM-QS600 features Bluetooth 4.0 interface.

To enable Bluetooth support, in the kernel configuration menu choose Networking support submenu and enable:

  • Bluetooth subsystem support - CONFIG_BT
  ┌────────────────────────── Networking support ───────────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    --- Networking support                                           │ │
  │ │    < >   IrDA (infrared) subsystem support  --->                    │ │
  │ │    <*>   Bluetooth subsystem support  --->                          │ │
  │ │    < >   RxRPC session sockets                                      │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

In the kernel configuration menu choose Networking support ---> Bluetooth subsystem support submenu and enable:

  • RFCOMM protocol support - CONFIG_BT_RFCOMM
    • RFCOMM TTY support - CONFIG_BT_RFCOMM_TTY
  • BNEP protocol support - CONFIG_BT_BNEP
    • Multicast filter support - CONFIG_BT_BNEP_MC_FILTER
    • Protocol filter support - CONFIG_BT_BNEP_PROTO_FILTER
  • HIDP protocol support - CONFIG_BT_HIDP
  ┌────────────────────── Bluetooth subsystem support ──────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    --- Bluetooth subsystem support                                  │ │
  │ │    <*>   RFCOMM protocol support                                    │ │
  │ │    [*]     RFCOMM TTY support                                       │ │
  │ │    <*>   BNEP protocol support                                      │ │
  │ │    [*]     Multicast filter support                                 │ │
  │ │    [*]     Protocol filter support                                  │ │
  │ │    <*>   HIDP protocol support                                      │ │
  │ │          Bluetooth device drivers  --->                             │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

In the kernel configuration menu choose Networking support ---> Bluetooth subsystem support ---> Bluetooth device drivers submenu and enable:

  • HCI UART driver - CONFIG_BT_HCIUART
    • UART (H4) protocol support - CONFIG_BT_HCIUART_H4
    • Atheros AR300x serial support - CONFIG_BT_HCIUART_ATH3K
  ┌─────────────────────── Bluetooth device drivers ────────────────────────┐
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    < > HCI SDIO driver                                              │ │
  │ │    <*> HCI UART driver                                              │ │
  │ │    [*]   UART (H4) protocol support                                 │ │
  │ │    [ ]   BCSP protocol support                                      │ │
  │ │    [*]   Atheros AR300x serial support                              │ │
  │ │    [ ]   HCILL protocol support                                     │ │
  │ │    < > HCI BCM203x USB driver                                       │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

See also