-   Linux - Kernel (
-   -   Question about old added kernel modules when compiling a new kernel (

Alpha90 09-07-2012 02:41 AM

Question about old added kernel modules when compiling a new kernel
Dear LinuxQuestions

I have a debian squeeze 6.0.5 distro which came with kernel 2.6.32 which left me with some incompatible hardware such as my sound and tuner card. Thinking I could fix the problem with a simple patch I downloaded a newer version of alsa and compiled it and added it into my kernel module and then I had sound. However I found my tuner card would not work at all with my kernel version but it would work with a newer version so I backported 3.2 onto my system which did not fix the problem as I found. After some research I discovered I would have to venture out of my distro's repository and seek to compile the kernel directly. I am just about to start that project however i have one hiccup that I need to fix. When i shutdown i notice a bunch of errors now that my system log just does not seem to log and furthermore they display oddly. The errors come out in a stairstep fashion such as.
error err
or error ..... etc.
All error messages point to kernel modules snd_"Something" such as snd_virtuoso which is the chip of my sound card hence my memory.

I did nothing to actually take the old modules out and i am pretty new to linux but very technical minded so I dont actually know if i need to do something to unload the old modules. Furthermore if i do not could having compiled and installed the sound subsystem have left behind erratic flotsam in my system. Modules duplicated by being integrated into the newer kernel that i am using rendering them basically trash. Or could i completely be on the wrong line of thinking

deadeyes 09-10-2012 12:28 AM

First I would always recommend using a precompiled kernel. Isn't there any fresher one out there?(maybe not in stable branch)

Also, when you update your kernel, the new modules will be placed in another directory.
/lib/modules/<kernel version>

So these won't give conflicts.

An issue might be the mix from the alsa version and kernel version.

Alpha90 09-10-2012 04:55 PM

Why shouldn't you compile a kernel yourself? I thought most pre-compiled kernels were bloated.

sundialsvcs 09-11-2012 08:35 AM

Whether you compile it yourself or not, it is imperative that all of the available kernel-modules must be known to be compatible with it.

If you do compile your own kernel, I recommend the following procedure:
  1. Make a copy of the hidden .config file as a non-hidden, dated file in a subdirectory of /root. Write-protect the file after you have created it. Each time you recompile your kernel or make any changes, repeat this procedure. Never over-write any copy that you have made, even if you determine it was in error. (Rename erroneous files appropriately, but keep them.)
  2. Preserve the .config file: mv .config kernel_config (The temporary-name is unimportant ...)
  3. make distclean (This will destroy .config.)
  4. Rename it back, as a hidden file: mv kernel_config .config
  5. make && make modules && make install (or whatever build-sequence is called for)
  6. Explicitly check both the kernel directory and the modules directory to be sure that all files are recently-dated as expected.
  7. Make an entry, with a number-two pencil, in the loose-leaf notebook that you always keep beside the computer.

Remember that kernel modules are part of the kernel once they are loaded. Although version-guard checks do exist, you must not rely upon them completely.

deadeyes 09-12-2012 05:47 AM


Originally Posted by Alpha90 (Post 4777196)
Why shouldn't you compile a kernel yourself? I thought most pre-compiled kernels were bloated.

The kernel is bloated in a way that it has modules for almost everything.
However the kernel has loadable modules support.
So if you don't need a module, it will not be loaded.

Support is also easier to get when you are using your distros kernel.
More people have the same kernel so if you have issues they might already be documented.

You might think you will gain performance, however I doubt in most setups this "gain" will be noticeable and worth the effort(depending on the goal and your experience with linux).

Of course you can go with compiling a kernel. I am using Gentoo and do it all the time.

sundialsvcs 09-12-2012 09:04 AM

To elaborate slightly ...

When a "stock" kernel is booting, first it "sort of comes halfway-up," far enough to unpack the contents of the "initial ram-disk," mount it under a minimal contrived shell, and let it run a bunch of hardware-discovery scripts provided by the distro vendor. These scripts select which loadable kernel modules to load, to support whatever hardware it detects. The loaded kernel, therefore, is not really so "bloated," but you still wind up having a bunch of kernel modules lying around. (Hey, if your computer happens to have a DECSystem token-ring card installed, your kernel is ready to use it! "On sale today!" :hattip: )

You can, if you choose, determine what that set of modules turned out to be, and compile them into a customized kernel. You can also query the actual characteristics of your CPU, motherboard devices, and so on, and compile the kernel with options that are specific to that. Having done this, you can actually eliminate entirely the "halfway house."

The question is ... do you want to bother? Sure, it can be fun to have a system that boots in eleven seconds flat ... as mine (Gentoo) in fact do. But, most of my Linux systems remain booted for literally months at a time. The time it takes to reboot, therefore, is inconsequential to me. (Unless, of course, I can manage to get it down to ten seconds ... hmmm ... hackahackahackahack ... ) ;)

Alpha90 09-13-2012 03:03 PM

Well my primary reasoning for wanting to compile my own kernel other than to fix my issue with alsa is to start to learn some of the mechanics behind optimizing a kernel with the hopes of building linux from scratch and possibly eventually write kernel modules. I did notice that taking verbose notes of all the changes i made was so useful in debugging a mistake i made :D

All times are GMT -5. The time now is 10:40 PM.