PDA

View Full Version : Quick questions bout building a kernel



Paprika
16th May 2007, 11:04 PM
I need to change something in one of the kernel source files and then recompile the kernel in order to fix a problem I am having with my vmware vps server.

I went to follow this guide HERE (http://forums.fedoraforum.org/showthread.php?t=29434). I got the various directories (build, sources, specs, etc..) but how can I change something in the source code and then build it? Or can I not do that in the case of an SPRM?

I need to change the timer interrupt rate in param.h

Thnx for you time and help!

Nefarious
17th May 2007, 12:56 AM
So long as the source is all there, and the Makefile is there, you should be able to recompile the Kernel.

Did you have any problems recompiling? Or are you just unsure?

Paprika
17th May 2007, 01:36 AM
how can I change something in the source code and then build it? Or can I not do that in the case of an SPRM?

If I can change to source code then where exactly is the includes folder and such? where are the source files?

Nefarious
17th May 2007, 02:03 AM
Right.. sorry. I must've read it wrong.

The source code should be located at '/usr/src/kernels/kernel-version/'. Just look around in there, and you should find all the Kernel related source and stuff.

Paprika
19th May 2007, 05:00 AM
See thats the problem...

root@server[/usr/src]# dir
./ ../ redhat/


So I'm not really sure what to do. I downloaded the kernel srpm, and installed it but no krn src code anywhere that I can see.. ill run a find

markkuk
19th May 2007, 10:08 AM
You're not supposed to be root while building the kernel (or other RPMs). If you are actually following the guide from the first post (or the Release Notes) the source will be in the ~/rpmbuild directory of your normal user account.

sideways
19th May 2007, 11:02 AM
If you installed the source as root using rpm -ihv, then it will be in /usr/src/redhat/SOURCES and they'll be a spec file in /usr/src/redhat/SPECS.

You need to build the source tree in /usr/src/redhat/BUILD/ by typing

rpmbuild -bp /usr/src/redhat/SPECS.kernel-2.6.spec

Then cd /usr/src/redhat/BUILD /kernel-<version>/linux-<version>, edit the appropriate source file, and do the usual make menuconfig (ensure kernel debugging is disabled in kernel hacking section), make, make modules_install, make install

Note that if you want to make an rpm, I wouldn't use that method, you'd need to carefully modify the specfile and do some fiddly stuff with the config file or you'll get a huge modules directory and xen, pae and debug kernels and the compile will take many hours.

Paprika
9th June 2007, 06:33 PM
If you installed the source as root using rpm -ihv, then it will be in /usr/src/redhat/SOURCES and they'll be a spec file in /usr/src/redhat/SPECS.

You need to build the source tree in /usr/src/redhat/BUILD/ by typing

rpmbuild -bp /usr/src/redhat/SPECS.kernel-2.6.spec

Then cd /usr/src/redhat/BUILD /kernel-<version>/linux-<version>, edit the appropriate source file, and do the usual make menuconfig (ensure kernel debugging is disabled in kernel hacking section), make, make modules_install, make install

Note that if you want to make an rpm, I wouldn't use that method, you'd need to carefully modify the specfile and do some fiddly stuff with the config file or you'll get a huge modules directory and xen, pae and debug kernels and the compile will take many hours.
I actually tried this method anyway last night, and you were right. The compile took a good while and I fell asleep, and woke up to my surpirse to find it had to stop the compile becuase there was no more free space left....


So I'm wondering if I can upgrade my FC5 installation to FC6, build the kernel locally, then move it to my server. But then again that would require me to attempt another RPM build, and we could possibly have the same exact thing happen again that happened last night on the other machine.

...That or do a regular build, compile and install instead of trying to make an RPM. I really DON'T need an RPM it just seemed like it would be easier to install and uninstall..