====== Linux on iPAQ hx4700 ======
===== Building Ångström on Mageia 1 =====
==== Install necessary packages ====
* [[http://git-scm.com|git]] version control system
$ sudo urpmi git
* [[http://www.dabeaz.com/ply/|Python ply]] - lex and yacc parsing tools for Python
$ cd ~/Downloads
$ wget http://www.dabeaz.com/ply/ply-3.4.tar.gz
$ tar xvzpf ./ply-3.4.tar.gz
$ sudo rsync -av ./ply-3.4/ply /usr/lib/python2.7/site-packages/
$ rm -fr ./ply-3.4
* [[http://python-progressbar.googlecode.com/|Python progressbar]] - Python text mode progressbar
$ cd ~/Downloads
$ wget http://python-progressbar.googlecode.com/files/progressbar-2.3.tar.gz
$ tar xvzpf ./progressbar-2.3.tar.gz
$ sudo rsync -av ./progressbar-2.3/progressbar /usr/lib/python2.7/site-packages/
$ rm -fr ./progressbar-2.3
* Other packages
$ sudo urpmi python-devel python-psyco
$ sudo urpmi cvs gawk glibc-devel gcc-c++ subversion sharutils coreutils
$ sudo urpmi docbook-utils openjade
$ sudo urpmi quilt pcre-devel unzip glibc-static-devel
$ sudo urpmi texi2html chrpath texinfo
==== Build distro ====
* Prepare project directory
$ PROJECT_DIR=/home/share/users/dambi/projects/hx4700/Angstrom/maintenance-2011.03
$ export PROJECT_DIR
$ mkdir -p $PROJECT_DIR
* Download set of build scripts
$ cd $PROJECT_DIR
$ git clone git://git.angstrom-distribution.org/setup-scripts
* switch to **maintenance-2011.03** branch
$ cd ${PROJECT_DIR}/setup-scripts/
$ git checkout -b local maintenance-2011.03
* Configure and build **x11-gpe-image** image for **hx4700** machine
$ cd ${PROJECT_DIR}/setup-scripts/
$ MACHINE=hx4700 ./oebb.sh config hx4700
$ MACHINE=hx4700 ./oebb.sh update
$ MACHINE=hx4700 ./oebb.sh bitbake x11-gpe-image
==== Deploy (boot from Compact Flash) ====
* Partition 4GB Compact Flash card
Let's try to boot Linux directly from WinCE using [[http://xdandroid.com/wiki/HaRET|HaRET]] bootloader. In order to do that, create two fdisk partitions on CF card. The first one with FAT filesystem containing HaRET bootloader along with its configuration file and Linux kernel. The second one is formatted as ext2 and will contain Linux root filesystem.
# fdisk -l /dev/sdd
Disk /dev/sdd: 3997 MB, 3997163520 bytes
123 heads, 62 sectors/track, 1023 cylinders, total 7806960 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00006d65
Device Boot Start End Blocks Id System
/dev/sdd1 2048 67583 32768 6 FAT16
/dev/sdd2 67584 7804927 3868672 83 Linux
#
* Populate FAT partition with HaRET and Linux kernel
# mkdir /tmp/fat16
# mount /dev/sdd1 /tmp/fat16
# wget http://pda-linux.googlecode.com/files/haret-0.5.2.exe -O /tmp/fat16/haret-0.5.2.exe
# echo 'set kernel "zImage-2.6.21-hh20-r26-hx4700.bin"' > /tmp/fat16/startup.txt
# echo 'set cmdline "root=/dev/hda2 rootdelay=10 console=ttyS0,115200n8 console=tty0 psplash=false"' >> /tmp/fat16/startup.txt
# echo 'bootlinux' >> /tmp/fat16/startup.txt
# cp ${PROJECT_DIR}/setup-scripts/build/tmp-angstrom_2008_1/deploy/glibc/images/hx4700/zImage-2.6.21-hh20-r26-hx4700.bin /tmp/fat16/
# sync
# umount /tmp/fat16
* Populate ext2 partition with root filesystem
# mkdir /tmp/ext2
# mount /dev/sdd2 /tmp/ext2
# cd /tmp/ext2
# tar xvjpf ${PROJECT_DIR}/setup-scripts/build/tmp-angstrom_2008_1/deploy/glibc/images/hx4700/Angstrom-x11-gpe-image-glibc-ipk-2011.03-hx4700.rootfs.tar.bz2
# cd ~
# sync
# umount /tmp/ext2
* Boot Linux by executing haret binary from WinCE