N900 is not the fastest arm board out there, but it was the only ARM board I had at hand...Anyway, creating Gentoo chroot on N900 is quite simple actually. First you need to create a spare partition, or two if you want to use swapping space, which is probably a good idea, given my plan to re-compile the toolchain natively. :)
I also decided to leave some space on the SD for the N900 itself, ( apparently it's also a good way of shutting it up as it tries to mount the card anyway ), so I ended up with three partitions:
Disk /dev/mmcblk1: 15.9 GB, 15931539456 bytes
255 heads, 63 sectors/track, 1936 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/mmcblk1p1 1 974 7823623+ 83 Linux
/dev/mmcblk1p2 975 1097 987997+ 83 Linux
/dev/mmcblk1p3 1098 1936 6739267+ 83 Linux
The first partition is left for the N900 as a FAT filesystem, the second one will be our Gentoo chroot and the 3rd is swap space. ( I wonder how quickly the card will die by the way ;)). Now you need to decide where you are going to put your Gentoo chroot for instance in /home/user/MyDocs/Gentoo and create that folder so your new partition on the SD card can be mounted there (but we need to format it first).
mount /dev/mmcblk1p2 /home/user/MyDocs/Gentoo
With the correct card setup in place, the next thing is to get a Gentoo stage for the arm achitecture, which you can get from the gentoo.org site. The N900 is a ARMv7 board and you can use the hardfp stages. Untar it in your chroot folder:
tar -jxpf stage3-*.tar.bz2
After mounting few additional folders, we can jump in to our new Gentoo environment, so mount first:
mount -o bind /dev /home/user/MyDocs/Gentoo/dev
mount -o bind /dev/pts /home/user/MyDocs/Gentoo/dev/pts
mount -o bind /dev/shm /home/user/MyDocs/Gentoo/dev/shm
mount -o bind /proc /home/user/MyDocs/Gentoo/proc
mount -o bind /sys /home/user/MyDocs/Gentoo/sys
mount -o bind /tmp /home/user/MyDocs/Gentoo/tmp
Note that the mounting of /dev/pts will allow you to run the screen command within the chroot which will come handy later...
Now for the chroot itself:
chroot /home/user/MyDocs/Gentoo/ /bin/bash
export PS1="(chroot) $PS1"
Done! It's probably a good idea to put the 'mount' commands along with the 'chroot' into a shell script somewhere on the N900 so you can run it again quickly after restarting the phone.
N900 / # eselect profile list
Available profile symlink targets:
 default/linux/arm/10.0 *
N900 / # uname -a
Linux N900 220.127.116.11-power50 #1 PREEMPT Sun Mar 18 20:10:56 EET 2012 armv7l ARMv7 Processor rev 3 (v7l) Nokia RX-51 board GNU/Linux
Next step - making the chroot environment a Gentoo Hardened environment of course! ;] We will have to create a hardened toolchain first, but that's a story for the next post :)