Wednesday, April 20, 2005

Kernel Compiling

Just the word "compile" causes most non-programmers to
shift in their seat, and rub the back of their neck in
discomfort. It does to me too. I hate programming, and
the thought of compiling the latest Linux kernel
( seemed like a task WAY over my head. But I
decided to tackle it. What's the worst that could
happen? I have to go back to my perfectly functioning
previous kernel (
So why did I upgrade and go through the hassle? 1) to
learn how to do it, 2) keeping an updated kernel is a
good security practice.

So with my trusty O'Reilly "Running Linux" book in
hand, I began my research. The book does a great job
at describing the why's of each step. However, I felt
some steps were missing, and became confused. Doing a
quick Google search of 'kernel compile', gave me a few
good sources to use as reference. One I list here is:
Digital Hermit
This one gave the best description of the steps, and
didn't seem to miss anything. Here are a few things I
learned that were not mentioned there.
1) Most kernels now are stored in bzip2 format, and
requires bunzip2 to decompress. I've never used it
before, so I looked at the man pages prior to
2) Mandrake 10.1 does NOT initially support 'make
xconfig', as I wished it would. I even tried
installing a few extra packages and programs, trying
to get it to work, but in the end, just settled for
'make menuconfig'. It really is very simple.
3) If there is an option during the kernel
configuration you are not sure of, you can bring up a
description of that item. Menuconfig required a '?'.
This was great, cause I didn't want to search the web
on all these strange new things to discover what it
did, and if I really need it.
4) Mandrake, and I am sure other distros uses
soft-links for many configuration files when it comes
to the kernel. An example: "/usr/src/linux" pointed to
"/usr/src/linux-", my old kernel source
files. I had to change this soft-link and others to do
some work later on.
5) ALWAYS, ALWAYS, ALWAYS leave a copy of your old
kernel in your lilo or grub boot menu. On my first
compile attempt, I missed something, and had a "Kernel
Panic"! Not the best thing to see, unless you have a
spare kernel ready to boot to, which I did. Always,
always always. Did I mention always?
6) Certain drivers themselves, may need to be
recompiled to work with your new kernel (if you are
upgrading). Best example is my NVidia driver. It was
simple enough to run 'nvidia-installer --uninstall'.
Then I unzipped my copy of the driver (or you can d/l
the latest), and re-install.
Some problems came up that I didn't intend on. The
first one was a pretty simple fix, but finding the fix
was a bear. The program cdrecord, used to burn discs
both in the GUI and command-line, didn't like to burn
anymore. It threw me a "Cannot allocate memory. Cannot
get SCSI I/O buffer" error. The fix was to take the
'Set UID' bit off two files: cdrecord and cdrdao. The
command is this (as root):
chmod -s /usr/bin/cdrecord
chmod -s /usr/bin/cdrdao
The next problem I had and still have is my audio. I
have read about a million posts with people that have
the same problem. They recompile, and sound stops
working. By default after a recompile, all sound is
muted. And the common fix is to unmute the sound and
set the levels with "alsamixer". Then run as root,
"alsactl store". Well for me, it doesn't work. When I
reboot, sound it muted again. I've tried an alternate
driver (default is snd-via82xx, alt is
via82cxxx_audio), with no luck. I've plum ran out of
ideas. If anyone reads this and knows of a fix, PLEASE
email me. It's ALSA version 1.0.8. And if I find a
fix, I'll post it.

No comments: