Difference between revisions of "Debian Linux for Xscale modules"

From Compulab Mediawiki
Jump to: navigation, search
m (1 revision(s))
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
== Overview ==
 
== Overview ==
The Linux file system for CompuLab CM-X270 module is based on Debian GNU/Linux 3.1 (sarge) distribution and includes the following components:
+
The Linux file system for CompuLab CM-X270 module is based on Debian GNU/Linux 4.0 (etch) distribution and includes the following components:
 
* Package manager (apt-get, dpkg …)
 
* Package manager (apt-get, dpkg …)
 
* Telnet client
 
* Telnet client
Line 14: Line 14:
 
* Dillo (web browser), aterm – X Windows applications.
 
* Dillo (web browser), aterm – X Windows applications.
  
This package was designed specifically for CM-X270 module, but it was tested on CM-X255 module as well. Architectural differences are handled by kernel, therefore different kernel is provided per product. This package was tested with 2.6.12 and 2.6.16 kernels on X270 and with kernels 2.4.26, 2.6.7 and 2.6.12 on X255. Rest of the document refers only to X270, but the same instructions are also true for X255.
+
This package was designed specifically for CM-X270 module, but it was tested on CM-X255 module as well. Architectural differences are handled by kernel, therefore different kernel is provided per product. This package was tested with 2.6.16 and 2.6.24 kernels on X270 and with kernels 2.4.26, 2.6.7 and 2.6.12 on X255. Rest of the document refers only to X270, but the same instructions are also true for X255.
  
 
== CM-X270 specific settings ==
 
== CM-X270 specific settings ==
Line 39: Line 39:
 
=== IP Address ===
 
=== IP Address ===
 
The IP addresses for both network interface are obtained automatically using DHCP.
 
