Miniature/Development/Instructions

Contents

Getting started - plot summary

WARNING: This list does not necessarily explain what every step does, nor will it help you in case you run into problems! Also, I will assume your host machine has a i386 architecture (I use Jaunty, 64 bit installation instructions are not covered here).

Scratchbox installation

Read the director's cut if you run into problems, it has become very accurate! Again, you have been warned. This stuff is potentially dangerous.

On the host machine (= your computer, the other side is inside scratchbox, your cross compiling environment to create binaries/packages for the N900):

 $ sudo vi /etc/sysctl.conf

Copy and paste those three lines to the top:

 #maemo
 vm.vdso_enabled = 0
 vm.mmap_min_addr = 4096

Save with <ESC> :wq (or use nano as an editor). Then reload sysctl.conf with:

 sudo sysctl -p

Start with the Maemo SDK installation:

 $ sudo apt-get install xserver-xephyr
 $ wget http://repository.maemo.org/stable/5.0/maemo-scratchbox-install_5.0.sh
 $ wget http://repository.maemo.org/stable/5.0/maemo-sdk-install_5.0.sh
 $ chmod a+x ./maemo-scratchbox-install_5.0.sh
 $ sudo ./maemo-scratchbox-install_5.0.sh -u USER
 $ newgrp sbox
 $ chmod a+x ./maemo-sdk-install_5.0.sh
 $ ./maemo-sdk-install_5.0.sh
 $ /scratchbox/login

Get tokenized Maemo/Nokia repo here, enter token code and keep page open. You'll soon need the repo link.

Inside scratchbox:

 [sbox-FREMANTLE_X86: ~] > fakeroot echo "<repo link from token page>" >> /etc/apt/sources.list
 [sbox-FREMANTLE_X86: ~] > fakeroot apt-get update #simply repeat if it aborts in-between, ignore bad GPG
 [sbox-FREMANTLE_X86: ~] > fakeroot apt-get install nokia-binaries #repeat if interrupted/incomplete
 [sbox-FREMANTLE_X86: ~] > fakeroot apt-get install libqt4-maemo5-dev
 [sbox-FREMANTLE_X86: ~] > fakeroot apt-get install maemo-debug-scripts #enables native-gdb and other neat stuff

Now do the same for the ARMEL target (= same architecture as device):

 [sbox-FREMANTLE_X86: ~] sb-conf select FREMANTLE_ARMEL
 [sbox-FREMANTLE_ARMEL: ~] > fakeroot echo "<repo link from token page>" >> /etc/apt/sources.list
 [sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get update #simply repeat if it aborts in-between, ignore bad GPG
 [sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install nokia-binaries #repeat if interrupted/incomplete
 [sbox-FREMANTLE_ARMEL: ~] > fakeroot apt-get install libqt4-maemo5-dev

Compiling Miniature inside Scratchbox

Back to the FREMANTLE_X86 target, so you can run Miniature from inside scratchbox. Use your *private* gitorious url instead of the public clone url if you want to push changes, too.

 [sbox-FREMANTLE_ARMEL: ~] sb-conf select FREMANTLE_X86
 [sbox-FREMANTLE_X86: ~] mkdir source
 [sbox-FREMANTLE_X86: ~] cd source
 [sbox-FREMANTLE_X86: ~] git clone git://gitorious.org/miniature/miniature.git
 [sbox-FREMANTLE_X86: ~] cd miniature
 [sbox-FREMANTLE_X86: ~] ./autogen.sh QT_PATH=/opt/qt4-maemo5/bin && make

On your host machine (i.e., outside of scratchbox, do not close your sb session though):

 $ Xephyr -ac -host-cursor -br -screen 480x800x16 :2

Back to scratchbox (keep the Xephyr server running, of course):

 [sbox-FREMANTLE_X86: ~] export DISPLAY=:2
 [sbox-FREMANTLE_X86: ~] af-sb-init.sh start

Lots of lines of useless information flow by, give it 10 seconds and test with <ENTER> whether you can continue typing. Then start miniature:

 [sbox-FREMANTLE_X86: ~] run-standalone.sh src/miniature

On your host machine, go to your Xephyr server and enjoy Miniature.

If you managed to do all this in under one hour consider yourself lucky - you saved yourself a alot of time!

Compiling binaries for the N900

This is of course the cool part, and it also shows why we want to keep autotools/autotroll as our build system (I am serious).

Inside scratchbox:

 [sbox-FREMANTLE_X86: ~] sb-conf select FREMANTLE_ARMEL
 [sbox-FREMANTLE_ARMEL: ~] cd ~/source/miniature
 [sbox-FREMANTLE_ARMEL: ~] make distclean # dont worry if this fails
 [sbox-FREMANTLE_ARMEL: ~] ./autogen.sh QT_PATH=/opt/qt4-maemo5/bin && make

Copy the binary onto the device (even if totally unsecure: let's just assume opensshd is installed and running on your N900):

 [sbox-FREMANTLE_ARMEL: ~] scp src/miniature root@<IP_ADDRESS_OF_N900>/home/user/

I usually copy the binary using scp *from* the device. It allows me to remove the ssh server and to only keep the client. But there are many more ways to get the binary onto the device. The only important part is to move the binary away from the FAT partition (that is why we used /home/user above) - you cannot mark files as executable on VFAT.

On the N900:

  • Open a terminal
 $ cd ..
 $ ./miniature

Enjoy!

Closing scratchbox

Do *not* ignore this section, sb uses dark symlink magic which can mess up your system! This is extra advice to cleanly shutdown scratchbox after you're done.

Inside scratchbox:

 [sbox-FREMANTLE_X86: ~] sb-menu

Go to "Killall", confirm with enter twice. Only now close your session

On your host:

 $ sudo /etc/init.d/scratchbox-core stop

If you get an error message be very careful with what you delete and what data you move around. Scratchbox might still have active symlink pointing to folders on your *host machine*. Your best solution, if you don't know what else to do, is a clean restart of your host machine!