the rift conspiracy


How to rebuild kernel-module-alsa when upgrading kernel
Thursday 24 June 2004 - 23:17:53

Whenever I upgrade the Linux kernel in Fedora Core 1 I have to recompile kernel-module-alsa from source. Luckily that's easy when you know how:

First prepare your kernel source tree as root


# cd /usr/src/linux-2.4
# make mrproper
# cp configs/-YOUR-.config .config
# make oldconfig
# make dep


If you're not sure which config file you should copy, you can probably grab the one from /boot instead:


# cp /boot/config-`uname -r` .config


Remove the word "custom" from the line in include/linux/version.h that reads something like


#define UTS_RELEASE "2.4.22-1.2199.nptlcustom"


Set up an RPM build environment in your home directory by putting this in ~/.rpmmacros, change the %_topdir to where you want to build RPMs. -march should also match your CPU.


%_topdir /home/cso/rpmbuild
%_tmppath /tmp
%optflags -march=i686
%_vendor fedora


Make the RPM build directories us user:


# mkdir -p ~/rpmbuild/RPMS ~/rpmbuild/BUILD ~/rpmbuild/SRPMS


Grab the alsa-driver SRPM:


$ wget http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/1/alsa-driver/alsa-driver-1.0.5a-1.src.rpm


Now we're ready to compile the alsa module as a regular user. I have an Audigy sound card, so I only build the driver for this card. My PC's CPU is a Pentium III so target must be i686, change this to athlon if necessary.


$ rpmbuild --rebuild --target i686 --define "cards emu10k1" alsa-driver-1.0.4-1.src.rpm
$ cd /-YOUR-/-RPM-/-BUILD-/-DIR-/RPMS/i686
$ su
# rpm -Uvh --replacefiles --replacepkgs 
alsa-driver-1.0.4-1.i686.rpm 
kernel-module-alsa-1.0.4-1_2.4.22_1.2194.nptl.i686.rpm
# depmod -ae