LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-20-2007, 06:02 AM   #1
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Rep: Reputation: 32
Recompiling the kernel....


Hi all
i recently installed FC4 in my PC but i didnt had source.. so i downloaded the corresponding ".src.rpm" and installed that bu using rpm -Uvh kernel-<version> then i wanted to recompile my kernel so i did rpmbuild -ba --target i686 kernel version.spec in the "/usr/src/redhat/SPECS" but it is taking around 46 mins and showing 1000's of warnings and atlast many errors came so how to recompile my kernel....googled it but it is a different procedure in different sites,... so please help me to recompile the kernel... i am using FC4 and my kernel version is "2.6.11-1.1369_FC4-i686" so i have downloaded "kernel-2.6.11-1.1369_FC4.src.rpm" which is a 42 MB file.......
thanks...

Last edited by culin; 02-20-2007 at 06:03 AM.
 
Old 02-20-2007, 04:59 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
You need to install the kernel-devel-*****.rpm. The **** is the version of current running kernel.

I have to look into one of those src.rpm to see what is in the kernel to see what you may have done.

Brian
 
Old 02-20-2007, 11:06 PM   #3
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
thanks for reply brian1...
oh... then installing the .src.rpm and recompiling the kernel wont get the source ??? or along with .src.rpm i have to install kernel-devel**** ???
Quote:
I have to look into one of those src.rpm to see what is in the kernel to see what you may have done.
I didnt get sorry...

Last edited by culin; 02-20-2007 at 11:25 PM.
 
Old 02-21-2007, 05:42 PM   #4
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
I downloaded one of the kernel.src.rpm and looked at it. It is a bunch of patches used to build the kernel and modules based on different architectures. It does not appear to provide any true kernel source.

Brian
 
Old 02-22-2007, 12:34 AM   #5
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
oh.. fine brian1.. if it is for building modules , then atleast that should build modules and binaries know ?? for me that is also not working..."rpmbuild -ba --target i686 kernel version.spec" is giving 1000's of warnings and taking 50 mins and finally giving some errors.... what to do for this ???
thanks....
 
Old 02-22-2007, 06:58 PM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Are you still working with the kernel-src.rpm?

I am starting to see how that src.rpm is working but is way beyound me as to the full extent of the build.

I did what you did. Downloaded the kernel-src.rpm
Installed to my rpmbuild directory. /usr/src/redhat for most users.
Then went into the SPEC directory and ran the command ' rpmbuild -ba --target i686 kernel-2.6.spec '
This took like forever about 2hours on my notebook. Should have done it on the quad processor desktop.

Anyways I did see the many warnings and some errors you mentioned. Not sure what most of them meant. A few are just flags that don't mean anything. But once done I had several rpms created like these from this one I used to play with file:///home/crusher58/rpmbuild/SRPMS/kernel-2.6.9-42.EL.src.rpm.

It created the following rpms that are nearly the same size as the one from the download site.
kernel-2.6.9-42.EL.i686.rpm
kernel-debuginfo-2.6.9-42.EL.i686.rpm
kernel-devel-2.6.9-42.EL.i686.rpm
kernel-hugemem-2.6.9-42.EL.i686.rpm
kernel-hugemem-devel-2.6.9-42.EL.i686.rpm
kernel-smp-2.6.9-42.EL.i686.rpm
kernel-smp-devel-2.6.9-42.EL.i686.rpm

Needless to say I ended up with the kernel-devel file that I could have just downloaded and would have had the kernel source from.

So yes you can rpmbuild the kernel.src.rpm and end up with the kernel source from the kernel-devel rpm file. So it can be done but is a waste of time. You end up downloading a 45meg file. Spend 2 hours building the rpms. Where one can download a 4meg kernel-devel rpm and install that and be done with it.

Brian

Last edited by Brian1; 02-22-2007 at 06:59 PM.
 
Old 02-22-2007, 11:21 PM   #7
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
woooow....... thanks a lot Brian1 great info....
i will download the kernel-devel and install that.... but i wonder why it is giving error in building source rpm ???? and i didnt create any rpm's for me what u have mentioned above.. where to search for these rpm's that is created ??? and i think u will get another option at the boot up after doing this rpmbuild right ??? or that will come only when we make menuconfig and make bzImage , make modules_install and make install ???
thanks again....
 
