Utilite2 Linux Kernel

From Utilite Wiki

Jump to: navigation, search

Contents

Overview

Linux kernel for Utilite2 provides support for on-board peripherals and abstracts the functionality provided by the hardware.

Building kernel for Utilite2

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 Utilite2 Linux kernel is based on the Snapdragon 600 Linux Platform Ubuntu-based release by Linaro. In the following guide, we assume that /home/development/Utilite2/kernel directory path has been created for Utilite2 kernel development.

Linux git tree can be cloned or downloaded as a tarball from GitHub.

Git clone

  • Install git version control system.
  • Create a clone of linux kernel tree
# cd /home/development/Utilite2/kernel
# git clone git://github.com/utilite2/linux-kernel.git

Choosing git branches

There are several branches in the Utilite2 Linux kernel git repository.

  • The branch utilite2/master is always synchronized with the latest release.
  • The utilite2/devel is the developer branch and it contains most recent patches.

The script below can be used to fetch all Utilite2 branches:

#!/bin/bash
for branch in `git branch -r | grep -Ev "HEAD|master" `; do
   git branch --track ${branch#origin/} $branch
done

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/Utilite2/rootfs make modules_install

Please make sure the /home/development/Utilite2/rootfs directory is empty and does not contain any files or directories prior to building kernel modules.

Kernel image and modules locations

In the example above:

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

Kernel Version

  • In the example above, the Linux kernel release version number will be saved in /home/development/Utilite2/kernel/include/config/kernel.release
# cat /home/development/Utilite2/kernel/include/config/kernel.release

Deploying the Utilite2 kernel and modules

Preparing and running developer kernel

Utilite2 computer currently uses Little Kernel (LK) based application bootloader. The main aim of the application bootloader (LK) is loading and executing boot images from Utilite2 on-board eMMC boot storage device.

Boot image

In general a boot image is a data image composed of following sections:

  • Control Header
  • Linux Kernel binary (zImage)
  • Initial Ramdisk binary image
  • Second Stage Image (optional)

The boot image Control Header describes the image layout and carries other useful information like board name and kernel command line. The Utilite2 boot image includes first three sections (Header, Kernel and Ramdisk).

Preparing boot image

A special utility named abootimg is used to create boot images. Some Linux disributions provide abootimg utility within their package repositories. For example, on Ubuntu platform, abootimg utility may be obtained via abootimg package.

The abootimg utility obtains Linux Kernel binary and Initial Ramdisk image as input parameters. Additionally, it uses a special boot image configuration file which provides an essential information for a proper boot image creation. Please refer to the section Boot Configuration file in the abootimg project README file for more details.

To create a boot image based on a custom developer kernel perform the following steps:

  • Download the ramdisk image from the Linaro website and save it under name initrd.img.
  • Create a boot image configuration file bootimg.cfg using the following template:
bootsize = 0x900000
pagesize = 0x800
kerneladdr = 0x80208000
ramdiskaddr = 0x83000000
secondaddr = 0x81100000
tagsaddr = 0x80200100
name = cm-qs600 
cmdline = console=tty0 console=ttyHSL0,115200n8 root=<proper root device> rootwait rw
  • Obtain the kernel command line "root=" parameter string from the running Utilite2 computer:
utilite@utilite-desktop:~$ cat /proc/cmdline | tr " " "\n" | grep root=
root=UUID=cc9976ee-bde4-40d7-b460-7792fddd7a84
  • Edit bootimg.cfg by providing a proper root parameter in the kernel command line cmdline string.
  • Create boot image:
# abootimg --create /home/development/Utilite2/output/boot.img  \
     -f /path/to/bootimg.cfg \
     -k /home/development/cm-qs600/kernel/linux-cm-qs600/arch/arm/boot/zImage \
     -r /path/to/initrd.img

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

Preparing modules tarball

In the example below, Linux kernel modules are packed into the tar archive for deploying onto the Utilite2 computer.

  • Run the following command on the host machine:
# tar -C /home/development/Utilite2/rootfs -cjvf /home/development/Utilite2/utilite2-modules.tar.bz2 .

Fastboot

Utilite2 application botloader LK supports USB driver and fastboot protocol. This allows obtaining boot images from a remote host machine over a USB connection. There are two sides to using fastboot

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

Images obtained over USB can be either executed on the device or flashed onto main storage device (e.g. MMC, eMMC).

In general fastboot is provided within the Android SDK. Also some Linux distributions provide fastboot within their package repositories. For example, on Ubuntu platform, fastboot may be obtained via Template:Parameter package.

Testing developer boot image

The developer boot image can be loaded over fastboot protocol to the application bootloader (LK) and then run without need to flash it onto the storage device.

Admolition warning.png It is essential to test the developer boot image prior to flashing it onto the storage device permanently.
Admolition note.png As long as there is a valid boot image on the storage device (on-board eMMC), the application bootloader will load it automatically.
  • Prevent the automatic loading and force the Utilite2 enter the application bootloader (LK).
  • Connect the host PC to the Utilite2 computer USB OTG port via the USB to micro USB cable.
  • On the host PC check the Utilite2 is found in the list of connected devices
# fastboot devices
2369c0f fastboot
  • Run the following fastboot command on the host machine:
# fastboot boot /home/development/Utilite2/output/boot.img

Install developer images

Backup old boot image

Admolition warning.png It is essential to backup the old (known to work) kernel binary.
utilite@utilite-desktop:~$ sudo dd if=/dev/mmcblk0p7 of=/boot/boot-`uname -r`.img bs=1M count=9
9+0 records in
9+0 records out
9437184 bytes (9.4 MB) copied, 0.375427 s, 25.1 MB/s

Installing boot image

There are a few ways to flash the developer boot image to the on-board eMMC:

  • Transferring the boot image from the host PC to the Utilite2's application bootloader (LK) using fastboot with further flashing to the on-board eMMC.
  • Copying the boot image to the Utilite2 file system and with further flashing to the on-board eMMC using dd command line utility.
Installing boot image via fastboot
  • Run the following fastboot command on the host machine:
# fastboot flash boot /home/development/Utilite2/output/boot.img
Installing boot image from the Linux

We assume the boot.img binary has been copied to the Utilite2 /root directory.

  • Flash the boot image to the eMMC partition number 7 named boot:
utilite@utilite-desktop:/$ sudo dd if=/root/boot.img of=/dev/mmcblk0p7 bs=1M

Installing kernel modules

We assume the utilite2-modules.tar.bz2 tarball has been copied to the Utilite2 /root directory.

  • Extract and install Linux kernel modules:
utilite@utilite-desktop:/$ sudo tar -C / -xvf /root/utilite2-modules.tar.bz2

Basic platform support

The Utilite2 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 Utilite2 and platform-specific configuration.

USB 3G Modem

USB 3G modem with mini PCIe adapter can be used by Utilite2 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
  • PPP BSD-Compress compression
  • PPP Deflate compression
  • PPP support for async serial ports
  • PPP support for sync tty ports
  ┌──────────────────────── 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
  ┌────────────────────────────── 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

Utilite2 has WiFi and Bluetooth support based on QCA6234.

WiFi

Utilite2 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
  ┌─────────────────────────────── 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
  ┌───────────────────────────── 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
  • Atheros ath6kl SDIO support
  ┌──────────────────────── 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

Utilite2 features Bluetooth 4.0 interface.

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

  • Bluetooth subsystem support
  ┌────────────────────────── 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
  • RFCOMM TTY support
  • BNEP protocol support
  • Multicast filter support
  • Protocol filter support
  • HIDP protocol support
  ┌────────────────────── 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
  • UART (H4) protocol support
  • Atheros AR300x serial support
  ┌─────────────────────── 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 >                     │
  └─────────────────────────────────────────────────────────────────────────┘
Personal tools