The IP addresses for both network interface are obtained automatically using DHCP.
To configure networking, edit ''/etc/network/interfaces'', ''/etc/resolv.conf'', and ''/etc/hostname''. For more information about Debian Linux network configuration read: [http://www.debian.org/doc/manuals/reference/ch-gateway.en.html]
+
To configure networking, edit ''/etc/network/interfaces'', ''/etc/resolv.conf'', and ''/etc/hostname''. For more information about Debian Linux network configuration read [http://www.debian.org/doc/manuals/reference/ch-gateway.en.html Network configuration] chapter in the [http://www.debian.org/doc/manuals/reference/index.en.html Debian Reference].
 
For kernel 2.6.12: Ethernet controller of CM-X270 is '''''eth1'''''; Ethernet controller of ATX or SB-X270 is  '''''eth0'''''.
 
For kernel 2.6.12: Ethernet controller of CM-X270 is '''''eth1'''''; Ethernet controller of ATX or SB-X270 is  '''''eth0'''''.
 
For other kernels Ethernet controller of CM-X270 is '''''eth0'''''; Ethernet controller of ATX or SB-X270 is  '''''eth1'''''.
 
For other kernels Ethernet controller of CM-X270 is '''''eth0'''''; Ethernet controller of ATX or SB-X270 is  '''''eth1'''''.
Line 57: Line 57:
 
CompuLab distribution contains small-footprint Kdrive based X Server optimized for embedded devices, and BlackBox window manager.
 
CompuLab distribution contains small-footprint Kdrive based X Server optimized for embedded devices, and BlackBox window manager.
 
Before starting X Windows, connect USB mouse and keyboard to the system.
 
Before starting X Windows, connect USB mouse and keyboard to the system.
You can run X Windows by typing '''''startx'''''. To close the X Windows, type '''''stopx'''''.
+
You can run X Windows by typing '''''startx'''''.
  
 
X server contained in CompuLab distribution supports screen rotation by 90, 180 and 270 degrees.
 
X server contained in CompuLab distribution supports screen rotation by 90, 180 and 270 degrees.
Line 76: Line 76:
 
<pre>
 
<pre>
 
modprobe snd-pxa2xx-ac97
 
modprobe snd-pxa2xx-ac97
modprobe ucb1x00-ts
+
modprobe ucb1400-ts
 
cd /sys/class/input
 
cd /sys/class/input
 
name=""
 
name=""
Line 83: Line 83:
 
         name=`cat $tsdir/name`
 
         name=`cat $tsdir/name`
 
     fi;
 
     fi;
     echo $name | grep "Touchscreen panel" >& /dev/null
+
     echo $name | grep -i "touchscreen" >& /dev/null
 
     if [ $? -eq 0 ] ; then
 
     if [ $? -eq 0 ] ; then
 
         name=`ls -1 $tsdir | grep event\[0-9\]`
 
         name=`ls -1 $tsdir | grep event\[0-9\]`
Line 97: Line 97:
  
 
=== Wireless lan support ===
 
=== Wireless lan support ===
CompuLab Debian Linux package supports Wireless LAN on CM-X270L modules. To enable Wireless LAN interface:
+
CompuLab Debian Linux package supports Wireless LAN on CM-X270L modules.
  
 +
To enable Wireless LAN interface type:
 
<pre>
 
<pre>
modprobe bgw200
+
modprobe gspi8xxx
 
</pre>
 
</pre>
  
To specify ESSID during driver startup:
+
The firmware for the Wireless LAN controller is included in the Debian Linux image and can be found at ''/lib/firmware'' directory. Additionally, the [http://www.compulab.co.il/x270cm/download/x270-linux-drv.zip Linux - kernel, drivers and patches] contains ''marvell-driver.tar.bz2'' archive with the the driver binary and firmware.
  
<pre>
+
To setup Wireless LAN parameters Linux standard [http://linux.die.net/man/8/ifconfig ifconfig], [http://linux.die.net/man/8/iwconfig iwconfig] and [http://linux.die.net/man/8/wpa_supplicant wpa_supplicant] utilities can be used.
modprobe bgw200 pu8SSID=<essid>
 
</pre>
 
 
 
To setup Wireless LAN parameters Linux standard ifconfig and iwconfig utilities can be used.
 
 
 
==== Using WEP with CM-X270L ====
 
The CM-X270L onboard Wireless LAN supports WEP (Wired Equivalency Privacy) security protocol. The following command sequence enables the WEP encryption on the CM-X270L:
 
 
 
<pre>
 
modprobe bgw200 pu8SSID=0
 
iwconfig eth1 key restricted [1] <KEY>
 
iwconfig eth1 key restricted [1]
 
iwconfig eth1 essid <ESSID>
 
</pre>
 
  
 
=== PC Card ===
 
=== PC Card ===
Line 147: Line 134:
 
</pre>
 
</pre>
  
{{note|
+
Note: The MMC and PCMCIA slot B interfaces share card detection pin, so to use MMC/SD interface on SB-X270, you will need either disable PCMCIA driver, or modify it so it will use only Slot A.
The MMC and PCMCIA slot B interfaces share card detection pin, so to use MMC/SD interface on SB-X270, you will need either disable PCMCIA driver, or modify it so it will use only Slot A.}}
 
 
 
== Software Management ==
 
=== Using the Debian Packaging System ===
 
The CM-X270 Linux distribution is a fully functional, small footprint Debian system. It requires ~90 MB of boot media. In order to fit this size, files not necessary for system functionality, including documentation and manuals, internationalization and localization support, and also package manager information, were removed.
 
The information needed to use Debian package management utilities  (apt and dpkg) is available from the [http://compulab.co.il/x270cm/download/x270-linux-img.zip Linux - Debian file system image] package in the archive ''packages.tar.gz''. To use this information, unpack the archive into a directory on your host machine:
 
  
<pre>
+
=== Power Management ===
tar –xzf packages.tag.gz –C /path/to/cm-x270/packages/
 
</pre>
 
  
add the following line to ''/etc/exports'':
+
Linux for CM-X270 supports suspend-to-RAM low power state. You can put the system into this state with {{cmd|apmsleep}} command.
  
<pre>
+
== Software Management ==
/path/to/cm-x270/packages/  \
 
  192.168.0.0/255.255.255.0(rw,no_root_squash,sync)
 
</pre>
 
 
 
As root, restart the NFS service on your host workstation to make the update of ''/etc/exports'' visible on the network:
 
 
 
<pre>
 
/etc/init.d/nfs restart
 
</pre>
 
 
 
On the CM-X270, mount the NFS directory containing packaging information to ''/mnt/net'':
 
 
 
<pre>
 
mount –t nfs 192.168.0.10:/path/to/cm-x270/packages/ /mnt/net
 
</pre>
 
 
 
From this point on, you can use the apt and dpkg utilities to manage Debian packages like in a desktop Debian system.
 
 
 
=== Modifiyng NAND Flash Contents ===
 
 
 
==== Modifying File System Image ====
 
The archive Disk.dat.zip in the [http://compulab.co.il/x270cm/download/x270-linux-img.zip Linux - Debian file system image] package contains the Linux ext3 file system image (''disk.dat''). This image can be mounted as a loop device and modified on the host Linux workstation:
 
<pre>
 
mount –t ext3 –o loop /path/to/disk.dat /path/to/mount/point
 
</pre>
 
 
 
After the modifications have been done, the image should be unmounted and it can be installed on the NAND flash on the CM-X270 using the procedure described in the [[CM-X270 Linux:Getting started]] document.
 
 
 
<pre>
 
umount /path/to/mount/point
 
… install the image to the target …
 
</pre>
 
 
 
==== Creating Images of Different Sizes ====
 
The NAND flash size on the CM-X270 is not necessary 512MB. It can be smaller 32, 64, 256 or 512 MB. The 512 MB file system image is not suitable for flash sizes other than 512 MB. Here is an example script for the creation of a 256 MB file system image. The new image will contain the same files as does the default ''disk.dat'' image.
 
 
 
<pre>
 
#!/bin/bash
 
 
 
cd /path/to/new/image/
 
 
 
# Create temporary directories
 
mkdir –p /tmp/srcimg
 
mkdir –p /tmp/destimg
 
 
 
# Create a placeholder for the new image
 
# Make image ~242 MB to fit it to NAND devices with bad blocks
 
dd if=/dev/zero of=256mb.img count=248472 bs=1024
 
 
 
# Format it using ext3 file system
 
mke2fs –F -j 256mb.img
 
 
 
# mount the new (empty) image
 
mount –t ext3 -o loop 256mb.img /tmp/destimg
 
 
 
# mount original image read only
 
mount –t ext3 -o loop,ro /path/to/old/image/disk.dat /tmp/srcimg
 
 
 
# copy files preserving device nodes, ownership, permissions and
 
# symbolic links
 
cp -a /tmp/srcimg/* /tmp/destimg
 
 
 
# unmount the images
 
umount /tmp/srcimg
 
umount /tmp/destimg
 
 
 
# flush disk caches to the physical storage
 
sync
 
 
 
# clean up
 
rm -rf /tmp/srcimg /tmp/destimg
 
</pre>
 
  
After running this script, the image ''/path/to/new/image/256mb.img'' will contain a file system suitable for a 256 MB NAND flash. This image can be installed on the CM-X270 using the procedure described in the [[CM-X270 Linix:Getting started]] document.
+
Debian Linux for CM-X270 image includes all the information required to use Debian package management utilities. You can use [http://linux.die.net/man/8/apt-get apt-get] and [http://www.wlug.org.nz/dpkg(8) dpkg] out of the box.
  
 
== Improving System Performance During Flash Writes ==
 
== Improving System Performance During Flash Writes ==
Line 253: Line 160:
 
== See also ==
 
== See also ==
  
* [[CM-X270 Linux:Getting started|CM-X270 Linux: Getting started]]
+
* [[Getting started with Linux on CM-X270]]
 
* [[Linux Development for XScale modules|Software Development for XScale modules]]
 
* [[Linux Development for XScale modules|Software Development for XScale modules]]
 
* [[CM-X270 Linux:Kernel|Linux kernels for CM-X270]]
 
* [[CM-X270 Linux:Kernel|Linux kernels for CM-X270]]
 
* [[Linux MTD drivers on CM-X270]]
 
* [[Linux MTD drivers on CM-X270]]

Latest revision as of 09:12, 23 November 2008

Overview

The Linux file system for CompuLab CM-X270 module is based on Debian GNU/Linux 4.0 (etch) distribution and includes the following components:

  • Package manager (apt-get, dpkg …)
  • Telnet client
  • SSH server/client
  • FTP server/client
  • Web server thttpd
  • SAMBA
  • Editor – nano
  • PCMCIA card manager
  • Various Linux utilities (basic Debian set of utilities from debootstrap)
  • Madplay - command-line mp3 player
  • X Windows system with BlackBox window manager
  • Dillo (web browser), aterm – X Windows applications.

This package was designed specifically for CM-X270 module, but it was tested on CM-X255 module as well. Architectural differences are handled by kernel, therefore different kernel is provided per product. This package was tested with 2.6.16 and 2.6.24 kernels on X270 and with kernels 2.4.26, 2.6.7 and 2.6.12 on X255. Rest of the document refers only to X270, but the same instructions are also true for X255.

CM-X270 specific settings

Connection and Logging In

Use the following usernames and passwords to login:

Account with administrative privileges:

User: root
Password: 111111

Regular user account:

User: user	
Password: 111111

In addition to these accounts CM-X270 allows anonymous FTP access. To login into the Linux system, you may use a serial console at 38400 bps (ttySA0 for Linux 2.6.16 and ttyS0 for previous Linux versions), or connect through the network, or use a keyboard and VGA display (tty1, tty2, tty3).

IP Address

The IP addresses for both network interface are obtained automatically using DHCP. To configure networking, edit /etc/network/interfaces, /etc/resolv.conf, and /etc/hostname. For more information about Debian Linux network configuration read Network configuration chapter in the Debian Reference. For kernel 2.6.12: Ethernet controller of CM-X270 is eth1; Ethernet controller of ATX or SB-X270 is eth0. For other kernels Ethernet controller of CM-X270 is eth0; Ethernet controller of ATX or SB-X270 is eth1.

Consoles

Linux file system image is designed to suit different kernel versions and configurations. Therefore, during the operating system startup, consoles at several serial ports and VGA display are enabled. Some of these devices may not be supported either because of kernel versions incompatibilities or because the kernel was not configured to support these devices. When the console is enabled at such device the following or similar message will appear on active console: INIT: Id "T0" respawning too fast: disabled for 5 minutes This is not an error message, it is just a warning that can be eliminated by editing /etc/inittab file.

THTTPD Web Server

Use /etc/thttpd/thttpd.conf to configure THTTPD web server. The THTTP server is very sensitive to file permissions. In summary, data files should be mode 644 (rw-r--r--), directories should be 755 (rwxr-xr-x) if you want to allow indexing and 711 (rwx--x--x) to disallow it, and CGI programs should be mode 755 (rwxr-xr-x) or 711 (rwx--x--x). Try http://<your.target.ip.address>/users/thttpd.htm

X Windows system

CompuLab distribution contains small-footprint Kdrive based X Server optimized for embedded devices, and BlackBox window manager. Before starting X Windows, connect USB mouse and keyboard to the system. You can run X Windows by typing startx.

X server contained in CompuLab distribution supports screen rotation by 90, 180 and 270 degrees. To change screen resolution or color depth, or to enable screen rotation append option -screen <XRes>x<YRes>@<angle>x<bpp> option to X Server invocation command. XRes and YRes are horizontal and vertical screen resolution and angle is desired rotation angle, and bpp is color depth in bits. Note, that color depth change is not fully supported on PXA frame buffer device.

The X Windows system on CM-X270W can utilize either CPU internal LCD controller or 2700G graphics accelerator. Therefore, to choose the device, the "startx" utility must be provided with one of two options:

  • -fb – to run X Server using CPU internal LCD controller
  • -2700G – to run X Server using 2700G graphics accelerator

There are some X applications in distribution:

  • Aterm (X terminal)
  • Dillo (Web browser)

Touchscreen support

The X Windows system provided with CompuLab Debian Linux package supports touchscreen interface using on UCB1400 controller. Touchscreen calibration can be performed with ts_calibrate utility. To calibrate the touchscreen make sure X Server is not running, load touchscreen driver and then type ts_calibrate:

modprobe snd-pxa2xx-ac97
modprobe ucb1400-ts
cd /sys/class/input
name=""
for tsdir in *; do
    if [ -f $tsdir/name ] ; then
        name=`cat $tsdir/name`
    fi;
    echo $name | grep -i "touchscreen" >& /dev/null
    if [ $? -eq 0 ] ; then
        name=`ls -1 $tsdir | grep event\[0-9\]`
        break;
    fi;
done;
export TSLIB_TSDEVICE=/dev/input/$name
ts_calibrate

For proper calibration you are required to touch the touchscreen corners and center in the following order: top-left, top-right, bottom-right, bottom-left, center. The calibration results are saved to file /etc/pointercal.

Wireless lan support

CompuLab Debian Linux package supports Wireless LAN on CM-X270L modules.

To enable Wireless LAN interface type:

modprobe gspi8xxx

The firmware for the Wireless LAN controller is included in the Debian Linux image and can be found at /lib/firmware directory. Additionally, the Linux - kernel, drivers and patches contains marvell-driver.tar.bz2 archive with the the driver binary and firmware.

To setup Wireless LAN parameters Linux standard ifconfig, iwconfig and wpa_supplicant utilities can be used.

PC Card

The PC Card market confuses people with differences in terminology sometimes referring to 16-bit PCMCIA cards as CompactFlash, and sometimes calling 32-bit cards PCMCIA. CM-X270 uses completely different interfaces to access 16-bit and 32-bit cards, so here we make some clarifications about terminology we use, and restrictions on PC Card usage. The PXA270 internal PCMCIA controller is used to access all types of 16-bit cards. Therefore we call all 16-bit cards PCMCIA. On the other side, 32-bit cards are accessed through CardBus controller present on the ATXBase, therefore we call all the types of 32-bit cards CardBus.

Debian linux for CM-X270 tries to detect presence of the CardBus controller, and accrording to the detection results it loads an appropriate driver. Either pxa2xx-cs for PXA270 internal PCMCIA (16-bit) controller, or yenta_socket for external CardBus controller.

In general, the CardBus controller should also work with 16-bit cards, but currently this feature is not supported by our Linux kernel.

Several PCMCIA devices have been validated with the CM-X270 – ATA Flash Disk card, NE2000 compatible Ethernet. Their drivers are provided with the kernel. However, there should be no problems using other PCMCIA cards. You just have to compile the driver of the device either built into the kernel or as a loadable kerne module. If compiled as module, it should be placed in an appropriate directory under /lib/modules/ on the CM-X270.

MMC/SD

The support for MMC/SD card on CM-X270 is available as loadable kernel module. You need to

modprobe mmc_block
modprobe pxamci

to enable these drivers.

Afterwards, to mount the memory card, monitor /proc/partitions to see what partitions were detected on the MMC/SD card. Next, if there's approptiate device node in /dev, you can directly mount it, otherwise you should create the device node first. For example, suppose MMC/SD partition you'like to mount is mmcblk0p1 then:

if [ ! -b /dev/mmcblk0p1 ]; then mknod /dev/mmcblk0p1 b 253 1; fi
mount /dev/mmcblk0p1 /mnt/mmc

Note: The MMC and PCMCIA slot B interfaces share card detection pin, so to use MMC/SD interface on SB-X270, you will need either disable PCMCIA driver, or modify it so it will use only Slot A.

Power Management

Linux for CM-X270 supports suspend-to-RAM low power state. You can put the system into this state with apmsleep command.

Software Management

Debian Linux for CM-X270 image includes all the information required to use Debian package management utilities. You can use apt-get and dpkg out of the box.

Improving System Performance During Flash Writes

System performance is affected if an application intensively writes to the NAND flash, because:

  • Flash write operations sometimes disable interrupts for significant periods.
  • Flash write operations are performed by CPU (rather than DMA) loops.
  • Parts of the NAND code driver run at the kernel's priority. If it runs for long periods, application timeshare is diminished.

To minimize the effect of flash writing, it is recommended to utilize a write throttling policy: On the application level, divide store operations of large files to blocks between 16 to 128 KB each, and allow idle time between consequent blocks (the application can proceed with other tasks). No need to close and re-open the file between blocks. Take into account that in case of a power fail, open files can lose contents accumulated during the last five seconds since the file was opened.

In addition to intensive application writes to the NAND flash, system performance may be affected by ext3 periodic journaling operations. To minimize the effect of ext3 journaling, the following actions might be taken:

  • Minimize ext3 journal size (see mke2fs manual page)
  • Disable/minimize system logging facilities or/and write system logs to ramdisk or tmpfs mounted partition.
  • Create several partitions on the NAND flash. The partition containing the Linux system should be explicitly mounted as read-only. The partition needed for application writes should be made as small as possible thus decreasing ext3 journal size.

See also