Intel’s free literature

I noticed that you are able to order hard-copy’s of Intel’s books on the IA-32, 64 and Itanium architecture. So I did.

Today, a few days later, I received them. They’re very informative thorough and well structured. And, in contrary to other professional literature, you are able to read it without crunching your brains on one jargon-filled sentence. Basically free, dense and easily read books and great references.

So, a big thank you to Intel for this nice free service.

By the way, Itanium seems to really rock. (256 registers, compiler branch prediction, 8-superscalar, etc)

Also, I’ve got no spare room anymore on my desk. 🙂

intelbooks1.JPG

Rotating Beryl cube using HDAPS on a Thinkpad

I hacked together this little ruby script to read the G-measuring device in the Thinkpad’s harddisk (HDAPS) and rotate the desktop cube of Beryl when sudden movement occurs. A bit like what has been done for the MacBook already.

http://w-nz.com/~darkshines/projects/rtollina.rb

GPL, obviously. It’s not really perfect yet. I’ll try to improve it tomorrow and add support for compiz and maybe even make a little widget out of it.

It’s based on code by Fer, which is for Compiz instead of Beryl.

XGL take 2

I tried to get AIGLX to work on my Thinkpad yesterday. AIGLX is an API similar to XGL, but is a better implementation. Unfortunately AIGLX requires implementation by the video-card driver (which is good because it allows more performance), but the proprietary drivers of ati still doesn’t support it. (nvidia’s do, note to myself: get nvidia next time).

So I had to revert to XGL. A lot has changed since the last time I installed XGL. Other gentoo overlays, other windows managers, other hacks.

I used the gentoo-xeffects overlay to get Xgl.

Installing Xgl was a lot more straight forward and less of a problem than it used to be. An emerge and writing a simple startxgl script was enough.

The compiz-quinstorm patchset seems to have evolved to a proper branch of the compositing window manager, now called Beryl. It also includes a nice settings manager now.

Even hibernation and suspend finally seem to work. 🙂

A nice screenshot:
xgl4.png

One thing left to do: integrate Xgl into xdm.

Avoiding multiple lock dead-locks by memory addresses

Sometimes you need to lock several resources. If you don’t take great care you are likely to get yourself into dead-locks. A simple example with just two lockable resources A and B:

function foo {
  lock A;
  lock B;
  // Do something with A and B
  unlock A;
  unlock B;
}

function bar {
  lock B;
  lock A;
  // Do something different with A and B
  unlock B;
  unlock A;
}

When foo and bar are called at about the same time then there is the change that foo locks A and bar locks B which will make bar wait on foo‘s lock on A and vice versa.

Solution: fixed order on memory address
The simplest way to get rid of the deadlock is to always try to acquire a lock on A before on B. A generic solution would be to always lock the resource with the lowest memory address first.

This only works when memory addresses are fixed or that there is an otherwise fixed order-able property.

A loud present

Today, a friend of mine, Gerben, gave me a birthday present (a tad late). Not the usual beverages (turned 18 ;)) (usual, but still very well appreciated :)), but a home-made portable speaker with built-in amplifier. Here seen making more sound than the internal speaker of my Thinkpad:

dsc_0050.jpg

It’s a nifty little device: it’s powered by either an internal battery or an external power source.

dsc_0048.jpg

It contains a voltage converter and a rectifier which allows a variable AC power source to be connected. This has been added to be able to connect the speaker to the electrical generator of a bicycle. Why? The previous version of this speaker was taken on the bicycle trip with a few friends to the Hertog Jan Brewery in Arcen (~70km) which was only powered by a battery (which tends to be exhausted).

Even better, when set into external source mode it recharges the battery. And because of the voltage converter, the sound doesn’t get louder when you are cycling faster, but the quality of the sound gets better!

dsc_0051.jpgdsc_0049.jpgdsc_0047.jpg

I’ve had quite some fun dissecting the little device. Thanks again Gerben!

Fallacies (1)

I just read this on slashdot:

statistically significant relationship between autism rates and television watching