Old 02-23-2007, 03:24 PM   #8
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
When you normally install a src.rpm file it places the extracted contents in /usr/src/redhat/SOURCE and SPEC. Run the command using the spec file in the SPEC Directory. If all goes well the building will be in /usr/src/redhat/BUILD. It is the place recompiling takes place. Once done depending on the options of the rpmbuild command -bb will place the built rpms in /usr/src/redhat/RPMS/i386 or i686 or athlon or noarch or any others depending onthe build. With -ba it builds the rpms and also a src.rpm in /usr/src/redaht/SPRMS. Kind of not needed unless you apply addtional patches to the source in the spec file.

As to the errors it is hard to say. Post say the last 10 command batch lines where it quit at might help. But it will more than likely be over my head. Some things it can be is depending how the install choices you did when installing the distro is maybe the gcc compiler is not installed or any other slew of other things needed to build with.

Another thought is the entire process in /usr/src/redhat needs to be done as root.

Now Using the kernel-devel.rpm file it will place them in /usr/src/linux-*****.

Next some of the commands you mention are for old 2.4 kernels. This is the standard sequence of 2.6 kernels.
First there are a few different menu config editors for the kernel. All depends on what is installed with.
make menuconfig :A generic config ediotr.
make xconfig :A gui type config ediotr.
make gconfig :Another gui type config editor.

Now you can use the config-***** file any version from your /boot to get a baseline that was used to build previous running kernel.

Ok once you have the kernel config with what you need then you run theis command ' make '. This builds the kernel image and also the modules all in one command. No longer need to do in in two steps like in 2.4 kernels using ' make bzImage ' and ' make modules '.

Now run ' make modules_install ' which will place them in /lib/modules/<kernel-version>.

Now run the command ' make install '. This will copy the kernel image to /boot. Also it places the system.map file in /boot which is used for the kernel to locate modules it is aware of. So when you build say madwifi and install it it runs the command ' depmod ' which will add the newly created modules to the system.map file. Also creates a initrd file in /boot. And finally it places a boot line for the new kernel in grub at /boot/grub/grub.conf.

Thats all there is to it.
Brian
 
Old 02-26-2007, 03:17 AM   #9
culin
Member
 
Registered: Sep 2006
Distribution: Fedora Core 10
Posts: 254

Original Poster
Rep: Reputation: 32
Quote:
Next some of the commands you mention are for old 2.4 kernels. This is the standard sequence of 2.6 kernels.
First there are a few different menu config editors for the kernel. All depends on what is installed with.
make menuconfig :A generic config ediotr.
make xconfig :A gui type config ediotr.
make gconfig :Another gui type config editor.

Now you can use the config-***** file any version from your /boot to get a baseline that was used to build previous running kernel.

Ok once you have the kernel config with what you need then you run theis command ' make '. This builds the kernel image and also the modules all in one command. No longer need to do in in two steps like in 2.4 kernels using ' make bzImage ' and ' make modules '.

Now run ' make modules_install ' which will place them in /lib/modules/<kernel-version>.

Now run the command ' make install '. This will copy the kernel image to /boot. Also it places the system.map file in /boot which is used for the kernel to locate modules it is aware of. So when you build say madwifi and install it it runs the command ' depmod ' which will add the newly created modules to the system.map file. Also creates a initrd file in /boot. And finally it places a boot line for the new kernel in grub at /boot/grub/grub.conf.
really suuuperb info.... can i know how u got all these info is it by experience ?? or by some books ?? .... i need to travel a very very long distance then.....
thanks for your support Brian1...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Increasing Kernel stack size to 8k without recompiling the Kernel deathman Linux - Software 2 04-08-2006 04:39 AM
recompiling kernel DaveyB Linux - Newbie 3 08-10-2004 09:45 AM
can i compile just one kernel module whithout recompiling the whole kernel? edman007 Linux - Software 3 02-17-2004 03:05 PM
Recompiling Kernel brokenflea Slackware 3 12-11-2003 07:43 PM
Recompiling the kernel AMDPwred Linux - Software 3 06-21-2003 06:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration