Get rid of that Non-Breaking space

The non-breaking space is a variant of the space character which as the name suggests prevents automatic line breaking when using a space character. Another common use of it is to avoid collapsing of white-spaces in formats such as TeX or HTML. There are also some others specific typographic uses but nevermind.

From my point of view this character is a real pain, a annoying remain of a former era when the only editor you had was plain-text and which is now just good at invisibly polluting your work so that no compiler, interpreter or any other ASCII oriented tool would accept it anymore. For ASCII is not dead, it’s 7-bit, it’s common, it’s the neutral zone of all character set and No-Break Space shall not interfere therefore it must be eradicated from the very surface of earth or at least from my own keyboards.
There are several options to do that under Xorg. The first one would be to use the setxkbmap command to specify the nbsp:none option for your keyboard.
setxkbmap -option "nbsp:none"

However this won’t work as you might expect it especially when you have multiple keyboards with different layouts. So another solution would be to specify XkbOption directly within the Xorg configuration file, one for each input device. But this won’t work neither if you use a Bépo layout as this option will simply disable the use of underscore (AltGr Space). So the final solution is based on xmodmap to modify the list of keysyms assigned to the space keycode (0x41). You may just add the following line to ~/.xmodmap and ensure that the file is loaded when your session starts with xmodmap ~/.xmodmap.

keycode 65 = space space space space underscore underscore space space

Howto save a lot of disk space on nokia N810

The Nokia N810 is an internet tablet (not a phone though it can communicate with cellular phone via bluetooth). It’s a nice small device which run the Maemo Distribution which seems to be based on Debian since it uses the Debian Package Manager. But the distribution’s structure really feels like an embedded device and this is quite annoying when you try to optimize this device.
One thing which is really boring is the lack of disk space on the device. Actually the device use two miniSD (MMC) cards for personnal documents, images, videos and so on and a 256MB MTD using a JFFS2 compressed file system to store the whole distribution which means every package and their data files which takes a large amount of disk space and even so much that the MTD can easily be completely filled with a few apps.
The basic idea to save some disk space is to move some part of the MTD on the MMC primarely reformated from vfat to ext2. Many articles explain how to move stuff like /var/cache and others using symlinks which can save you about 20MB. But they also explain that you can’t do that with /usr/share/ for example since it will break the boot process. Indeed the boot process depends on many stuff located in /usr/share and thus if the MMC are not mounted while boot occurs the system will just stall waiting for an hard reset to get everything right and clean again. Here comes a way to go around this :

As root we check the run level :

Nokia-N810-43-7:~# runlevel
N 2

We see we are in runlevel 2. Let’s check how the boot process arranges itself in that runlevel :

Nokia-N810-43-7:~# ls /etc/rc2.d
K00zzinitdone
S12fb-progress.sh
S20dbus
S20hal
S20osso-applet-display
S21mce
(…)

It looks like fb-progress.sh is the first script executed in the boot process. So we edit this script (/etc/init.d/fb-progress.sh) and add the following line at the beginning of the script (line 19 or so):

/usr/sbin/osso-mmc-mount.sh /dev/mmcblk0p1 /media/mmc2
/usr/sbin/osso-mmc-mount.sh /dev/mmcblk1p1 /media/mmc1

So we know that MMC will be mounted at first in the boot process. After that scripts which need share stuff or other may look on the MMC since we know they were already mounted. Then we move things like /usr/share on the MMC :

Nokia-N810-43-7:~# mkdir /media/mmc1/.usr
Nokia-N810-43-7:~# cp -aR /usr/share /media/mmc1/.usr
Nokia-N810-43-7:~# rm -rf /usr/share
Nokia-N810-43-7:~# ln -s /media/mmc1/.usr/share /usr/share

Of course the same could be done for other directory. Here is the list of directory that I switched from MTD to MMC without breaking the boot process :

  • /var/backups
  • /var/cache
  • /usr/local
  • /usr/share
  • /usr/bin
  • /usr/games
  • /usr/lib
  • /home/user

The df entry for the MTD follow :

Filesystem Size Used Available Use% Mounted on
/dev/mtdblock4 249.5M 16.8M 232.7M 7% /

And it almost never grow when apps are installed.