Offcourse this relation was explained as televisions causing children to become autistic. This is a very annoying fallacy. Why? Because just maybe children with autism like to watch television more than other children.

If there is a relation, and if it’s not coincidental, there are still two ways to explain it as a cause and effect relation — you cant just blindly assume that one of the two is the cause.

Same goes with relations like:

“Children that play violent games are more likely to become criminals” or “Children that are to become criminals are more likely to play games”

Stupid shout culture.

T60 (2)

After 2 days installing gentoo on my great T60 I’ve accomplished quite a lot so far:

  • WiFi works. 4 seperate components (userland, firmware, kernel module and yet another kernel module) increase complexity a bit. Although the fifth component caused trouble — I forgot to tweak conf.d/net
  • Radeon X1400 and video card worked almost directly after using aticonf — nice! When I upgraded to xorg-server-1.1, though, I got a few crashes when closing X in a not-so-nice manner.
  • Using the synaptics drivers my touchpad now support drag’n’drop, right and middle mouse click and scrolling emulation. Still got to find a way to bind the thinkpad shortcut to disable/enable the point or pad.
  • Finally got the DVD rewriter to work. It seems I overlooked one little stupid generic E-IDE option in the kernel config.
  • Bluetooth and infrared should work — haven’t got the gadgets to try them out
  • Never even saw a PCCard, so didn’t even bother to look into ti
  • Software suspend (hibernation) doens’t work yet, but I definitely be working on that.

Arcen

Last tuesday I cycled with some friends (about 11) to Arcen to visit the Hertog Jan brewery. The ~75km of cycling went pretty well — way better than expected. We stayed on a 4 star camping for the night and cycled back the next day.

Needless to say, this was a great experience and we all had a lot of fun.

Some photos were made, I’ll post them as soon as I get them.

bcmap 0.1

bcmap is a simply program to be linked against klibc to map Broadcom RAIDCORE disks to more sensible and stable device nodes.

Currently the bcraid drivers assign the next available sd node to a detected disk, which is very inconvenient when you have a usb stick inserted on boot which pushes your root disk from sda to sdb.

bcmap ensures that your first array will always be /dev/bca, which is a nice thing.

>>> bcmap-0.1.tar.bz2 (source code)

Licensed under the (holy) GNU GPL v.2

bcraid drivers part two

Here’s a small patch that tweak the broadcom raid drivers for the bc4000 series to run on the latest kernels:

http://w-nz.com/~darkshines/projects/bcraid-2.1.0-bw1.patch

Note that it is everything but complete. Some other pointers getting the bcraid to work:

  • Use sparse memory or conitguous memory instead of incontiguous memory in the memory layout configuration in the kernel. (CONFIG_SPARSEMEM=y)
  • Enable the magic sysrq key (CONFIG_MAGIC_SYSRQ=y)

At the moment I’m trying to get the bcraid module working in an initrd to allow the root partition on the raid drivers.

Gentoo and BC4000 series RAID cards

Raidcore hasn’t released drivers that support gentoo linux, only precompiled drivers for the other big distro’s.

I’ve managed to get the drivers for the bc4000 series to work on Gentoo Linux 2006.0 on linux-2.6.16-gentoo-r9 for the bc4852 card.

You need the driver SDK, which contains the source of the precompiled drivers they distribute.

I had to tweak some kernel configurations to get it to work — first of I had to turn the ‘sysrq magic key’, although it seems easy to remove all sysrq usage in the drivers itself iif you aren’t comfortable with sysrq.

I had to switch from ‘discontiguous memory’ to ‘sparse memory’ layout — the driver relies on the availability of ‘mem_map’.

In the Makefile of the bcraid there’s an issue with the PLATFORM define. It should be defines with ‘uname -m’ instead — otherwise it won’t link in the binary blob.

The bccfg init script they provide seems terribly useless, adding ‘bccfg’, and ‘bcraid’ for that matter, to /etc/modules.autoload.d/kernel-2.6 does just as fine, but cleaner.

Initially it seems that everything works fine, although I’m a bit worried about a lot of errors related to the bccfg device nodes in dmesg.