QuickPorting

A technique for quickly porting command-line apps

(Note: you'll need root on your 770 to do this)

Obviously, in an ideal world, everything would have a UI and would be hildonized and maemoized quickly. However, there are many UNIX tools that are useful to have around on your 770.

Personally, real ssh, python + the Zope Object Database, and a Bluetooth OBEX server are priorities.

What I tried doing was building everything I wanted within the officially suggested scratchbox sandbox, but with a prefix of /sw:

./configure --prefix=/sw

I've found this to work nicely for nearly everything I've tried. It lets you easily move all of the executables, libraries, documents, etc. over to the 770 in one step. I build everything I want this way in scratchbox using the ARM_SDK target, and then just keep /sw in scratchbox sync'ed with /sw on my 770.

Unfortunately, you'll probably find yourself running out of storage capacity relatively quickly. I re-partitioned my included 64MB RS-MMC card into a 2MB VFAT and a 60-something MB ext2 partition, and mount the ext2 partition at /sw. VFAT is not appropriate for this since it is not case sensitive for short file names, and also doesn't store the full UNIX directory information that you may want.

I was able to build fdisk from the debian cfdisk package under scratchbox, and used that to repartition the RS-MMC card natively on the 770. I also copied the mkfs.ext2 binary as well as the libraries it depended on (ldd <executable> will tell you which libraries a binary needs).

If you have libraries in /sw/lib you'll need to do ldconfig /sw/lib for the system to be able to find them. You should really just add the directory /sw/lib to the linker config file /etc/ld.so.conf

Another option related to libraries is to make your application instruct linker that it should look into another, possible relative, paths, see man 1 ld, -rpath option. Yet another option is to use the LD_LIBRARY_PATH environment variable.

PATH=$PATH:/sw/bin

will add /sw/bin to your path so you can run executables there.

I currently use rsync to keep everything up to date:

rsync -lr <username>@<hostname>:maemo-sync/sw/ /sw/.

This isn't appropriate for deployment, but it's good if you want to try to bring your 770 up as quickly as possible and test apps natively as you work on making them more compliant.