Sunday, November 30, 2008

pimp my x40

After a brief look at the market, I decided to keep using my sturdy X40. Looking at what could be done to improve the 4 years old workhorse, three things came to mind:

* new battery (old one dies in 45min, new one lasts easily 5+h)
* replace the hard drive (preemptively before it breaks)
* more ram (from 512MB -> 1.5G)

The only one worth detailing is the hard drive upgrade, since I decided to go SSD. less moving parts, less heat, less power consumption. I followed the Thinkwiki CompactFlash boot howto. This basically involves getting a CF-IDE adapter (from ebay, around $5) and any CF card. The first CF-IDE adapter $2.99, but it didn't work. After some research it was concluded that the SMT soldering was bad. The second adapter bought worked fine, and as a bonus the dimensions match the X40 HD perfecty:

In order to minimize writing to flash:

* Make sure root filesystem is mounted noatime,nodiratime (see /etc/fstab)
* make /tmp a tmpfs partition
* disable swap
* more tips can been seen at Linux on Flash guide

Generally I'm very happy with the results of the upgrade. X40 is now most of the time completly silent, without the spinning and clicking HD. Fan turns on less often than previously. The cheapo compactflash is fast enough on reading, and the REALLY slow write speed is usually not a problem thanks to the loads of RAM. Ofcourse, the exception is when a application uses fsync() ... which leads to.


Seriously. It's like watching snail cross a tarpit. That's what happens when you fsync() a 30MB places.sqlite on a 6MB/s write speed flash media every fucking time a page has finished loading (and seeming every now and then too). Now here's a really simple workaround: make ~/.mozilla tmpfs and rsync it to/from a backup dir every time you log in/out.

* /etc/fstab: tmpfs /home/user/.mozilla tmpfs size=100m,user 0 0
* and two helper scripts:

aardvark:~$ cat bin/mozilla-mount
mount /home/$USER/.mozilla
rsync -av /home/$USER/.mozilla-safe/ /home/$USER/.mozilla/
aardvark:~$ cat bin/mozilla-umount
rsync -av /home/$USER/.mozilla/ /home/$USER/.mozilla-safe/
umount /home/$USER/.mozilla

It does what mozilla should be doing in the first place - write to temporary files when running and on exit synchronize to the real database and fsync(). With this hack, suddenly the web browser UI doesn't freeze every time a page has finished loading.

You'll also want to disable the urlclassifier anti-forgery tool, which can grow to a over 50MB sqlite database which also gets fsynced all the time...

Monday, November 10, 2008

When Linux doesn't mean freedom

I actually think it's a bit of an insult if people think of Motorola's EZX or MAGX (and now Android) phones as "Linux phones". Because all the freedoms of Linux (writing native applications against native Linux APIs that Linux developers know and love, being able to do Linux [kernel] development) are stripped.
- Harald Welte

This is something that has worried me too for quite a while. For years we have now had Linux phones available in form or another (well, mostly in far away countries you happen not to be at). Yet with the exception of openmoko none of them allow native application development. Yet all the same time you can go to the nearest phone shop and grab HTC windows CE phone or a Nokia Symbian phone, which actually give you the freedom to writing and running your own software on them.

Now we have the situation that HTC's most locked device* is their only Linux device - The Android G1.

Incidentally, you can install Debian/armel on T-mobile G1, but only until Google engineers manage to fix the hole that gives you r00t.

*The only one that doesn't allow native app development.