Issue #3, July 2005
SlackNotes: Adding sound to a custom 2.4 kernel
Author: Mikhail Zotov
OK, silly doesn't have a soundcard (aka noisegenerator) yet. This is probably not a typical situation for a home PC these days. Let's take a look how one can enable sound when compiling a custom kernel for a machine with a sound card (assuming the card works with the stock Slackware kernel and uses ALSA). We shall use the same EXTRAVERSION = a as in the KUAC Guide.
Following the scheme used above, let's figure out which sound card is present in our machine:
~$ /sbin/lspci | grep -i audio 00:1f.5 Multimedia audio controller: Intel Corp. 82801BA/BAM AC'97 Audio (rev 05)
and which driver is used:
~$ lsmod | grep snd | grep -v oss snd-intel8x0 19808 0 snd-ac97-codec 66012 0 [snd-intel8x0] snd-timer 14948 0 [snd-pcm] soundcore 3652 4 [snd]
As is clear from the above output, the key driver is called "snd-intel8x0". Unfortunately, the 2.4.31 kernel doesn't have this driver in the source tree:
linux-2.4.31$ find . -name "intel8x0*" -ls linux-2.4.31$
Thus we need to recompile the alsa-driver package (if we are not satisfied with OSS). Prior to this, for the sound system to work, it must be enabled in the kernel, e.g., this way:
<M> Sound card support <M> Intel ICH (i8xx), SiS 7012, NVidia nForce Audio or AMD 768/811x <M> OSS sound modules
Remark 1. Feel free to drop "OSS sound modules" support if you are not going to use OSS.
Surely, one can just grab the original alsa-driver.SlackBuild script available in /path/to/slackware-current/source/l/alsa-driver, edit the string
KVERSION=${KVERSION:-2.4.29}
to reflect that we are going to use our brand new kernel:
KVERSION=${KVERSION:-2.4.31a}
and blindly execute the script. This is not our way though because we don't need all available sound drivers but only those necessary for our machine.
Remark 2. Notice that we intentionally didn't use dash in EXTRAVERSION. A dash would have broken the Slackware scheme of naming packages!
Now, let's unpack the alsa-driver source tar ball and figure out how we can modify the build script to compile only the driver(s) we need:
~$ tar xjvf alsa-driver-1.0.8.tar.bz2 ~$ cd alsa-driver-1.0.8 ~$ ./configure --help
(It may be convenient to redirect "./configure --help > configure.help".)
The stock alsa-driver.SlackBuild script runs ./configure with the following options:
./configure \ --with-isapnp=yes \ --with-sequencer=yes \ --with-oss=yes
and thus all possible drivers are built. A brief look at the output of "./configure --help" reveals that we need to run ./configure with the option "--with-cards=intel8x0". We can also disable isapnp (since we don't have ISA cards) and sequencer. We also need to indicate explicitly the path to the kernel source since we have used a custom directory instead of the /usr/src/linux assumed by default. Thus, the ./configure section of our custom SlackBuild script may look this way:
./configure \ --with-kernel=/path/to/linux/kernel/source \ --with-cards=intel8x0 \ --with-isapnp=no \ --with-sequencer=no \ --with-oss=yes
Disable oss (--with-oss=no) if you don't need it, see Remark 1 above. :-)
Now, run our new alsa-driver.SlackBuild script and ... don't go far away. The build time will be reduced by an order of magnitude in comparison with the stock script.
A moment later we have alsa-driver-1.0.8_2.4.31a-i486-1.tgz package. The next step is to upgrade the package we have. NO! NO!! NO!!! Don't upgrade because this will delete the stock drivers present in /lib/modules/2.4.31 (and other drivers if you have already built any kernels with alsa-drivers). The right command is:
# installpkg alsa-driver-1.0.8_2.4.31a-i486-1.tgz
Voila! Now we are ready to reboot and enjoy sound with our brand new kernel.
Remark 3. Does one have to compile alsa-driver in case she/he is satisfied with OSS? Surely, not. One can just build a kernel with OSS built in:
<*> Sound card support <*> Intel ICH (i8xx), SiS 7012, NVidia nForce Audio or AMD 768/811x <*> OSS sound modules
and forget about ALSA completely. Just run, say,
# chmod -x /etc/rc.d/rc.alsa
or edit rc.M in an appropriate way.
Remark 4. A good thing with 2.6 kernels is that one doesn't need to compile an alsa-driver package, at least not in the case considered above because the kernel source already contains the necessary driver and thus it can be compiled during the kernel build.
Copyright © 2005 by The Slack World, check here for the details.
The individual articles and posts are copyrighted by their authors.