I am new to rebuilding the kernel and kernel modules and such, so I apologize if this is a poor question.

I am running Centos 6.8 , I am trying learn about device drivers and such, and my reference text starts with rebuilding the kernel. It's instructions seem kinda dated, so I've also been googling.

I rebuilt the kernel, with a minor change to main.c I then moved the resulting bzImage into the boot directory:

cp arch/x86/boot/bzImage /boot/vmlinuz-2.6.32-custom.el6.x86_64

I then added an entry to etc/grub.conf, that is identical to the one already there, but with the different kernel name.

I then reboot, and on reboot, I get a kernel panic, which indicates that it can't find modules.dep in /lib/modules/2.6.32

But everything I've read indicates that the modules should be located at /lib/modules/2.6.32-custom.el6.x86_64,

So to try that, I softlinked /lib/modules/2.6.32-642.el6.x86_64 to /lib/modules/2.6.32-custom.el6.x86_64:

ln -s /lib/modules/2.6.32-642.el6.x86_64 /lib/modules/2.6.32-642.el6.x86_64 

but as expected it didn't fix the error, because it (the kernel?) is looking in /lib/modules/2.6.32/ instead of /lib/modules/2.6.32-custom.el6_x86_64

My question is, where SHOULD the kernel be looking for modules and/or how do I change it, and/or what is driving it to look where it is looking?

1 Answer 1


It gets the version from the Makefile in the root of the kernel source tree, by concatenating VERSION and EXTRAVERSION together (this is a standard part of the kernel build). That becomes the subdirectory name used for finding modules. Red Hat kernel RPMs are built using the rpmbuild program, which puts the correct EXTRAVERSION into that file during the build process. You may want to build your custom kernel that way. Otherwise you'll have to edit the Makefile yourself and apply all the patches manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .