Exeda: Linux: Kernel

From Compulab Mediawiki
Revision as of 08:44, 23 December 2009 by Mike (talk | contribs) (Linux kernel for Exeda moved to Exeda: Linux: Kernel)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

Linux kernel for Exeda package provides ready-to-run binary kernel image, and source code of the modifications and additions made to the Linux kernel to work properly with Exeda. Current support coverage is specified at O/S support coverage map page. The binary kernel image is bundled with minimal initramfs image to ease evaluation and development process. The Exeda users are free to choose the Linux flavor that suits best their specific application requirements.

This page includes description of the package structure, Linux installation procedure and peripheral device options specific to Exeda.

Package contents

images

  • uImage-2.6.30-exeda - Linux kernel 2.6.30 image for the Exeda
  • kernel.jffs2 - Linux kernel 2.6.30 JFFS2 image for NAND flash installation
  • ramdisk.tar.bz2 - archive of the ramdisk file system integrated into the kernel images
  • libertas - a directory containing firmware required for Wireless LAN operation

kernel

  • linux-2.6.30-exeda.patch - patch vs. Linux kernel 2.6.30 with support for the Exeda peripherals
  • linux-2.6.30-exeda.config - Linux kernel 2.6.30 configuration file

Running Linux

The Linux image for the Exeda can be installed to the Exeda NAND flash or can be executed from USB flash drive and even directly from your development workstation using networked boot. Execution from USB flash drive or network keeps the existing Windows Mobile installation intact.

Preparation steps

  • Connect the host PC to the Exeda via a null modem cable supplied with the Eval Kit.
  • Start terminal emulation software on your PC using the COM port to which the null modem is connected. Set baud rate to 115200 bps, 8 bit per frame, 1 stop bit, no parity, no flow control.
  • Turn on or reset the Exeda. The U-Boot will start and you will get a command prompt.
Admolition note.png You may need to press and hold ^C while turning the Exeda on, in order to get command prompt.

If you'd like to prevent U-boot from starting an operating system automatically, use the following commands:

> setenv boot_mode uboot
> saveenv

Running Linux from network

  • Make sure that Linux kernel binary image uImage-2.6.30-exeda from the Exeda Linux kernel package is accessible by the TFTP server.
    - On Windows machine: copy uImage-2.6.30-exeda to the some folder and point the TFTP server to that folder.
    - On Linux machine: copy uImage-2.6.30-exeda to TFTP sevrver root directory, usually /tftpboot or /tftproot.
  • You can use U-boot dhcp command to obtain IP address or manually set ipaddr and serverip environment variables:
> setenv serverip <tftp server ip address>
> setenv ipaddr <exeda ip address>
> saveenv
  • After networking setup is finished, use the following U-boot commands to boot Linux on the Exeda:
> tftp a0100000 uImage-2.6.30-exeda
> setenv bootargs
> bootm

Running Linux from USB flash drive

  • Copy uImage-2.6.30-exeda to USB flash drive
  • Insert the flash drive to the Exeda
  • In the U-Boot prompt run the following commands:
> setenv usb_mode host
> usb start
> fatload usb 0:1 a0100000 uImage-2.6.30-exeda
> setenv bootargs
> bootm a0100000

Installing Linux to the Exeda NAND flash

The Linux kernel image can be installed on the Exeda NAND flash either from U-Boot command prompt or from Linux. Below is a description of U-Boot commands necessary to install the Linux kernel image to the Exeda NAND flash. Linux-based installation utilizes MTD utilities and it is similar to Linux installation on CM-X300.


Admolition warning.png Installing Linux to the Exeda NAND flash will destroy preinstalled Windows Mobile image
  • Start Exeda and get U-Boot command prompt
  • Enable U-Boot NAND flash support, disable automatic Windows Mobile boot and reset the Exeda:
> setenv nand_mode on
> setenv boot_mode exeda-linux
> saveenv
> reset
  • Copy kernel.jffs2 image to the Exeda RAM
    • Using TFTP
      > dhcp
      > tftp a0100000 kernel.jffs2
      
    • Using USB flash drive
      > setenv usb_mode host
      > usb start
      > fatload usb 0:1 a0100000 kernel.jffs2
      
  • Erase the Exeda NAND flash and copy the Linux image to the NAND:
  • > nand erase 0 400000
    > nand write.jffs2 a0100000 0 3c0000
    
  • Setup the U-boot environment to automatically boot Linux:
    > setenv bootcmd "fsload a0100000 uImage; bootm a0100000"
    > setenv bootargs
    > saveenv
    

Exeda specific additions and changes to Linux kernel 2.6.30

The Exeda platform is supported by the mainline kernel. There are still some Exeda-specific features that are not present in the mainline kernel:

  • Fixes to suspend/resume functionality
  • Fixes to audio devices registration
  • Updates for wireless LAN support
  • Secondary USB port support
  • GPS and GSM/GPRS power control support
  • Touchpad support

Most of the above functionality will be available in the next release (2.6.31) of the mainline Linux kernel.

Building Linux kernel for Exeda

