LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Multiple kernels with different modules (https://www.linuxquestions.org/questions/linux-kernel-70/multiple-kernels-with-different-modules-628384/)

botzkoz 03-16-2008 03:55 AM

Multiple kernels with different modules
 
Hi all,

I need multiple linux kernels, but for all kernel I want to have different modules.

When I try to recompile my original kernel (of Slackware 12) I change some exclude some modules and make some changes in the kernel. After that reboot with new kernel, but it stuck :(. I try to reboot with original one but there ware errors (missing or invalid modules).

I reinstall Slackware and try to change only the type of the CPU and recompile only the kernel (no module changes). After reboot with new kernel I receive some errors and modules (of the original kernel) was not loaded.

So I need to have different kernels with different modules. Please tell me how to compile new kernel with it's own modules?

Bruce Hill 03-16-2008 09:36 AM

Welcome to LQ!

You didn't state how/where you rebuilt your kernel.

Follow my Kernel Rebuild Guide this time.

If you wish to start with the Slackware kernel configuration options,
and just change some of them, cp that configuration file to the
path of your new kernel source, such as:
Code:

cp /usr/src/linux-2.6.21.5/.config /home/mingdao/kernel/linux-2.6.24.3/
then run "make xconfig" and make your changes, save the file, then finish
following that guide.

raskin 03-16-2008 10:03 AM

I assume you used menuconfig, right?
First, do not forget to add distinct local suffix to each uild, so its module directory is distinct from all the others. Second, for a life with much less problems, if you are not experienced with kernel builds, find out what modules are loaded on your machine, check web for wat modules are needed to recognize your HDD/mount your root FS (they are at the ottom of the list) and compile them into the kernel. Distribution provides initrd with each kernel, and that ramdrive has all the drivers needed (and it is loaded by GRUB using BIOS calls). But surely initrd drivers match shipped kernel, but fail to load if you replace the kernel.It would be OK once you mount root FS and get to use /lib/modules, but you need to access HDD for that. You can start reading /documentation on initrd/initramfs now, but do use distriution default (and ignore any errors with module loading) until you are absolutely sure that the kernel is built right.

Bruce Hill 03-16-2008 10:15 AM

To clarify what raskin said, if you use the same kernel version,
then you will have to append a local version to the kernel. Look
in /lib/modules/ and you will see something like:
Code:

mingdao@silas:~$ ls -l /lib/modules/
total 16
drwxr-xr-x 3 root root 4096 2008-02-11 08:02 2.6.23.15/
drwxr-xr-x 3 root root 4096 2008-03-15 18:43 2.6.23.15-smp/
drwxr-xr-x 3 root root 4096 2008-03-15 17:11 2.6.24.2/
drwxr-xr-x 3 root root 4096 2008-03-15 19:18 2.6.24.3/

Those are different kernels that have their own set of modules.
Since there are two 2.6.23.15 kernel versions, you see one of
then has a local version of -smp appended to it.

I'd recommend getting the latest stable kernel source from kernel.org
and either building it yourself, or starting with the .config file
from your present working kernel as stated above. Also build your new
kernel under your users /home/<username> directory.

If you rebuilt the kernel that your OS came with, and did not append
a local version string, you have written over the modules and now you
will need to fix that.

botzkoz 03-16-2008 10:45 AM

Ok, but how to add local version to the kernel - just to copy original one i new directory with name something like "linux-2.6.21.5_local", or I can add some additional parameter to make bzImage?

10x for your answers :).

botzkoz 03-16-2008 11:47 AM

Ok, I think I found it :) (General setup->Local version)

Bruce Hill 03-16-2008 07:26 PM

Yes, go to the "Local version - append to kernel release (LOCALVERSION)" and press enter,
then it will allow you to type the name you want to append to your local version. You need
not enter a - or _ as the kernel will put the - there for you.


All times are GMT -5. The time now is 08:44 PM.