Category Archives: Tips

Building a custom debian CD

The French version was originally written for linuxembedded.fr : Crée un CD d’installation d’une debian spécialisée.

The goal is to build a debian install CD suitable for the distribution of a complete system including the operating system and applications.

Debian already has a tool for that purpose: simple-cdd. Simple-cdd is a set of scripts wrapping debian-cd which is the tool used to build official CDs.

In our case, we will include some “non-free” packages (firmwares for instance) and application specific packages in the system.

Continue reading

Benchmarking microSD

First, I didn’t ask manufacturers for free cards to run my tests, so this test is not comprehensive. In fact I’m only comparing two cards!
My brother and I bought some microSD SDHC 16G cards: one from SanDisk and one from Kingstone. We picked branded cards to ensure we had good performances.

Testing method

I was trying to define my test procedures, like copying several kind of file, when I found this blog: MicroSD class 6 Performance Benchmarks. He is using a tool from the GNOME desktop: palimpsest.
Well this tool doesn’t want to test cards if it detects a partition table on it. The above blog proposed to erase the card with the following command:

dd if=/dev/zero of=/dev/sdb

Erasing an SD card that way is probably not a so good idea. Especially when you know that the “erased” state of a flash is with all bits set to 1, so writing 0 everywhere is more like filling than erasing…
But I didn’t had this thoughts when I ran the test, so I went with:

sync; date; sudo time dd if=/dev/zero of=/dev/sdb; sync; date

Calls to date gives a first write time estimate, but in fact, dd gives some statistics so it was really not necessary.

Then the test itself:

LANG=C palimpsest

Beware when choosing and USB port for a SDHC adapter, if your kernel traces (dmesg) shows the following line you need to pick another port!

not running at top speed; connect to a high speed hub

OK, enough blah …

The results

Kingston microSD 16G SDHC Class 4

dd results: 15997075456 bytes (16 GB) copied in 6491.87 s (1h48) or 2.5 MB/s.

Reading performance (blue line):

  • Minimum read rate: 18.6 MB/s
  • Maximum read rate: 20.9 MB/s
  • Average read rate: 18.9 MB/s

Writing performance (red line):

  • Minimum write rate: 1.7 MB/s
  • Maximum write rate: 4.7 MB/s
  • Average write rate: 2.4 MB/s

Average access time: 2.2ms (green line)

kingstone microSD 16G performance graph

SanDisk microSD 16G SDHC Classe 4

dd results: 15931539456 bytes (16 GB) copied en 4934.48 s (1h22) or 3.2 MB/s

Reading performance (blue line):

  • Minimum read rate: 20.6 MB/s
  • Maximum read rate: 21.1 MB/s
  • Average read rate: 21.0 MB/s

Writing performance (red line):

  • Minimum write rate: 1.3 MB/s
  • Maximum write rate: 5.7 MB/s
  • Average write rate: 2.4 MB/s

Average access time: 1.6ms (green line)

SanDisk microSD 16G performance graph

Conclusion

Those two cards are similar with a light advantage for the SanDisk one.

Did you realize how great format 3.0 (quilt) is ?

I did just yesterday !

I was hacking on fluxbox and rebuilding the package to test directly on my system.
When I was happy with my changes I thought, I should write a patch for this…
But guess what ! With format 3.0 (quilt) it was already there, in the debian/patch directory, just waiting to be renamed and completed with a nice DEP-3 header !

It is a lot more easy to contribute with those tools!

So thank you debian folks !

Installing debian on EeePC 1201HA: the synaptics touchpad

As usual debian’s wiki is a great resource, look it’s page about Synaptics Touchpad and most of the configuration is done.

So here I got the finger tap to work, but is spite of my efforts, the two finger scroll would not work. Well actually it did work using synclient but it was lost by next restart… And the hint was on the wiki but on Elantech Touchpad‘s page, near the end, in “GUI assistance” section: “Beware that they can override the global X settings in xorg.conf.”

So if you’re using gnome, look at the Mouse setting in gnome menu. You can also try gsynaptics, but while gnome mouse settings are reloaded each time you switch VT or suspend the computer, gsynaptics has to be reloaded manually.

Gnome didn’t let me check the two finger scroll option, so I opened gconf-editor searched for the touchpad key and found it as /desktop/gnome/peripherals/touchpad and changed scroll_method to 2. It’s still grey in the menu, but it’s checked an it works!

There is one remaining issue with gnome, if you want a different button for 2 finger tap than button 3, you can’t! I first fell on the fedora bug report about it which lead me to gnome’s one. So as of today, there is a patch, but not integrated in gnome, and I did not test it.

So I was tempted to switch to my old wm fluxbox, but didn’t take the time to configure it yet. Also reading Who-T’s blog, and especially this post xmodmap keyboard deconfiguration made me think that configuring one’s desktop trough Gnome and the like is going to be “the right way” in near future. As fluxbox session is just a plain bash script, we’ll need more working CLI tools for the hotplug configuration…

Well to come back, the touchpad is not going to be hotplug so a plain old config file like xorg.conf should in my opinion remain a valid choice (especially now that it does no goes through some other xml stuff as with hal). But then, the desktop configuration (ie Gnome) shouldn’t mess with it as it’s doing now!

Installing debian on EeePC 1201HA: the grub 2 trick

As already stated in the previous post update I’m now using the method described on debian eeepc wiki for booting in native resolution, so I’m no longer using the IEGD driver (nor my xserver by the way).

