Warning: Use of undefined constant projectarium_comment_fields - assumed 'projectarium_comment_fields' (this will throw an Error in a future version of PHP) in /home/kevinwelch/kevindwelch.com/wp-content/themes/projectarium/functions.php on line 43
Systems of Operation « Kevin's Projects

Systems of Operation

After a short break from this project to pursue some standard summer activities, I’m finally ready to post the results of the operating system installation. The computer is running Gentoo Linux, using Xfce for the desktop environment.

Operating System Installation

The first step was to get a base Gentoo system installed on my disk; I used UNetBootin to create a USB stick containing a Gentoo Installation ISO, and booted from that, following the basic instructions in the Gentoo Installation Handbook to get the basic system installed. However, I didn’t want to start compiling things on the SSD, since that would reduce the useful life of the drive (constant write/delete operations on thousands of small files). So I created a 32-bit chroot jail and installed the same system from the Installation ISO. From inside the jail, I can compile any needed packages and store binary packages of them for later installation on the carputer. I made sure that my system profile and USE flags matched on both machines, to eliminate any run-time problems later on.

Below is the process for entering the chroot jail, which on my system lives in /mnt/cartoo32. The script loopmount.sh contains commands for mounting directories in the running system as loopback nodes in the chroot, as explained in the Gentoo chroot guide. I also change the command prompt to add the string “[chroot]” so I don’t get confused about which filesystem I’m changing.

ares ~ # cd /mnt/cartoo32/
ares cartoo32 # ./loopmount.sh
mounting /mnt/cartoo32/proc...
mounting /mnt/cartoo32/dev...
mounting /mnt/cartoo32/usr/portage...
mounting /mnt/cartoo32/usr/local/portage...
mounting /mnt/cartoo32/lib/modules...
mounting /mnt/cartoo32/sys...
mounting /mnt/cartoo32/tmp...
ares cartoo32 # linux32 chroot ./ /bin/bash
ares / # source /etc/profile && env-update
ares / # export PS1="[chroot] $PS1"
[chroot] ares / #

Once in the chroot, I set up an /etc/make.conf file that makes sense for my build environment and includes the “buildpkg” feature, which creates the binary packages automatically:

CFLAGS="-O2 -march=i686 -pipe"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
USE="fbcondecor png truetype -kde -gnome"
ACCEPT_KEYWORDS="x86"
FEATURES="buildpkg"
PORTDIR_OVERLAY="/usr/local/portage"

And I set my profile:

[chroot] ares / # eselect profile list
Available profile symlink targets:
  [1]   default/linux/x86/10.0 *
  [2]   default/linux/x86/10.0/desktop
  [3]   default/linux/x86/10.0/desktop/gnome
  [4]   default/linux/x86/10.0/desktop/kde
  [5]   default/linux/x86/10.0/developer
  [6]   default/linux/x86/10.0/server
  [7]   hardened/linux/x86
  [8]   hardened/linux/x86/selinux
  [9]   selinux/2007.0/x86
  [10]  selinux/2007.0/x86/hardened
  [11]  selinux/v2refpolicy/x86
  [12]  selinux/v2refpolicy/x86/desktop
  [13]  selinux/v2refpolicy/x86/developer
  [14]  selinux/v2refpolicy/x86/hardened
  [15]  selinux/v2refpolicy/x86/server
[chroot] ares / # eselect profile set 2

Now I’m ready to start building packages that I’ll use on my system, including everything the Gentoo Handbook wants me to build (syslog-ng, dhcpcd, etc.). As a precaution, I also run “quickpkg @system” once to make sure every package in the chroot has an associated binary package.

Once the binary packages are built, I can boot up the physical carputer and start installing them. First, I make sure my /etc/hosts file contains a named reference to the desktop:

# Network
192.168.1.2    ares

Now I can use rsync to copy over the binary packages, and install them using the -k option in emerge.

[chroot] ares / # rsync -az ares:/usr/portage/packages/* /usr/portage/packages/
[chroot] ares / # emerge -avk <packages to merge>

Touchscreen Driver Installation

The touchscreen I purchased came with a set of Linux drivers on CD, precompiled. It also included a complicated script to install the drivers, but the script blasted files and symbolic links all over the filesystem, and generally was not clean about it. I decided therefore that I would prefer to install the driver using Gentoo’s method, and create an ebuild to do things properly.

After sifting through the contents of the .tar.gz file that came on the CD, I discovered that there were just 3 things that I needed to care about: egalax_drv.so, the binary driver used by the X server; eGalaxTouch, the utility for calibrating and setting preferences; and TKCal, a lower level utility for setting options in the hardware. I created an .ebuild file in my local Portage overlay (/usr/local/portage) for a package called egalaxtouch. (More information on Gentoo’s ebuild system can be found in the Ebuild HOWTO.) This ebuild makes sure the correct versions of the X server and the X.org drivers are installed, and copies the utilities and egalax driver to the correct locations on the system:

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3

DESCRIPTION="X.org drivers for eGalaxTouch touchscreen panel."
HOMEPAGE="http://home.eeti.com.tw/web20/eg/Touch_Drives.html"
SRC_URI="http://home.eeti.com.tw/web20/drivers/touch_driver/Linux/20110831/eGalaxTouch-3.06.5625-32b-k26.tar.gz"

LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE=""

DEPEND=">=x11-base/xorg-drivers-1.10
>=x11-base/xorg-x11-7.4-r1
media-libs/libpng:1.2"
RDEPEND="${DEPEND}"

src_unpack() {
        unpack ${A}
        tar -xzf ${WORKDIR}/eGalaxTouch32/eGalaxTouch.tar.gz 
                -C ${WORKDIR}/eGalaxTouch32/
}

src_prepare() {
        return
}

src_configure() {
        return
}

src_compile() {
        return
}

src_install() {
        dodir /usr/share/eGalaxTouch/
        cp -R ${WORKDIR}/eGalaxTouch32/eGalaxTouch32/eGalaxTouch ${D}/usr/share/eGalaxTouch/
        cp -R ${WORKDIR}/eGalaxTouch32/eGalaxTouch32/TKCal/     ${D}/usr/share/eGalaxTouch/
        dodir /usr/lib/xorg/modules/input/
        cp ${WORKDIR}/eGalaxTouch32/eGalaxTouch32/Module/x110/egalax_drv.so 
                ${D}/usr/lib/xorg/modules/input/
        dodir /usr/bin/
        dosym ${D}/usr/share/eGalaxTouch/eGalaxTouch /usr/bin/eGalaxTouch
        dosym ${D}/usr/share/eGalaxTouch/TKCal/TKCal /usr/bin/TKCal
}

The remaining bit of configuration was to modify my X server config files to use the new driver. I placed this config information in /etc/X11/xorg.conf.d/50-egalax.conf:

Section "InputClass"
     Identifier    "eGalax"
     MatchProduct    "eGalax"
     Driver    "egalax"
     Option    "Device"    "usbauto"
     Option    "Parameters"    "/var/lib/egalax.param"
     Option    "ScreenNo"    "1"
 EndSection

I restarted the X server, and the touchscreen worked! I was able to calibrate it using the eGalaxTouch utility without problems.

Xfce running on the touchscreen

Xfce running on the touchscreen

Categories: Carputer

Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /home/kevinwelch/kevindwelch.com/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048