This document describes how to setup the toolchain for use with the n800 device configuration profile for the Nokia n800 device.
Qtopia uses the cs2005q3.2 scratchbox toolchain.

1) Install the scratchbox SDK for maemo. You can download it from here: http://www.scratchbox.org/download/scratchbox-apophis/.

2) Copy the libts files from the n800 device and place then in: /scratchbox/compilers/cs2005q3.2-glibc-arm/arm-none-linux-gnueabi/sys-include

3) run ./configure -device n800

4) copy or scp image/ to your device and put it in /opt/Qtopia


-----------
To create the rootfs, you must have a developer rootfs, mkfs.jffs2 and sumtool.
 assuming the file system is in rootfs/

mkfs.jffs2 -v -r rootfs -o somename.temp -e 128 -l -n
sumtool -i somename.temp -o somename.jffs2 -e 128KiB -l -n
----------

to flash :
Make sure nokia device is unplugged and powered off. 
Plug in USB. run this command:
./flasher-3.0 -r somename.jffs2 -f -R

While holding the Menu button, plug the power in the N800.

----------------------

##########################
compiling outside of scratchbox (CHINOOK)


(login to scratchbox, make sure CHINOOK_ARMEL target is setup)
### log out of scratchbox and do the rest of this outside of scratchbox
 environment


Since scratchbox is broken in regards to compiling outside of the scratchbox
environment, we have to fix some symlinks and patch a few files to make it
work like a normal toolchain.


----------------- 8< ------------------------------------ start script
#!/bin/sh
### might need to become root, or sudo this script!!

# from scratchbox users target dir

echo -n "What is your scratchbox user name? > "
read "USERNAME"

cd /scratchbox/users/"$USERNAME"/targets/CHINOOK_ARMEL/usr


#### copy files to toolchain ####

cd include
cp -a tslib.h alsa dbus-1.0 bluetooth /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/arm-none-linux-gnueabi/sys-include

cd ../lib
mkdir /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/arm-none-linux-gnueabi/lib/pkgconfig
cp -a pkgconfig/alsa.pc pkgconfig/bluez.pc pkgconfig/dbus-1.pc
/scratchbox/compilers/cs2005q3.2-glibc2.5-arm/arm-none-linux-gnueabi

cp -a libasound* libts* libbluetooth* libdbus-1* /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/arm-none-linux-gnueabi/lib

## (or add target to -I and -L in qtopia )


#### fix sym links ####

cd /scratchbox/compilers/cs2005q3.2-glibc2.5-arm/arm-none-linux-gnueabi/lib

FILES = "libm.so libBrokenLocale.so libanl.so libcidn.so libcrypt.so libdl.so libnsl.so libnss_compat.so libnss_dns.so libnss_files.so libnss_hesiod.so libnss_nis.so libnss_nisplus.so libresolv.so librt.so libthread_db.so libutil.so"

for FILE in $FILES; do

LINK=`ls -l $FILE | awk 'BEGIN{FS=" "}{print $10}'|awk 'BEGIN{FS="/"}{print $3}'`
rm $FILE
ln -s $LINK $FILE

done

#### fix pkgconfig and some .so paths ####

cd /
patch -p 0 <  n800-pkgconfig.patch
patch -p 0 <  n800-so.patch

----------------- 8< ------------------------------------ end script
