Difference between revisions of "Gentoo Linux for CM-iGLX"

From Compulab Mediawiki
Jump to: navigation, search
(New page: == Introduction == Linux for CM-iGLX module is based on Gentoo Linux 2006.1. The [http://www.compulab.co.il/iglx/download/iglx-linux.zip CompuLab Linux package for CM-iGLX] includes read...)
 
Line 1: Line 1:
 
== Introduction ==  
 
== Introduction ==  
  
Linux for CM-iGLX module is based on Gentoo Linux 2006.1. The
+
Linux for CM-iGLX module is based on Gentoo Linux 2006.1. The [http://www.compulab.co.il/iglx/download/iglx-linux.zip CompuLab Linux package for CM-iGLX] includes ready to run USB NAND flash image, Linux kernel configuration and source code patches, portage tree used to create the image, packages database archive, and graphics and touchscreen driver sources.  The [[CM-iGLX Linux:Getting started]] page gives brief introduction on how to setup and start using the run-time Linux image. Here we describe in more detail image structure, and also provide guidelines for image modification, and even creation of your own Gentoo Linux for CM-iGLX.
[http://www.compulab.co.il/iglx/download/iglx-linux.zip CompuLab
 
Linux package for CM-iGLX] includes ready to run USB NAND flash image,
 
Linux kernel configuration and source code patches, portage tree used
 
to create the image, packages database archive, and graphics and
 
touchscreen driver sources.  The [[CM-iGLX Linux:Getting started]] page gives brief introduction on how to setup and start
 
using the run-time Linux image. Here we describe in more detail image
 
structure, and also provide guidelines for image modification, and even
 
creation of your own Gentoo Linux for CM-iGLX.
 
  
The Linux image we provide is made as generic as possible. It includes
+
The Linux image we provide is made as generic as possible. It includes more then 200 packages, among them KDE, mplayer, thttpd web server, and Samba Windows connectivity suite. Still, it is impossible to fit into 512Mbytes each and every Linux application and make it suitable for all possible designs based on CM-iGLX.  
more then 200 packages, among them KDE, mplayer, thttpd web server,
 
and Samba Windows connectivity suite.
 
Still, it is impossible to fit into 512Mbytes each and every Linux
 
application and make it suitable for all possible designs based on
 
CM-iGLX.  
 
  
Deafult image for CM-iGLX leaves moderate amount of the free space to
+
Deafult image for CM-iGLX leaves moderate amount of the free space to the user application. If you don't need printer support you can run
the user application. If you don't need printer support you can run
+
{{cmd|remove.printers}} script that will free ~30Mbytes. Moreover, if you're not planning to use KDE, you can run {{cmd|remove.kde}} script that will free more than 100Mbytes.
{{cmd|1=remove.printers}} script that will free ~30Mbytes. Moreover, if you're
 
not planning to use KDE, you can run {{cmd|1=remove.kde}} script that will
 
free more than 100Mbytes.
 
  
 
== Package contents ==
 
== Package contents ==
Line 31: Line 15:
 
=== gentoo.img.gz ===  
 
=== gentoo.img.gz ===  
  
{{filename|1=gentoo.img.gz}} is ready-to-run disk image with Linux for CM-iGLX. It
+
{{filename|gentoo.img.gz}} is ready-to-run disk image with Linux for CM-iGLX. It can be installed onto the on-board NAND flash as described at [[CM-iGLX Linux:Getting started|Getting started]] page. The {{filename|gentoo.img}} is a complete disk image, containing partition table
can be installed onto the on-board NAND flash as described at [[CM-iGLX Linux:Getting started|Getting started]] page.
+
and two partitions: {{filename|/boot}} and {{filename|/}}. The {{filename|/boot}} partition is ~10Mbytes and it is used to store bootloader and Linux kernel. The rest of the image is the {{filename|/}} partition containing root filesystem. Each of the partitions can be loop-mounted and modified on the host workstation, e.g. using {{cmd|image_mount.sh}} utility.
The {{filename|1=gentoo.img}} is a complete disk image, containing partition table
 
and two partitions: {{filename|1=/boot}} and {{filename|1=/}}. The {{filename|1=/boot}} partition is
 
~10Mbytes and it is used to store bootloader and Linux kernel.
 
The rest of the image is the {{filename|1=/}} partition containing root filesystem.
 
Each of the partitions can be loop-mounted and modified on the host
 
workstation, e.g. using {{cmd|1=image_mount.sh}} utility.
 
  
 
=== kernel ===  
 
=== kernel ===  
  
{{filename|1=kernel}} directory contains Linux kernel binary
+
{{filename|kernel}} directory contains Linux kernel binary
({{filename|1=vmlinux-2.6.20-cm-iglx}}), a copy of {{filename1=.config}} used to build the
+
({{filename|vmlinux-2.6.20-cm-iglx}}), a copy of {{filename|.config}} used to build the kernel ({{filename|linux-2.6.20.config}}) and the modification of the kernel source made to support CM-iGLX devices. These modifications are available as patch vs. standard
kernel ({{filename|1=linux-2.6.20.config}}) and the modification of the kernel
 
source made to support CM-iGLX devices. These modifications are
 
available as patch vs. standard
 
 
[http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2 Linux  
 
[http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2 Linux  
kernel 2.6.20]. ({{filename|1=linux-2.6.20.pacth}})
+
kernel 2.6.20]. ({{filename|linux-2.6.20.pacth}})
  
package_management
+
=== package_management ===
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)[[User:Mike|Mike]]
 
`package_management` directory contains information needed to use
 
Portage installer to add/remove/update packages for CM-iGLX.
 
The `portage.tar.bz2` is the Portage tree used to create the CM-iGLX
 
run-time image.
 
The `var-db-pkg.tar.bz2` is the information about packages installed
 
on CM-iGLX.
 
Package management is described in more detail <<PKG_MGMT,here>>
 
  
drivers
+
{{filename|package_management}} directory contains information needed to use Portage installer to add/remove/update packages for CM-iGLX.
05:05, 10 March 2008 (EDT)~~
+
The {{filename|portage.tar.bz2}} is the Portage tree used to create the CM-iGLX run-time image.
`drivers` directory contains user-space drivers that are not included
+
The {{filename|var-db-pkg.tar.bz2}} is the information about packages installed on CM-iGLX.
in standard Gentoo packages:
+
Package management is described in more detail [[#Package Management|here]]
  
* `*rt73*` - Wireless LAN driver
+
=== drivers ===
* `*xf86-video-amd*` - accelerated video driver for X11 utilizing GeodeLX
+
 
  graphics accelerator.
+
{{filename|drivers}} directory contains user-space drivers that are not included in standard Gentoo packages:
* `*xf86-input-evtouch*` - X11 touchscreen driver
+
 
 +
* {{filename|rt73}} - Wireless LAN driver
 +
* {{filename|xf86-video-amd}} - accelerated video driver for X11 utilizing GeodeLX graphics accelerator.
 +
* {{filename|xf86-input-evtouch}} - X11 touchscreen driver
 +
 
 +
=== scripts ===
  
scripts
 
05:05, 10 March 2008 (EDT)~~
 
 
Miscellaneous useful scripts (currently only one)
 
Miscellaneous useful scripts (currently only one)
  
* `*image_mount.sh*` - utility to mount partitions on run-time image
+
* {{filename|image_mount.sh}} - utility to mount partitions on run-time image
 +
 
 +
== Linux Kernel and Drivers ==
 +
 
 +
=== Kernel compilation ===
 +
 
 +
Linux kernel for CM-iGLX is based on version 2.6.20 with addition of GeodeLX frame buffer drivers from AMD, and drivers for
 +
on-board WM9715 touchscreen controller. The changes and additions to the Linux kernel for CM-iGLX are available as patch generated versus
 +
[http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2 Linux kernel 2.6.20].
 +
 
 +
The following example demonstrates how to compile Linux kernel for CM-iGLX:
  
Linux Kernel and Drivers
+
<pre>
------------------------
+
mkdir /path/to/cm-iglx/kernel/
Kernel compilation
+
cd /path/to/cm-iglx/kernel/
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)[[User:Mike|Mike]]
+
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2
Linux kernel for CM-iGLX is based on version 2.6.20 with
+
tar xjf linux-2.6.20.tar.bz2
addition of GeodeLX frame buffer drivers from AMD, and drivers for
+
cd linux-2.6.20
on-board WM9715 touchscreen controller.
+
patch -p1 < /path/to/compulab/package/linux-2.6.20.patch
The changes and additions to the Linux kernel for CM-iGLX are available
+
cp /path/to/compulab/package/linux-2.6.20.config .config
as patch generated versus
+
make menuconfig
link:http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2[Linux
+
make && INSTALL_MOD_PATH=/path/to/target make modules_install
kernel 2.6.20].
+
</pre>
  
The following example demonstrates how to compile Linux kernel for
+
Note, that after the compilation is finished the drivers compiled as loadable kernel modules will be stored in
CM-iGLX:
+
{{filename|/path/to/target/lib/modules/<kernel version>/}} directory. This directory should be transfered to the CM-iGLX root file system.
  
-----------------------------------------------------------------------
+
Additional information about kernel build process can be found in {{filename|README}} file in the kernel source tree.
# mkdir /path/to/cm-iglx/kernel/
 
# cd /path/to/cm-iglx/kernel/
 
# wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2
 
# tar xjf linux-2.6.20.tar.bz2
 
# cd linux-2.6.20
 
# patch -p1 < /path/to/compulab/package/linux-2.6.20.patch
 
# cp /path/to/compulab/package/linux-2.6.20.config .config
 
# make menuconfig
 
# make && INSTALL_MOD_PATH=/path/to/target make modules_install
 
-----------------------------------------------------------------------
 
  
Note, that after the compilation is finished the drivers compiled as
+
=== Graphics support ===
loadable kernel modules will be stored in
 
`/path/to/target/lib/modules/<kernel version>/` directory. This
 
directory should be transfered to the CM-iGLX root file system.
 
  
Additional information about kernel build process can be found in
+
==== Kernel ====
README file in the kernel source tree.
 
  
Graphics support
+
We added driver GeodeLX frame buffer device. It's implementation resides in  {{filename|drivers/video/geode}} and {{filename|lib/cimmaron}} in the kernel source tree.
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)~
 
  
Kernel
+
==== X11 ====
^^^^^^
 
We added driver GeodeLX frame buffer device. It's implementation
 
resides in  `drivers/video/geode` and `lib/cimmaron` in the kernel
 
source tree.
 
  
X11
+
X11-specific graphics driver included in CM-iGLX image was complied from source files located at {{filename|drivers/xf86-video-amd.tar.bz2}} in our
^^^
 
X11-specific graphics driver included in CM-iGLX image was complied
 
from source files located at `drivers/xf86-video-amd.tar.bz2` in our
 
 
Linux package.
 
Linux package.
  
Custom LCD configuration
+
===== Custom LCD configuration =====
^^^^^^^^^^^^^^^^^^^^^^^^
+
 
You can adjust X server to support displays with non-standard resolution.
+
You can adjust X server to support displays with non-standard resolution. To do so you need to edit {{filename|/etc/X11/xorg.conf}} configuration file.
To do so you need to edit /etc/X11/xorg.conf configure file.
 
  
 
There are some fundamental things you need to know before hacking a xorg.conf. These are:
 
There are some fundamental things you need to know before hacking a xorg.conf. These are:
Your monitor's horizontal and vertical sync frequency options
+
 
Your video adapter's driving clock frequencies, or "dot clocks"
+
* Your monitor's horizontal and vertical sync frequency options
 +
* Your video adapter's driving clock frequencies, or "dot clocks"
  
 
The horizontal sync frequency is just the number of times per second the monitor can write a horizontal scan line; it is the single most important statistic about your monitor. The vertical sync frequency is the number of times per second the monitor can traverse its beam vertically.
 
The horizontal sync frequency is just the number of times per second the monitor can write a horizontal scan line; it is the single most important statistic about your monitor. The vertical sync frequency is the number of times per second the monitor can traverse its beam vertically.
Line 147: Line 105:
 
Your target is to create appropriate "modeline", for example:
 
Your target is to create appropriate "modeline", for example:
  
---------------------------------------------------------------
+
<pre>
 
#Modename clock  horizontal timing    vertical timing
 
#Modename clock  horizontal timing    vertical timing
 
"752x564"    40    752 784  944 1088    564 567 569 611
 
"752x564"    40    752 784  944 1088    564 567 569 611
---------------------------------------------------------------
+
</pre>
  
 
The horizontal section consists of four fields, which specify how each horizontal line on the display is to be generated.
 
The horizontal section consists of four fields, which specify how each horizontal line on the display is to be generated.
Line 162: Line 120:
 
Choose the desired refresh rate (for example 60 Hz) to obtain appropriate dot-clock frequency:
 
Choose the desired refresh rate (for example 60 Hz) to obtain appropriate dot-clock frequency:
  
.......................................................
+
----
 
Dot-clock frequency = 1088*611*60 Hz = 40 MHz ("clock" field in "modeline").
 
Dot-clock frequency = 1088*611*60 Hz = 40 MHz ("clock" field in "modeline").
.......................................................
+
----
  
 
Ensure that it in range of supported by CM-iGLX video adapter's frequencies. Ensure that horizontal and vertical sync frequencies are supported by your display.
 
Ensure that it in range of supported by CM-iGLX video adapter's frequencies. Ensure that horizontal and vertical sync frequencies are supported by your display.
  
Now it's time to edit your /etc/X11/xorg.conf.
+
Now it's time to edit your {{filename|/etc/X11/xorg.conf}}.
  
 
Find section named "Monitor" and add lines:
 
Find section named "Monitor" and add lines:
  
------------------------------------------------------
+
<pre>
 
UseModes "Custom"
 
UseModes "Custom"
 
HorizSync 30 - 50
 
HorizSync 30 - 50
 
VertRefresh 65 - 72
 
VertRefresh 65 - 72
------------------------------------------------------
+
</pre>
(Don't forget to specify values of your display!)
+
 
 +
(Don't forget to specify values of your display!)
  
 
Find section named "Screen" and add lines:
 
Find section named "Screen" and add lines:
------------------------------------------------------
+
 
 +
<pre>
 
SubSection "Display"
 
SubSection "Display"
 
Depth    16
 
Depth    16
Line 186: Line 146:
 
Modes    "752x564"
 
Modes    "752x564"
 
EndSubSection
 
EndSubSection
------------------------------------------------------
+
</pre>
  
 
Add section named "Modes" with the following content:
 
Add section named "Modes" with the following content:
  
------------------------------------------------------
+
<pre>
 
Section "Modes"
 
Section "Modes"
 
Identifier "Custom"
 
Identifier "Custom"
 
ModeLine  "752x564" 40 752 784 944 1088   564 567 569 611 +hsync +vsync
 
ModeLine  "752x564" 40 752 784 944 1088   564 567 569 611 +hsync +vsync
 
EndSection
 
EndSection
------------------------------------------------------
+
</pre>
  
 
Save the file and restart X server.
 
Save the file and restart X server.
  
 
For more information please visit these links:
 
For more information please visit these links:
link:http://tldp.org/HOWTO/XFree86-Video-Timings-HOWTO/[]
+
[http://tldp.org/HOWTO/XFree86-Video-Timings-HOWTO/]
link:http://www.x.org/archive/X11R6.8.0/doc/xorg.conf.5.html[]
+
[http://www.x.org/archive/X11R6.8.0/doc/xorg.conf.5.html]
  
Touchscreen support
+
=== Touchscreen support ===
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)[[User:Mike|Mike]] 05:05, 10 March 2008 (EDT)
 
  
Kernel
+
==== Kernel ====
^^^^^^
 
  
Wolfson WM97xx touchscreen controller
+
The kernel driver for WM97xx touchscreen controller can be found in {{filename|drivers/input/touchscreen/wm97xx}}. The driver has several parameters, that can be modified to adopt the driver behaviour to particular touchscreens and application needs:
+++++++++++++++++++++++++++++++++++++
 
  
The kernel driver for WM97xx touchscreen controller can be found in
+
* {{parameter|dejitter_history}} - touchscreen dejitter filter history length
`drivers/input/touchscreen/wm97xx.*`.
+
* {{parameter|enable_btn}} - enable/disbale BUTTON_* events.
The driver has several parameters, that can be modified to adopt the
+
* {{parameter|abs_x}} - touchscreen absolute X min, max, fuzz
driver behaviour to particular touchscreens and application needs:
+
* {{parameter|abs_y}} - touchscreen absolute Y min, max, fuzz
 +
* {{parameter|rpu}} - set internal pull up resitor for pen detect
 +
* {{parameter|pil}} - set current used for pressure measurement
 +
* {{parameter|pressure}} - set threshold for pressure measurement
 +
* {{parameter|delay}} - set adc sample delay
  
* `*dejitter_history*` - touchscreen dejitter filter history length
+
==== X11 ====
* `*enable_btn*` - enable/disbale BUTTON_* events.
 
* `*abs_x*` - touchscreen absolute X min, max, fuzz
 
* `*abs_y*` - touchscreen absolute Y min, max, fuzz
 
* `*rpu*` - set internal pull up resitor for pen detect
 
* `*pil*` - set current used for pressure measurement
 
* `*pressure*` - set threshold for pressure measurement
 
* `*delay*` - set adc sample delay
 
  
NXP UCB1400 touchscreen controller
+
X11-specific touchscreen driver included in CM-iGLX image was complied from source files located at {{filename|drivers/xf86-input-evtouch.tar.bz2}} in our Linux package.
++++++++++++++++++++++++++++++++++
 
  
There are older CM-iGLX board assembled with UCB1400 touchscreen
+
===== Calibration utility =====
controller. We provide two drivers for this controller - `ucb1400_ts`,
 
the driver present in the kernel mainline, and also older version of
 
that driver, `ucb1x00_ts`, being in use for a while on ARM-based
 
platforms. By default the `ucb1400_ts` driver is loaded automatically
 
at the system startup (see `/etc/modules.autoload.d/kernel-2.6`)
 
  
X11
+
The touchscreen calibration utility {{cmd|ev_calibrate}} is a part of the image.  Please consult {{filename|/usr/share/mnt/xf86-input-evtouch/README}} for touchscreen calibration instructions.
^^^
 
X11-specific touchscreen driver included in CM-iGLX image was complied
 
from source files located at `drivers/xf86-input-evtouch.tar.bz2` in our
 
Linux package.
 
  
Calibration utility
+
== Software management and development ==
^^^^^^^^^^^^^^^^^^^
 
The touchscreen calibration utility `ev_calibrate` is a part of the
 
image.  Please consult `/usr/share/mnt/xf86-input-evtouch/README` for
 
touchscreen calibration instructions.
 
  
 +
The software packages for CM-iGLX were prepared in a way very similar to described below. If you setup your host workstation in the way we
 +
describe here, you'll be able to add/remove Gentoo packages for your target system using Portage environment, develop and test your
 +
application of the host workstation, and finally choose what packages, and files you want to deploy to your production target.
  
[[SW_MGMT]]
+
=== Host side workstation setup ===
Software management and development
 
-----------------------------------
 
The software packages for CM-iGLX were prepared in a way very similar
 
to described below. If you setup your host workstation in the way we
 
describe here, you'll be able to add/remove Gentoo packages for your
 
target system using Portage environment, develop and test your
 
application of the host workstation, and finally choose what packages,
 
and files you want to deploy to your production target.
 
  
Host side workstation setup
+
Setup a Linux PC workstation. Any modern Linux distribution (such as Fedora Core, SuSe, Ubuntu) will work. We used Gentoo Linux on our
---------------------------
+
host, but it's not mandatory. We recommend installing ssh, and nfs servers, so you can access the same files from both host workstation
Setup a Linux PC workstation. Any modern Linux distribution (such as
 
Fedora Core, SuSe, Ubuntu) will work. We used Gentoo Linux on our
 
host, but it's not mandatory. We recommend installing ssh, and nfs
 
servers, so you can access the same files from both host workstation
 
 
and CM-iGLX.
 
and CM-iGLX.
  
Development file system setup
+
==== Development file system setup ====
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)[[User:Mike|Mike]] 05:05, 10 March 2008 (EDT)
+
 
Download
+
Download [http://distfiles.gentoo.org/releases/x86/2006.1/stages/stage3-i686-2006.1.tar.bz2 Gentoo stage3] and [http://distfiles.gentoo.org/releases/snapshots/2006.1/portage-2006.1.tar.bz2 Portage tree] from preferred Gentoo mirrors.
link:http://distfiles.gentoo.org/releases/x86/2006.1/stages/stage3-i686-2006.1.tar.bz2[Gentoo
+
Download CompuLab [http://www.compulab.co.il/iglx/download/iglx-linux.zip Linux package] to your Linux workstation and create a directory that you will be using for CM-iGLX development, say {{filename|/mnt/gentoo}}:
stage3] and link:http://distfiles.gentoo.org/releases/snapshots/2006.1/portage-2006.1.tar.bz2[Portage tree] from prefered Gentoo mirrors.
 
Download CompuLab
 
link:http://www.compulab.co.il/iglx/download/iglx-linux.zip[Linux
 
package] to your Linux workstation and create a directory that you will
 
be using for CM-iGLX development, say `/mnt/gentoo`:
 
  
-------------------------------------------------------------
+
<pre>
# mkdir /mnt/gentoo
+
mkdir /mnt/gentoo
# wget http://distfiles.gentoo.org/releases/x86/2006.1/stages/stage3-i686-2006.1.tar.bz2
+
wget http://distfiles.gentoo.org/releases/x86/2006.1/stages/stage3-i686-2006.1.tar.bz2
# tar xjf stage3-i686-2006.1.tar.bz2 -C /mnt/gentoo
+
tar xjf stage3-i686-2006.1.tar.bz2 -C /mnt/gentoo
# cd /path/to/compulab/package
+
cd /path/to/compulab/package
# wget http://www.compulab.co.il/iglx/download/iglx-linux.zip
+
wget http://www.compulab.co.il/iglx/download/iglx-linux.zip
# unzip iglx-linux.zip
+
unzip iglx-linux.zip
# tar xjf portage.tar.bz2 -C /mnt/gentoo/usr
+
tar xjf portage.tar.bz2 -C /mnt/gentoo/usr
# cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
+
cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
-------------------------------------------------------------
+
</pre>
  
Now you have basic Gentoo system on your host workstation that can be
+
Now you have basic Gentoo system on your host workstation that can be used for software development and management for CM-iGLX. To use this
used for software development and management for CM-iGLX. To use this
+
system you just need to {{cmd|chroot}} into the Gentoo environment:
system you just need to `chroot` into the Gentoo environment:
 
  
-------------------------------------------------------------
+
<pre>
# mount -t proc proc /mnt/gentoo/proc
+
mount -t proc proc /mnt/gentoo/proc
# mount -o bind /dev/ /mnt/gentoo/dev
+
mount -o bind /dev/ /mnt/gentoo/dev
# mount -t sysfs sys /mnt/gentoo/sys
+
mount -t sysfs sys /mnt/gentoo/sys
# chroot /mnt/gentoo /bin/bash
+
chroot /mnt/gentoo /bin/bash
# env-update
+
env-update
-------------------------------------------------------------
+
</pre>
  
Target file system extraction
+
==== Target file system extraction ====
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)[[User:Mike|Mike]] 05:05, 10 March 2008 (EDT)
 
The CM-iGLX Gentoo image contains partition table, `/boot` and `/`
 
partitions. Each of the partitions can be loop-mounted using
 
`image_mount.sh` script, and it's contents can be copied to a
 
directory on your host workstation.
 
  
-------------------------------------------------------------
+
The CM-iGLX Gentoo image contains partition table, {{filename|/boot}} and {{filename|/}} partitions. Each of the partitions can be loop-mounted using {{cmd|image_mount.sh}} script, and it's contents can be copied to a directory on your host workstation.
# cd /path/to/compulab/package
 
# gunzip gentoo.img
 
# mkdir gentoo.img.mnt
 
# ./scripts/image_mount.sh gentoo.img root gentoo.img.mnt
 
# mkdir /opt/glx
 
# cp -a /path/to/compulab/gentoo.img.mnt /mnt/gentoo/opt/glx
 
-------------------------------------------------------------
 
  
At this point your host workstation has two Gentoo systems, one is
+
<pre>
fully functional, that can be used for development and testing, and
+
cd /path/to/compulab/package
the other one is exact copy of Gentoo Linux image on CM-iGLX.
+
gunzip gentoo.img
The directory tree on your host will resemble the following figure:
+
mkdir gentoo.img.mnt
 +
./scripts/image_mount.sh gentoo.img root gentoo.img.mnt
 +
mkdir /opt/glx
 +
cp -a /path/to/compulab/gentoo.img.mnt /mnt/gentoo/opt/glx
 +
</pre>
  
-------------------------------------------------------------
+
At this point your host workstation has two Gentoo systems, one is fully functional, that can be used for development and testing, and the other one is exact copy of Gentoo Linux image on CM-iGLX. The directory tree on your host will resemble the following figure:
 +
 
 +
<pre>
 
.
 
.
 
|-- bin
 
|-- bin
Line 361: Line 280:
 
|-- usr
 
|-- usr
 
`-- var
 
`-- var
-------------------------------------------------------------
+
</pre>
 +
 
 +
==== NFS setup ====
  
NFS setup
+
CM-iGLX can use networked file system as its root filing system. It allows faster turn-around for software updates, development and
05:05, 10 March 2008 (EDT)[[User:Mike|Mike]] 05:05, 10 March 2008 (EDT)
+
testing. Using the same files on both host and target computers, without need to reflash entire file system to the target greatly
CM-iGLX can use networked file system as its root filing system. It
+
simplifies development for embedded systems. That's why we recommend setting up NFS server on your host workstation, and using
allows faster turn-around for software updates, development and
 
testing. Using the same files on both host and target computers,
 
without need to reflash entire file system to the target greatly
 
simplifies development for embedded systems. That's why we recommend
 
setting up NFS server on your host workstation, and using
 
 
NFS-exported files as root file system on CM-iGLX.
 
NFS-exported files as root file system on CM-iGLX.
  
1. Set up the NFS server on your host Linux system. If you are using
+
<ol>
 +
<li> Set up the NFS server on your host Linux system. If you are using
 
Gentoo Linux
 
Gentoo Linux
+
 
-----------------------------
 
# emerge nfs-utils
 
# rc-update add nfs default
 
-----------------------------
 
+
 
If you're using other Linux distribution, refer to its manuals to find
 
out how to setup NFS server.
 
  
2. Export target file systems - add the following lines to your `/etc/exports`:
+
<pre>
+
+
emerge nfs-utils
-------------------------------------------------------------
+
rc-update add nfs default
 +
</pre>
 +
 
 +
If you're using other Linux distribution, refer to its manuals to find out how to setup NFS server.
 +
</li>
 +
 
 +
<li> Export target file systems - add the following lines to your {{filename|/etc/exports}}:
 +
 
 +
<pre>
 
/mnt/gentoo/ 192.168.1.0/255.255.255.0(sync,no_root_squash,rw)
 
/mnt/gentoo/ 192.168.1.0/255.255.255.0(sync,no_root_squash,rw)
 
/mnt/gentoo/opt/glx 192.168.1.0/255.255.255.0(sync,no_root_squash,rw)
 
/mnt/gentoo/opt/glx 192.168.1.0/255.255.255.0(sync,no_root_squash,rw)
-------------------------------------------------------------
+
</pre>
+
+
 
 +
</li>
 +
 
 +
<li>
 +
Start the NFS server
 +
 
 +
<pre>
 +
/etc/init.d/nfs start
 +
</pre>
 +
 
 +
</li>
  
3. Start the NFS server
+
</ol>
+
 
-------------------------------------------------------------
 
# /etc/init.d/nfs start
 
-------------------------------------------------------------
 
  
To setup CM-iGLX to boot with NFS-root you need to add the following
+
To setup CM-iGLX to boot with NFS-root you need to add the following entry into {{filename|/boot/grub/grub.conf}} on the CM-iGLX USB NAND flash:
entry into `/boot/grub/grub.conf` on the CM-iGLX USB NAND flash:
 
  
-------------------------------------------------------------
+
<pre>
 
title Gentoo Linux (NFS root)
 
title Gentoo Linux (NFS root)
 
kernel vmlinuz-2.6.20-cm-iglx root=/dev/nfs nfsroot=<server_ip>:/mnt/gentoo ip=::::cm-iglx:eth1:
 
kernel vmlinuz-2.6.20-cm-iglx root=/dev/nfs nfsroot=<server_ip>:/mnt/gentoo ip=::::cm-iglx:eth1:
 
boot
 
boot
-------------------------------------------------------------
+
</pre>
  
The `/boot/grub/grub.conf` file can be modified either on running
+
The {{filename|/boot/grub/grub.conf}} file can be modified either on running Linux system on the CM-iGLX.
Linux system on the CM-iGLX.
 
  
More information about using NFS root can be found in Linux kernel
+
More information about using NFS root can be found in Linux kernel documentation in {{filename|Documentation/nfsroot.txt}} in the kernel source tree.
documentation in `Documentation/nfsroot.txt` in the kernel source tree.
 
  
 +
== Package management ==
  
[[PKG_MGMT]]
+
=== Development Gentoo system ===
Package management
 
------------------
 
  
Development Gentoo system
+
You can use [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1 Gentoo Portage] installer to add, remove and modify packages on both development and target file systems. After you performed all the steps describe in the previous section, you can {{cmd|chroot}} to the
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)
+
development Gentoo system, and use {{cmd|emerge}} utility to manage software packages on it.
You can use
 
link:http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1[Gentoo
 
Portage] installer to add, remove and modify packages on both
 
development and target file systems. After you performed all the steps
 
describe in the previous section, you can `*chroot*` to the
 
development Gentoo system, and use `emerge` utility to manage software
 
packages on it.
 
  
Here's the contents of `make.conf` we used to create the CM-iGLX
+
Here's the contents of {{filename|make.conf}} we used to create the CM-iGLX image:  
image:  
+
 
-------------------------------------------------------------
+
<pre>
 
CFLAGS="-Os -mtune=k6-2 -pipe -fomit-frame-pointer"
 
CFLAGS="-Os -mtune=k6-2 -pipe -fomit-frame-pointer"
 
CHOST="i686-pc-linux-gnu"
 
CHOST="i686-pc-linux-gnu"
Line 436: Line 348:
 
FEATURES="noman nodoc noinfo buildpkg"
 
FEATURES="noman nodoc noinfo buildpkg"
 
USE="-opengl bitmap-fonts truetype-fonts type1-fonts X alsa"
 
USE="-opengl bitmap-fonts truetype-fonts type1-fonts X alsa"
-------------------------------------------------------------
+
</pre>
  
You can copy these settings to the `/mnt/gentoo/etc/make.conf` file and
+
You can copy these settings to the {{filename|/mnt/gentoo/etc/make.conf}} file and add or modify them, esspecially USE flags, to create packages that suit most your application needs.
add or modify them, esspecially USE flags, to create packages that
 
suit most your application needs.
 
  
 +
=== Target System ===
  
Target System
+
The target system extracted from {{filename|gentoo.img}} needs some additional information to allow proper usage of portage. Due to size limitations, the packages database of the target file system, is shipped in a separate archive: {{filename|var-db-pkg.tar.bz2}}. To make use of it you need to extract it into appropriate place:
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)[[User:Mike|Mike]]
 
  
The target system extracted from `gentoo.img` needs some additional
+
<pre>
information to allow proper usage of portage. Due to size limitations,
+
tar xjf /path/to/compulab/package/package_management/var-db-pkd.tar.bz2 -C /mnt/gentoo/opt/glx/var/
the packages database of the target file system, is shipped in a
+
</pre>
separate archive: `var-db-pkg.tar.bz2`. To make use of it you need to
 
extract it into appropriate place:
 
  
-------------------------------------------------------------
+
Next, after {{cmd|chroot}}`ing into the development Gentoo system you can {{cmd|emerge}} packages into the target file system:
# tar xjf /path/to/compulab/package/package_management/var-db-pkd.tar.bz2 -C /mnt/gentoo/opt/glx/var/
 
-------------------------------------------------------------
 
  
Next, after `*chroot*`\`ing into the development Gentoo system you can `emerge` packages into the target file system:
+
<pre>
 +
ROOT=/opt/glx emerge <package spec>
 +
</pre>
  
-------------------------------------------------------------
+
== NAND flash image creation and deployment ==
# ROOT=/opt/glx emerge <package spec>
 
-------------------------------------------------------------
 
  
 +
Last step in embedded software development is deployment of the file system to the device. There several ways to do it.
  
NAND flash image creation and deployment
+
First of all, you can loop-mount the {{filename|gentoo.img}} file, copy the files from updated target file system back to the image, and use the way
----------------------------------------
+
described in [[CM-iGLX Linux:Getting started]].
Last step in embedded software development is deployment of the file
 
system to the device. There several ways to do it.
 
  
First of all, you can loop-mount the `gentoo.img` file, copy the files
+
Another way is to use {{filename|/mnt/gentoo}} as NFS-root, and than mount the NAND flash, and copy the files from {{filename|/mnt/gentoo/opt/glx}} directly to the NAND flash.
from updated target file system back to the image, and use the way
 
described in link:Installation_and_Features.pdf["Installation & Features"].
 
  
Another way is to use `/mnt/gentoo` as NFS-root, and than mount the
+
Yet another way is to create bootable USB-stick, copy the target files to it and than transfer entire contents of the USB-stick onto the CM-iGLX on-board NAND flash.
NAND flash, and copy the files from `/mnt/gentoo/opt/glx` directly to
 
the NAND flash.
 
  
Yet another way is to create bootable USB-stick, copy the target files
+
== Known problems and limitations ==
to it and than transfer entire contents of the USB-stick onto the
 
CM-iGLX on-board NAND flash.
 
  
Known problems and limitations
+
* Some USB mass storage devices cause incorrect mount of root file system. Instead of using on-board USB NAND flash as root, Linux kernel will try to mount an external USB storage device.
------------------------------
 
  
* Some USB mass storage devices cause incorrect mount of root file
+
== See also ==
  system. Instead of using on-board USB NAND flash as root, Linux
 
  kernel will try to mount an external USB storage device.
 
  
 +
=== Kenrel and Drivers ===
  
References
+
* [http://www.kernel.org[http://www.kernel.org The Linux Kernel Archives]
----------
+
* [http://gitweb.freedesktop.org/?p=xorg/driver/xf86-video-amd.git;a=summary X11 video driver for GeodeLX display controller]
 +
* [http://stz-softwaretechnik.com/~ke/touchscreen/evtouch.html Xorg Touchscreen Driver]
  
Kenrel and Drivers
+
=== Gentoo Linux ===
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)[[User:Mike|Mike]]
 
* link:http://www.kernel.org[http://www.kernel.org] - The Linux Kernel Archives
 
* http://gitweb.freedesktop.org/?p=xorg/driver/xf86-video-amd.git;a=summary[http://gitweb.freedesktop.org/?p=xorg/driver/xf86-video-amd.git;a=summary] - X11 video driver for GeodeLX frame buffer device.
 
* http://handhelds.org/cgi-bin/cvsweb.cgi/linux/kernel26/drivers/input/touchscreen/[http://handhelds.org/cgi-bin/cvsweb.cgi/linux/kernel26/drivers/input/touchscreen/] - WM97xx touchscreen driver
 
* http://stz-softwaretechnik.com/~ke/touchscreen/evtouch.html[http://stz-softwaretechnik.com/~ke/touchscreen/evtouch.html] - Xorg Touchscreen Driver
 
  
Gentoo Linux
+
* [http://www.gentoo.org[http://www.gentoo.org Gentoo Linux]
05:05, 10 March 2008 (EDT)05:05, 10 March 2008 (EDT)~~
+
* [http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1 Portage manual]
* link:http://www.gentoo.org[http://www.gentoo.org] - Gentoo Linux
+
* [http://gentoo-wiki.com/HOWTO_Gentoo_LiveCD_and_LiveUSB HOWTO Gentoo LiveCD and LiveUSB]
* link:http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1[http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1] -
+
* [http://gentoo-wiki.com/HOWTO_Small_Footprint_Gentoo_on_USB HOWTO Small Footprint Gentoo on USB]
Portage manual
+
* [http://www.bulah.com/embedded-guide.html Gentoo Embedded x86 Guide]
* link:http://gentoo-wiki.com/HOWTO_Gentoo_LiveCD_and_LiveUSB[http://gentoo-wiki.com/HOWTO_Gentoo_LiveCD_and_LiveUSB] - HOWTO Gentoo
 
LiveCD and LiveUSB
 
* link:http://gentoo-wiki.com/HOWTO_Small_Footprint_Gentoo_on_USB[http://gentoo-wiki.com/HOWTO_Small_Footprint_Gentoo_on_USB] - HOWTO
 
Small Footprint Gentoo on USB
 
* link:http://www.bulah.com/embedded-guide.html[http://www.bulah.com/embedded-guide.html] - Gentoo Embedded x86 Guide
 

Revision as of 09:55, 10 March 2008

Introduction

Linux for CM-iGLX module is based on Gentoo Linux 2006.1. The CompuLab Linux package for CM-iGLX includes ready to run USB NAND flash image, Linux kernel configuration and source code patches, portage tree used to create the image, packages database archive, and graphics and touchscreen driver sources. The CM-iGLX Linux:Getting started page gives brief introduction on how to setup and start using the run-time Linux image. Here we describe in more detail image structure, and also provide guidelines for image modification, and even creation of your own Gentoo Linux for CM-iGLX.

The Linux image we provide is made as generic as possible. It includes more then 200 packages, among them KDE, mplayer, thttpd web server, and Samba Windows connectivity suite. Still, it is impossible to fit into 512Mbytes each and every Linux application and make it suitable for all possible designs based on CM-iGLX.

Deafult image for CM-iGLX leaves moderate amount of the free space to the user application. If you don't need printer support you can run remove.printers script that will free ~30Mbytes. Moreover, if you're not planning to use KDE, you can run remove.kde script that will free more than 100Mbytes.

Package contents

The CompuLab Linux package for CM-iGLX contains the following components:

gentoo.img.gz

gentoo.img.gz is ready-to-run disk image with Linux for CM-iGLX. It can be installed onto the on-board NAND flash as described at Getting started page. The gentoo.img is a complete disk image, containing partition table and two partitions: /boot and /. The /boot partition is ~10Mbytes and it is used to store bootloader and Linux kernel. The rest of the image is the / partition containing root filesystem. Each of the partitions can be loop-mounted and modified on the host workstation, e.g. using image_mount.sh utility.

kernel

kernel directory contains Linux kernel binary (vmlinux-2.6.20-cm-iglx), a copy of .config used to build the kernel (linux-2.6.20.config) and the modification of the kernel source made to support CM-iGLX devices. These modifications are available as patch vs. standard [http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2 Linux kernel 2.6.20]. (linux-2.6.20.pacth)

package_management

package_management directory contains information needed to use Portage installer to add/remove/update packages for CM-iGLX. The portage.tar.bz2 is the Portage tree used to create the CM-iGLX run-time image. The var-db-pkg.tar.bz2 is the information about packages installed on CM-iGLX. Package management is described in more detail here

drivers

drivers directory contains user-space drivers that are not included in standard Gentoo packages:

  • rt73 - Wireless LAN driver
  • xf86-video-amd - accelerated video driver for X11 utilizing GeodeLX graphics accelerator.
  • xf86-input-evtouch - X11 touchscreen driver

scripts

Miscellaneous useful scripts (currently only one)

  • image_mount.sh - utility to mount partitions on run-time image

Linux Kernel and Drivers

Kernel compilation

Linux kernel for CM-iGLX is based on version 2.6.20 with addition of GeodeLX frame buffer drivers from AMD, and drivers for on-board WM9715 touchscreen controller. The changes and additions to the Linux kernel for CM-iGLX are available as patch generated versus Linux kernel 2.6.20.

The following example demonstrates how to compile Linux kernel for CM-iGLX:

mkdir /path/to/cm-iglx/kernel/
cd /path/to/cm-iglx/kernel/
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.tar.bz2
tar xjf linux-2.6.20.tar.bz2
cd linux-2.6.20
patch -p1 < /path/to/compulab/package/linux-2.6.20.patch
cp /path/to/compulab/package/linux-2.6.20.config .config
make menuconfig
make && INSTALL_MOD_PATH=/path/to/target make modules_install

Note, that after the compilation is finished the drivers compiled as loadable kernel modules will be stored in /path/to/target/lib/modules/<kernel version>/ directory. This directory should be transfered to the CM-iGLX root file system.

Additional information about kernel build process can be found in README file in the kernel source tree.

Graphics support

Kernel

We added driver GeodeLX frame buffer device. It's implementation resides in drivers/video/geode and lib/cimmaron in the kernel source tree.

X11

X11-specific graphics driver included in CM-iGLX image was complied from source files located at drivers/xf86-video-amd.tar.bz2 in our Linux package.

Custom LCD configuration

You can adjust X server to support displays with non-standard resolution. To do so you need to edit /etc/X11/xorg.conf configuration file.

There are some fundamental things you need to know before hacking a xorg.conf. These are:

  • Your monitor's horizontal and vertical sync frequency options
  • Your video adapter's driving clock frequencies, or "dot clocks"

The horizontal sync frequency is just the number of times per second the monitor can write a horizontal scan line; it is the single most important statistic about your monitor. The vertical sync frequency is the number of times per second the monitor can traverse its beam vertically.

Sync frequencies are usually listed on the specifications page of your monitor manual. The vertical sync frequency number is typically calibrated in Hz (cycles per second), the horizontal one in KHz (kilocycles per second). The usual ranges are between 50 and 150Hz vertical, and between 31 and 135 KHz horizontal.

If you have a multisync monitor, these frequencies will be given as ranges. For AMD Geode LX800 video adapter's driving clock frequency range is 25.18 to 229.50 MHz.

Now read carefully the "Timing Chart" section in your display documentation. Find the typical values for "active time", "blanking time", "front porch", "sync time", "back porch" both for the horizontal and vertical timings. Your target is to create appropriate "modeline", for example:

#Modename 	clock   horizontal timing     vertical timing
"752x564"     40     752 784  944 1088     564 567 569 611

The horizontal section consists of four fields, which specify how each horizontal line on the display is to be generated.

The first field of the section (752) contains the number of dots per line which will be illuminated to form the picture - "active time". The second field of the section (784) indicates at which dot the horizontal sync pulse will begin. Difference between second and first fields called "front porch". The third field (944) indicates at which dot the horizontal sync pulse will end. Difference between third and second fields called "sync time". The fourth field (1088) specifies the total horizontal frame length. Difference between fourth and third fields called "back porch".

The vertical section also contains four fields. The first field (564) contains the number of visible lines, which will appear on the display. The second field (567) indicates the line number at which the vertical sync pulse will begin. The third field (569) specifies the line number at which the vertical sync pulse will end. The fourth field contains the total vertical frame length (611).

Note again that all of the horizontal numbers (752, 784, 944, and 1088) are divisible by eight!

Choose the desired refresh rate (for example 60 Hz) to obtain appropriate dot-clock frequency:


Dot-clock frequency = 1088*611*60 Hz = 40 MHz ("clock" field in "modeline").


Ensure that it in range of supported by CM-iGLX video adapter's frequencies. Ensure that horizontal and vertical sync frequencies are supported by your display.

Now it's time to edit your /etc/X11/xorg.conf.

Find section named "Monitor" and add lines:

UseModes 	"Custom"
HorizSync	30 - 50
VertRefresh	65 - 72

(Don't forget to specify values of your display!)

Find section named "Screen" and add lines:

SubSection "Display"
	Depth     16
	Viewport  0 0
	Modes     "752x564"
EndSubSection

Add section named "Modes" with the following content:

Section "Modes"
	Identifier "Custom"
	ModeLine   "752x564"	 40	752 784 944 1088	  564 567 569 611 				+hsync +vsync
EndSection

Save the file and restart X server.

For more information please visit these links: [1] [2]

Touchscreen support

Kernel

The kernel driver for WM97xx touchscreen controller can be found in drivers/input/touchscreen/wm97xx. The driver has several parameters, that can be modified to adopt the driver behaviour to particular touchscreens and application needs:

  • dejitter_history - touchscreen dejitter filter history length
  • enable_btn - enable/disbale BUTTON_* events.
  • abs_x - touchscreen absolute X min, max, fuzz
  • abs_y - touchscreen absolute Y min, max, fuzz
  • rpu - set internal pull up resitor for pen detect
  • pil - set current used for pressure measurement
  • pressure - set threshold for pressure measurement
  • delay - set adc sample delay

X11

X11-specific touchscreen driver included in CM-iGLX image was complied from source files located at drivers/xf86-input-evtouch.tar.bz2 in our Linux package.

Calibration utility

The touchscreen calibration utility ev_calibrate is a part of the image. Please consult /usr/share/mnt/xf86-input-evtouch/README for touchscreen calibration instructions.

Software management and development

The software packages for CM-iGLX were prepared in a way very similar to described below. If you setup your host workstation in the way we describe here, you'll be able to add/remove Gentoo packages for your target system using Portage environment, develop and test your application of the host workstation, and finally choose what packages, and files you want to deploy to your production target.

Host side workstation setup

Setup a Linux PC workstation. Any modern Linux distribution (such as Fedora Core, SuSe, Ubuntu) will work. We used Gentoo Linux on our host, but it's not mandatory. We recommend installing ssh, and nfs servers, so you can access the same files from both host workstation and CM-iGLX.

Development file system setup

Download Gentoo stage3 and Portage tree from preferred Gentoo mirrors. Download CompuLab Linux package to your Linux workstation and create a directory that you will be using for CM-iGLX development, say /mnt/gentoo:

mkdir /mnt/gentoo
wget http://distfiles.gentoo.org/releases/x86/2006.1/stages/stage3-i686-2006.1.tar.bz2
tar xjf stage3-i686-2006.1.tar.bz2 -C /mnt/gentoo
cd /path/to/compulab/package
wget http://www.compulab.co.il/iglx/download/iglx-linux.zip
unzip iglx-linux.zip
tar xjf portage.tar.bz2 -C /mnt/gentoo/usr
cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf

Now you have basic Gentoo system on your host workstation that can be used for software development and management for CM-iGLX. To use this system you just need to chroot into the Gentoo environment:

mount -t proc proc /mnt/gentoo/proc
mount -o bind /dev/ /mnt/gentoo/dev
mount -t sysfs sys /mnt/gentoo/sys
chroot /mnt/gentoo /bin/bash
env-update

Target file system extraction

The CM-iGLX Gentoo image contains partition table, /boot and / partitions. Each of the partitions can be loop-mounted using image_mount.sh script, and it's contents can be copied to a directory on your host workstation.

cd /path/to/compulab/package
gunzip gentoo.img
mkdir gentoo.img.mnt
./scripts/image_mount.sh gentoo.img root gentoo.img.mnt
mkdir /opt/glx
cp -a /path/to/compulab/gentoo.img.mnt /mnt/gentoo/opt/glx

At this point your host workstation has two Gentoo systems, one is fully functional, that can be used for development and testing, and the other one is exact copy of Gentoo Linux image on CM-iGLX. The directory tree on your host will resemble the following figure:

.
|-- bin
|-- boot
|-- dev
|-- etc
|-- home
|-- lib
|-- lost+found
|-- mnt
|   |-- gentoo
|   |	|-- bin
|   |	|-- boot
|   |	|-- dev
|   |	|-- etc
|   |	|-- home
|   |	|-- lib
|   |	|-- opt
|   |	|   |-- glx
|   |	|   |-- bin
|   |	|   |-- boot
|   |	|   |-- dev
|   |	|   |-- etc
|   |	|   |-- home
|   |	|   |-- lib
|   |	|   |-- opt
|   |	|   |-- proc
|   |	|   |-- tmp
|   |	|   |-- usr
|   |	|   `-- var
|   |	|-- proc
|   |	|-- tmp
|   |	|-- usr
|   |	`-- var
|-- opt
|-- proc
|-- tftproot
|-- tmp
|-- usr
`-- var

NFS setup

CM-iGLX can use networked file system as its root filing system. It allows faster turn-around for software updates, development and testing. Using the same files on both host and target computers, without need to reflash entire file system to the target greatly simplifies development for embedded systems. That's why we recommend setting up NFS server on your host workstation, and using NFS-exported files as root file system on CM-iGLX.

  1. Set up the NFS server on your host Linux system. If you are using Gentoo Linux
    emerge nfs-utils
    rc-update add nfs default
    

    If you're using other Linux distribution, refer to its manuals to find out how to setup NFS server.

  2. Export target file systems - add the following lines to your /etc/exports:
    /mnt/gentoo/ 192.168.1.0/255.255.255.0(sync,no_root_squash,rw)
    /mnt/gentoo/opt/glx 192.168.1.0/255.255.255.0(sync,no_root_squash,rw)
    
  3. Start the NFS server
    /etc/init.d/nfs start
    

To setup CM-iGLX to boot with NFS-root you need to add the following entry into /boot/grub/grub.conf on the CM-iGLX USB NAND flash:

title Gentoo Linux (NFS root)
kernel vmlinuz-2.6.20-cm-iglx root=/dev/nfs nfsroot=<server_ip>:/mnt/gentoo ip=::::cm-iglx:eth1:
boot

The /boot/grub/grub.conf file can be modified either on running Linux system on the CM-iGLX.

More information about using NFS root can be found in Linux kernel documentation in Documentation/nfsroot.txt in the kernel source tree.

Package management

Development Gentoo system

You can use Gentoo Portage installer to add, remove and modify packages on both development and target file systems. After you performed all the steps describe in the previous section, you can chroot to the development Gentoo system, and use emerge utility to manage software packages on it.

Here's the contents of make.conf we used to create the CM-iGLX image:

CFLAGS="-Os -mtune=k6-2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
FEATURES="noman nodoc noinfo buildpkg"
USE="-opengl bitmap-fonts truetype-fonts type1-fonts X alsa"

You can copy these settings to the /mnt/gentoo/etc/make.conf file and add or modify them, esspecially USE flags, to create packages that suit most your application needs.

Target System

The target system extracted from gentoo.img needs some additional information to allow proper usage of portage. Due to size limitations, the packages database of the target file system, is shipped in a separate archive: var-db-pkg.tar.bz2. To make use of it you need to extract it into appropriate place:

tar xjf /path/to/compulab/package/package_management/var-db-pkd.tar.bz2 -C /mnt/gentoo/opt/glx/var/

Next, after chroot`ing into the development Gentoo system you can emerge packages into the target file system:

ROOT=/opt/glx emerge <package spec>

NAND flash image creation and deployment

Last step in embedded software development is deployment of the file system to the device. There several ways to do it.

First of all, you can loop-mount the gentoo.img file, copy the files from updated target file system back to the image, and use the way described in CM-iGLX Linux:Getting started.

Another way is to use /mnt/gentoo as NFS-root, and than mount the NAND flash, and copy the files from /mnt/gentoo/opt/glx directly to the NAND flash.

Yet another way is to create bootable USB-stick, copy the target files to it and than transfer entire contents of the USB-stick onto the CM-iGLX on-board NAND flash.

Known problems and limitations

  • Some USB mass storage devices cause incorrect mount of root file system. Instead of using on-board USB NAND flash as root, Linux kernel will try to mount an external USB storage device.

See also

Kenrel and Drivers

Gentoo Linux