Home

Wed, Dec. 5th, 2007, 05:12 pm
Kernel Sources woes with TrueCrypt

In order to get the files you need for making any module but more specifically TrueCrypt module working (assuming that you are using the Fedora 7 stock, or updated, Kernel): http://www.mjmwired.net/resources/mjm-fedora-fc6.html#kernelsrc
There are 3 basic steps involved in installing the kernel source.
1. Download the desired kernel source (matching your current kernel if required)
sudo yum install yum-utils
yumdownloader --source kernel

2. Installing the SRC.RPM package
sudo rpm -ivh kernel-2.6.23.1-21.fc7.src.rpm
3. Using rpmbuild to prepare the source into a usable state
sudo rpmbuild -bp --target=$(uname -m) /usr/src/redhat/SPECS/kernel-2.6.spec

Now, it's ready for the truecrypt part.

4. Edit truecrypt's truecrypt-4.3a-source-code/Linux/build.sh file to point to a different KERNEL_SRC:
KERNEL_SRC=/usr/src/redhat/BUILD/kernel-2.6.23/linux-2.6.23.i686
5. Edit line 659 of truecrypt-4.3a-source-code/Linux/Kernel/Dm-target.c to comment out the last "NULL" argument to kmem_cache_create. It should read: bio_ctx_cache = kmem_cache_create ("truecrypt-bioctx", sizeof (struct bio_ctx), 0, 0, NULL/*, NULL */);

But alas!!
# modprobe truecrypt
FATAL: Error inserting truecrypt (/lib/modules/2.6.23.1-21.fc7/extra/truecrypt.ko): Invalid module format

So I did a 'dmesg' and the error was: truecrypt: version magic '2.6.23.1-21.fc7 SMP mod_unload PENTIUM4 4KSTACKS ' should be '2.6.23.1-21.fc7 SMP mod_unload 686 4KSTACKS '

This is because even though I downloaded and configured the kernel sources (above). It still "looked" at kernel-devel for the kernel config etc. It so happened that when I ran make config in /usr/src/kernels/2.6.23.1-21.fc7 i changed the processor type to Pentium4. Not knowing what else I had changed, I decided to uninstall/reinstall "kernel-devel". When I rebuilt it, and modprobed truecrypt it worked fine.