I find it a lot more stable !

I no longer have the issues with the mouse cursor jumping randomly to the lower right corner.

I even configured the touchpad to use the tap to click mode and the two finger scroll mode. (This will be the subject of a following post)

One more thing about using 915resolution in grub2, if like me you find that windows no longer want to boot, then only load 915resolution.mod before loading the linux kernel and not at grub startup.
You can do that by adding the following lines in /etc/grub.d/10_linux.

	echo insmod 915resolution
	echo 915resolution 58 1366 768 32

Instead of creating the /etc/grub.d/01_915resolution file.

I did place it at the end of the if block testing the GRUB_GFXPAYLOAD_LINUX variable.

Hope this will help some of you !

Trial and errors with git branches

I’ve recently learned to use git (for my xorg adapted packages) and used it later for netsed.

In order to develop UDP in netsed, I had to try several stuff, my network programming experience in C is back to some school time, so this was really trial and errors. And here git really helps, all I had to do is create branches for each trial, so I don’t loose any tracks I’ve taken, then when I found the right way to do it, I could just merge or cherry pick from the branches (or even just copy past from gitk to my favorite editor gvim) and that was it !

Of course I can now delete the trial branches, but those were really helpful during development time.

This meant abusing of git commit --amend, git merge ( --squash ) and git cherry-pick commands, but well you cannot build a clean code without effort.

I should probably give another look at git stash which seams to fill similar needs.

Installing debian on EeePC 1201HA

The first reference for installing debian on an Eee PC is The Debian Eee PC project. However it says on
its models page that it does not fully support 1201HA, because it uses the Poulsbo chipset. The reason is that it’s not supported by mainstream debian: see #533450 for details…

However installing debian Squeeze (testing) using the debian installer snapshot was fearly easy. Read DebianEeePC/HowTo/InstallUsingStandardInstaller for details.

The only noticeable issues I had was with partitioning where the partition table was not reloaded by the kernel; and grub that installed itself on my installation USB Key instead of the primary drive.

A good point is that network and wifi worked out of the box. So then I needed X to work with the native resolution.

Reading the above bugreport and a few other website showed that there are two drivers out there. One poulsbo driver (that seams to come from ubuntu) and the intel IEGD driver. Nobody seams to maintain the first one, and the second is proprietary but at least works. However none work with the 1.7 version of xserver. So the first step is to get an older xserver.

Lenny has and old one but downgrading all X related packages (including gnome ones) was a pain, so I quickly switched to an other solution:
Rebuilding and xserver 1.6 package.

See next post for details on building the xserver 1.6 packages.

This solution worked fine with the IEDG 10.3 driver.
I’m still experiencing some X freeze from time to time (which are solved only by rebooting). The touchpad does not have the multifinger features I was used to, and sometime the cursor jump to the lower right corner, but I didn’t really tried to investigate this anyway.

Update
As Steve McIntyre pointed out there is an other way to get the native resolution, using grub2 and fbdev, see http://wiki.debian.org/DebianEeePC/Model/1101HA for details.
I just updated to this configuration and it works !

Trading Places on Debian

To fit a particular job, several choices are often available. For softwares, it the same!

For example, while configuring a system we need a text editor. On recent distros, we get nano, on others we have vi (or a variant like nvi, vim…). On debian the defaukt editor is simply called editor.

Let’s see that:

$ which editor
/usr/bin/editor
$ ls -la /usr/bin/editor
lrwxrwxrwx 1 root root 24 mar  4 09:01 /usr/bin/editor -> /etc/alternatives/editor

So editor is not a program, simply a symbolic link to the same file name in /etc/alternatives and that last on is an other link to the actual editor program.

To update the editor we could change the link, but that’s quite direct were debian gives us a nice way to do it with the command: update-alternatives.
Obviously to update system configuration you have to be root (use su or sudo whatever you like best)

# update-alternatives --config editor

A text menu will propose you the available alternatives.

That’s for the big picture, I was first on using this on the case of the flash plugin for firefox (well iceweasel). Even after installing flash form debian-multimedia repository, firefox was still using swfdec, ad removing swfdec was breaking gnome’s dependencies… The solution is above, firefox uses a flash-mozilla.so plugin, this is an alternative! So:

# update-alternatives --config flash-mozilla.so
There are 2 choices for the alternative flash-mozilla.so
  Selection    Path
-----------------------------------------------
*+        1    /usr/lib/swfdec-mozilla/libswfdecmozilla.so
          2    /usr/lib/flashplayer-mozilla/libflashplayer.so
Press enter to keep the current choice[*], or type selection number:2
update-alternatives: using /usr/lib/flashplayer-mozilla/libflashplayer.so to provide flash-mozilla.so.

You did it!

That’s no because flash is not open source that we have to read on debian or ubuntu forums that the solution is to remove manually libswfdecmozilla.so or any similar nonsense, there is a way to do it, that what new users should learn.

Music Player Daemon

If you are storing your music file on your home server’s hard drive, so why don’t you play it from here ?

That’s just what I did, especially with the SPDIF output on the server’s motherboard connected to my sound system, that would have been a waste not to use it!

But it’s a server, it has no screen, no keyboard…

You can play your music using mpg321 from an ssh connection, you can even use screen, that would work. But there is a nice program that’s even better for that case: Music Player Deamon aka MPD
Continue reading