mkdir /home/development/exeda/kernel
cd /home/development/exeda/kernel
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.30.tar.bz2
tar xjf linux-2.6.30.tar.bz2
cd linux-2.6.30
cat /path/to/exeda-linux/kernel/linux-2.6.30-exeda.patch | patch -p1
export ARCH=arm
export CROSS_COMPILE=arm-linux-
make em_x270_defconfig
make menuconfig
make && make uImage && \
     INSTALL_MOD_PATH=/home/development/exeda/rootfs make modules_install

In the above example, the Linux kernel image (uImage) will be created in /home/development/exeda/kernel/linux-2.6.30/arch/arm/boot, and the loadable kernel modules will be installed into the /home/development/exeda/rootfs/lib/modules directory.

Now, if you boot the Exeda with newly created kernel image and with networked root filesysem at /home/development/exeda/rootfs/ the system will be able to properly load kernel modules and you avoid modules versioning problems.

Exeda specific device options

Certain on-board devices may be of particular interest for EM-X270 application developers. We provide here details of their operation in Linux for the Exeda.

GSM/GPRS modem

GSM/GPRS modem is connected to BTUART of PXA270 processor and can be accessed through /dev/ttyS1 device node. To enable the modem you can use the following command sequence:

echo 1 > /sys/devices/platform/reg-userspace-consumer.1/state
echo 132 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio132/direction
echo 0 > /sys/class/gpio/gpio132/value ; sleep 1; \
     echo 1 > /sys/class/gpio/gpio132/value; sleep 1; \
     echo 0 > /sys/class/gpio/gpio132/value; sleep 2

GPS receiver

GPS reciever is connected to STUART of PXA270 processor and can be accessed through /dev/ttyS2 device node. The GPS receiver can be enabled with the following command:

echo 1 > /sys/devices/platform/reg-userspace-consumer.0/state

Bluetooth

The Bluetooth can be enabled with the following command sequence:

echo 40 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio40/direction
echo 1 > /sys/class/gpio/gpio40/value

USB

Current kernel release for Exeda does not support USB OTG. The USB OTG port should be configured as a host or slave port during kernel configuration and build. The default kernel configuration enables the UBS OTG port in the host mode. If you'd like to use this port as a USB slave port you'll need to reconfigure and rebuild the kernel. In the kernel configuration choose "Device Drivers -> USB support" and enable "USB Gadget Support" option.

 .config - Linux Kernel v2.6.30 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌────────────────────────────── USB support ──────────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌────^(-)─────────────────────────────────────────────────────────────┐ │
  │ │    < >   PlayStation 2 Trance Vibrator driver support               │ │
  │ │    < >   IO Warrior driver support                                  │ │
  │ │    < >   USB testing driver                                         │ │
  │ │    < >   iSight firmware loading support                            │ │
  │ │    < >   USB VST driver                                             │ │
  │ │    <*>   USB Gadget Support  --->                                   │ │
  │ │          *** OTG and related infrastructure ***                     │ │
  │ │    < >   GPIO based peripheral-only VBUS sensing 'transceiver'      │ │
  │ │    < >   NOP USB Transceiver Driver                                 │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Then descend to the "USB Gadget Support" sub-menu, make sure that "USB Peripheral Controller" is set to "PXA 27x" and select the gadget drivers you'd like to use:

 .config - Linux Kernel v2.6.30 Configuration
 ──────────────────────────────────────────────────────────────────────────────
  ┌────────────────────────── USB Gadget Support ───────────────────────────┐
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> │
  │  for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < >       │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │    --- USB Gadget Support                                           │ │
  │ │    [ ]   Debugging messages (DEVELOPMENT) (NEW)                     │ │
  │ │    [ ]   Debugging information files (DEVELOPMENT) (NEW)            │ │
  │ │    [ ]   Debugging information files in debugfs (DEVELOPMENT) (NEW) │ │
  │ │    (2)   Maximum VBUS Power usage (2-500 mA) (NEW)                  │ │
  │ │          USB Peripheral Controller (PXA 27x)  --->                  │ │
  │ │            PXA 27x (NEW)                                            │ │
  │ │    <M>   USB Gadget Drivers                                         │ │
  │ │    <M>     Gadget Zero (DEVELOPMENT)                                │ │
  │ │    <M>     Ethernet Gadget (with CDC Ethernet support)              │ │
  │ │    [*]       RNDIS support (NEW)                                    │ │
  │ │    <M>     Gadget Filesystem (EXPERIMENTAL)                         │ │
  │ │    < >     File-backed Storage Gadget (NEW)                         │ │
  │ │    < >     Serial Gadget (with CDC ACM and CDC OBEX support) (NEW)  │ │
  │ │    < >     MIDI Gadget (EXPERIMENTAL) (NEW)                         │ │
  │ │    < >     Printer Gadget (NEW)                                     │ │
  │ │    < >     CDC Composite Device (Ethernet and ACM) (NEW)            │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

Known problems and limitations

  • Off-line battery charging is not implemented in the current release
  • USB OTG is not supported in the current release. The USB OTG port can be enabled either in USB host mode or in USB device mode.
  • Currently power consumption during suspend is above optimal.
  • Camera is not supported in the current release

See also