|
|
Last changed on Jan 9, 2007
Below is a collection of notes I assembled along the way of porting some of my own C++ Gtkmm-based software to Sharp Zaurus running OpenEmbedded distribution of GPE v.3.5.4.
| Install and Configure Sharp Zaurus SL-5500 (Collie) |
Some basic system information:
Distro: OpenZaurus 3.5.4
Build: 2006-03-12 21:51
CPU: Intel StrongARM-111- rev9 (v4l)
RAM: 64Mb /media/ram
Storage: 0Mb /
External storage (flash):
Compact Flash: 1Gb Kingston card
SD Card: 512Mb Kodak
|
I use CF card as removable storage to keep data and distribution files on. The SD Card serves as a permanent harddrive with root filesystem installed on it via wonderful altboot bootstrapper. The instructions that follow assume that you will have your root partition on a removable SD storage card.
# fdisk /dev/hde ... create both partitions ... # mkfs.vfat -F 16 /dev/hde1 # mke2fs /dev/hde2 |
Download and copy zImage to /dev/hde1 (fat16 partition of CF Card).
The images come in zImage-collie-Xmemory-Ystorage.bin format.
Rename zImage-collie-64-0.bin to zImage and then copy the file to the CF card.
I max out on Xmemory (64Mb) to help GPE run smoother. The Ystorage is set to 0 - SD card is used instead.
Plug in your SD card and format it as ext2 filesystem.
# fdisk /dev/hdf ... create Linux ext2 partition ... # mke2fs /dev/hdf1 |
Download gpe-image-3.5.4-collie.rootfs.tar.gz from one of the mirrors and copy it to the root partition of your SD card. The card is going to be used as a permanent harddrive - it is important not to unplug it.
You also might want to put create-cfext2-mount shell script on your SD card to ease the pain of configuring freshly installed system:
# Name: create-cfext2-mount mkdir /media/cfext2 chown root.users /media/cfext2 chmod g+w /media/cfext2 echo "created /media/cfext2" cat "/dev/hda2 /media/cfext2 auto defaults,sync,noauto,noatime 0 0" >> /etc/fstab echo "added /media/cfext2 to /etc/fstab" mount /dev/hda2 /media/cfext2 echo "mounted /media/cfext2" cd /media/cfext2 cp ipkg.conf /etc echo "copied ipkg.conf to /etc" |
Flush the device:
Follow the altboot installation procedure to setup root partition on SD card and install the software:
Please press any key to launch altboot.... f altboot v1.0.5 [1] Normal Boot [2] Don't launch GUI [3] Boot SD card [4] Boot CF card [5] Advanced: Please choose one of the above: 5 [6] Boot from NFS [7] init=/bin/sh [8] Install RootFS from tar.gz Please choose one of the above: 8 Mounting rootfs rw ... ok ... Please choose the target of this installation: [1] SD / MMC [2] Compact Flash Your target: 1 Please choose the type of the installation: [1] Imagefile (loopfile) [2] Direct install Install type: 2 ... Syncing drives ...done Press [Enter] to bring up the altboot menu altboot v1.0.5 [1] Normal Boot [2] Don't launch GUI [3] Boot SD card [4] Boot CF card [5] Advanced: Please choose one of the above: 3 |
Choosing 1 (Normal Boot) would most likely get you hosed. Remeber, your image has 0 memory for the root partition!
Choose altboot password: Repeat: Press [Enter] to bring up the altboot menu altboot v1.0.5 [1] Normal Boot [2] Don't launch GUI [3] Boot SD card [4] Boot CF card [5] Advanced: Please choose one of the above: 1 |
Now, that is a bit confusing, but at this point going with "Normal Boot" is the only right thing to do. Not only that, but also every time you reboot the system from xterm with shutdown, you must select "Normal Boot" from altboot menu.
Congratulations! You are a proud owner of the latest GPE hand-held device running the world's best operating system - Linux.
| Install and Build SDK for Sharp Zaurus |
A simpler configuration can be found on http://familiar.handhelds.org/build-setup.html.
Already pre-built packages (including granule!) can be found at http://www.openembedded.org/repo/org.openembedded.dev/packages/.
Some other sources of information:
It takes about 30 minutes to install development environment on Fedora Core machine.
# yum install monotone python-psyco ccache texi2html git |
# wget http://rpmfind.net/linux/RPM/suse/9.3/i386/suse/i586/patch-2.5.9-145.i586.html # rpm -Uhv patch-2.5.9-145.i586.rpm |
$ mkdir /extra $ mkdir stuff |
$ cd /extra/stuff $ mkdir -p build/conf $ svn co http://svn.berlios.de/svnroot/repos/bitbake/branches/`svn ls http://svn.berlios.de/svnroot/repos/bitbake/branches/ | grep [0-9] | tail -n 1` bitbake |
$ wget http://www.openembedded.org/snapshots/OE-this-is-for-mtn-0.30.mtn.bz2 $ bunzip2 < OE-this-is-for-mtn-0.30.mtn.bz2 > OE.mtn |
$ mtn --db=/extra/stuff/OE.mtn pull monotone.openembedded.org org.openembedded.dev |
$ mtn --db=/extra/stuff/OE.mtn checkout --branch=org.openembedded.dev |
$ mtn --db=/extra/stuff/OE.mtn pull monotone.openembedded.org org.openembedded.dev |
$ cd /extra/stuff/org.openembedded.dev $ mtn update |
$ cd /extra/stuff $ org.openembedded.dev/conf/local.conf.sample build/conf/local.conf |
DL_DIR = "/extra/stuff/sources"
BBFILES = "/extra/stuff/org.openembedded.dev/packages/*/*.bb"
BBMASK = ""
MACHINE = "collie"
DISTRO = "openzaurus-unstable"
IMAGE_FSTYPES = "jffs2 tar"
BBINCLUDELOGS = "yes"
PREFERRED_PROVIDERS = "virtual/qte:qte virtual/libqpe:libqpe-opie"
PREFERRED_PROVIDERS += " virtual/libsdl:libsdl-x11"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc-initial:gcc-cross-initial"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}gcc:gcc-cross"
PREFERRED_PROVIDERS += " virtual/${TARGET_PREFIX}g++:gcc-cross"
ASSUME_PROVIDED += "virtual/arm-linux-gcc-2.95"
|
Setup the environment:
$ export PATH=/extra/stuff/bitbake/bin:/usr/local/arm/2.95.3/bin:$PATH $ export BBPATH=/extra/stuff/build:/extra/stuff/org.openembedded.dev |
$ export LD_LIBRARY_PATH= |
$ umask 022 |
This step is OpenZaurus specific and is documented by a separate openembedded.org wiki page.
Download and install GCC 2.95.3 toolchain - http://handhelds.org/download/projects/toolchain/archive/cross-2.95.3.tar.bz2. This step is necessary if you intend to build desktop targets and/or bootable image targets for 'collie' targets with Linux 2.4.x kernels. Sharp Zaurus is not powerful enough to run 2.6.x kernels (don't know why).
Create /usr/local/arm and unpack the archive:
# mkdir -p /usr/local/arm # cd /usr/local/arm # bunzip2 -cd $src/cross-2.95.3.tar.bz2 | tar xvf - # cd 2.95.3/bin # mv arm-linux-gcc arm-linux-gcc-2.95 # mv arm-linux-ld arm-linux-ld-2.11.2 |
Add /usr/local/arm/2.95.3/bin to your $PATH environment variable. Test if the shell can find the binary:
# which arm-linux-gcc-2.95 /usr/local/arm/2.95.3/bin/arm-linux-gcc-2.95 |
Make sure your /extra/stuff/build/conf/local.conf has the following line in it:
ASSUME_PROVIDED += "virtual/arm-linux-gcc-2.95" |
Start building the software.
Building world or gpe-image might take the whole day and 4-6 Gb of disk space, depending on the slowness of the mirrors. Be warned that an attempt to build gpe-image target, also builds zImage bootable images of the kernel. If you are an Sharp Zaurus user, you need to install an additional arm-linux-gcc-2.95 toolchain (see above).
To speed up the process, you might consider downloading the source packages (and md5 checksums) with wget by yourself, rather then with bitbake from the mirror of OpenZaurus source code distribution.
$ bitbake granule |
$ bitbake -c clean granule |
$ cd tmp/deploy/ipk $ scp granule_1.2.4-r7_arm.ipk vlg@zaurus: |
The name of the current' package file, minus the .bb suffix, and minus any version or release sections. So if there's a package file called aalib_1.4rc5.bb, then PN is set to aalib.
The version of the current' package file, or 1.0. If it's not specified in the file, it's everything after the last underscore in the file name, minus the .bb suffix, So if there's a package file called aalib_1.4rc5.bb, then PV is set to 1.4rc5.
The release number of the current' package file, or r0 if it's not specified. So if there's a file somewhere in BBFILES called aalib_1.4rc5.bb which does not contain a line like PR=xxx, PN is set to aalib, PV is set to 1.4rc5 and PR is set to r0.
The concatenation PN-PV-PR. So again using aalib_1.4rc5.bb, PF would be aalib-1.4rc5-r0.
The concatenation PN-PV.
So, you can equally request bitbake to execute the build:
$ bitbake aalib $ bitbake aalib-1.4rc5 $ bitbake aalib-1.4rc5-r0 |
BitBake recepie examples.
OE keeps recepies in the /extra/stuff/org.openembedded.dev/packages/package directory.
To build libassa from the SourceForge release mirror I use this libassa_3.4.2.bb recepie:
DESCRIPTION = "Object-oriented C++ networking library based on Adaptive Communication Patterns."
AUTHOR = "Vladislav Grinchenko"
HOMEPAGE = "http://libassa.sf.net"
SECTION = "libs"
PRIORITY = "optional"
LICENSE = "LGPL"
PR = "r0"
SRC_URI = "${SOURCEFORGE_MIRROR}/${PN}/${PN}-${PV}-2.tar.gz"
inherit autotools pkgconfig
do_stage() {
autotools_stage_all
}
|
To build granule from local source code package, I use this granule_1.2.4.bb recepie:
DESCRIPTION = "Generic memory training with flash cards. Automatic scheduling algorithm." AUTHOR = "Vladislav Grinchenko" HOMEPAGE = "http://granule.sf.net" SECTION = "x11/apps" PRIORITY = "optional" LICENSE = "GPLv2" DEPENDS = "glib-2.0-native intltool-native gtkmm libxml2 libassa" PR = "r1" SRC_URI = "file:///home/vlg/develop/Granule/granule/granule-1.2.4.tar.gz" inherit autotools pkgconfig EXTRA_OECONF = "--enable-pda=yes" |
To build the same package from the latest SourceForge CVS tree:
[TODO: provide example] |
| Install Extra Software Packages |
Whether you have an SDK or not, you can enhance your GPE setup with a plethora of open-source softeware available at your fingertips.
If, however, you are a software developer, like myself, you probably want to port an existing software you got used to and love to your PDA.
So, here is how you would upgrade your system with extra stuff if you your PDA is not network-aware.
myhost> mount /dev/hde2 /media/CF2 myhost> cd /extra/stuff/tmp/deploy/ipk myhost> cp /extra/stuff/ipkg-make-index . myhost> ipkg-make-index . > Packages myhost> cd /extra/stuff/tmp myhost> cp -R deploy /media/CF2 myhost> umount /media/CF2 |
Note that we used modified version of ipkg-make-index to extract and collect all the package information to Packages file:
#!/bin/sh set -e pkg_dir=$1 if [ -z $pkg_dir ] || [ ! -d $pkg_dir ]; then echo "Usage: ipkg-make-index |
[Z]# cd /media [Z]# mkdir cfext2 [Z]# chown root.users cfext2 [Z]# chmod g+w cfext2 [Z]# mount /dev/hda2 /media/cfext2 |
Alternatively, you might want use the create-cfext2-mount from SD card to do the drudgery.
[Z]# cd cfext2 [Z]# cp ipkg.conf /etc [Z]# cp fstab /etc |
'fstab' has a line added to mount the /media/cfext2 [Grr NOT WORKING]
'ipkg.conf' has a new source (CF) and a new destination (CF) added:
... src unstable file:///media/cfext2/deploy/ipk/ src unstable http://oz.leggewie.org/ipk/ dest root / ... |
If you have managed to configure your Z with a networking capabilities via USB or WiFi card, this would be the place to add other web repositories to pull software from. [TODO: provide syntax description.]
# ipkg update |
# ipkg install granule |
This should trigger installation of granule and all its necessary dependencies from the CompactFlash card.
You might need to update the loader's cache afterwards (I keep bumping into some weird error from ipkg about not finding ldconfig???):
# /sbin/ldconfig |
| USB Networking with Sharp Zaurus |
# USB configuration for iPAQ DEVICE=usb0 BOOTPROTO=none IPADDR=192.168.129.1 NETMASK=255.255.255.255 ONBOOT=yes MII_NOT_SUPPORTED=no |
# /sbin/service hotplug restart |
192.168.129.1 scope host dev usb0 |
# net.ipv4.ip_forward = 0 net.ipv4.ip_forward = 1 |
# /sbin/iptables -t nat -F # /sbin/iptables -t nat -A POSTROUTING -j SNAT -o eth0 --to 192.168.129.1 # /etc/init.d/iptables save |
+ IP (192.168.129.201), + gateway (192.168.129.1), and + DNS on the handheld |