Monday, November 5, 2007

Howto: upgrade ALSA, (k) Ubuntu Gutsy 7.10

Original post written in spanish here:
Cómo actualizar ALSA en (k) Ubuntu Gutsy 7.10

How to upgrade ALSA in Ubuntu Gutsy 7.10.
The first part consist of installing the necessary tools for compiling the source files.
$ sudo apt-get update
$ sudo apt-get install module-assistant build-essential fakeroot dh-make debhelper debconf libstdc++6 linux-headers-generic libncurses5-dev
In order to compile from HG repository (check this out! only do this if you want to get the most recent snapshot, possible not stable) we will need to do this:
$ sudo apt-get install mercurial

Now, download the sources. We got 2 options:
First option. Stable: 1.0.15 version:

Optional:

Once we have downloaded, we extract them for example in the folder ~/src/alsa

Second option. HG Mercurial repository.
We previously have installed mercurial, so now we do the following:
$ cd && mkdir src && cd src && mkdir alsa && cd alsa
$ hg clone http://hg-mirror.alsa-project.org/alsa-driver alsa-driver
$ hg clone http://hg-mirror.alsa-project.org/alsa-kernel alsa-kernel
$ hg clone http://hg-mirror.alsa-project.org/alsa-lib alsa-lib
$ hg clone http://hg-mirror.alsa-project.org/alsa-utils alsa-utils
$ hg clone http://hg-mirror.alsa-project.org/alsa-oss alsa-oss
If we cloned the repo before, we can update it by doing:
$ cd alsa-driver && sudo hg pull -u && cd ..
$ cd alsa-lib && sudo hg pull -u && cd ..
$ cd alsa-utils && sudo hg pull -u && cd ..
$ cd alsa-oss && sudo hg pull -u && cd ..

Before installing or compiling anything, we got to stop the utilities, otherwise there is a crash risk. Attention! This is important so don't skip it!
$ sudo /etc/init.d/alsa-utils stop

The following step is install the driver:
Option 1. Normal method (not HG).
$ cd alsa-driver
With the option "--with-cards" will set the driver we want to compile. To see which ones are available type ./configure --help. In my case I want to compile usb modules and intel ones.
$ sudo ./configure --with-kernel=/usr/src/linux-headers-$(uname -r) --with-cards=hda-intel,intel8x0m,intel8x0,usb-audio --with-oss=yes ; sudo make ; sudo make install
Then, the libraries:
$ cd alsa-lib
$ sudo ./configure ; sudo make ; sudo make install
After that the utilities:
$ cd alsa-utils
$ sudo ./configure ; sudo make ; sudo make install
And finally OSS:
$ cd alsa-oss
$ sudo ./configure ; sudo make ; sudo make install

Option 2. Mercurial HG.
$ cd alsa-driver
With the option "--with-cards" will set the driver we want to compile. To see which ones are available type ./configure --help. In my case I want to compile usb modules and intel ones.
$ sudo ./hgcompile --with-kernel=/usr/src/linux-headers-$(uname -r) --with-cards=hda-intel,intel8x0m,intel8x0,usb-audio --with-oss=yes ; sudo make ; sudo make install
Then the libraries:
$ cd alsa-lib
$ sudo ./hgcompile ; sudo make ; sudo make install
After that the utilities:
$ cd alsa-utils
$ sudo ./hgcompile ; sudo make ; sudo make install
And finally OSS:
$ cd alsa-oss
$ sudo ./hgcompile ; sudo make ; sudo make install

REBOOT and... There it go!!!

Note: you have to do the steps before everytime you update the kernel.

Tricks:
Several soundcards and default soundcard:
This issue was hard to figure out but finally figure I found a "solution" for my case not by doing so difficult stuff.
You only have to change the scrip which loads the modules in /etc/modprobe.d/alsa-base by doing the following:

$ sudo nano /etc/modprobe.d/alsa-base

At the end of the file we got a few lines to prevent the driver to grab index 0. To get a certain soundcard to be the default you need to change the -2 to -1 in the module you want to be first loaded so you can get that card as default. (See the following)

options snd-bt87x index=-2
options cx88-alsa index=-2
options saa7134-alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
options snd-usb-audio index=-1
options snd-usb-usx2y index=-2
options snd-usb-caiaq index=-2


If you want to experiment a little bit, and you know what you are doing! can try to configure by typing: $ sudo alsaconf

0 comments: