Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 432
  • Last Modified:

2 red hat 7.1 compiling kernel source questions.

 I am using red hat 7.1 and for some kind reason I have to recompile the kernel source. the original kernel version is 2.4.2-2. but after I finish the compile and put the bzImage in the another linux PC's /boot directory(redhat 7.1 too) then add a entry in the lilo.conf and excute lilo and reboot that new linux PC system with this new kernel. I found the kernel version become 2.4.2.  It is not 2.4.2-2 now.

question 1:
why it will be this way? why it won't be 2.4.2-2?

question 2:
I also did another test. I get the kernel source from redhat 7.1 CD3. and put it in my  directory say "/usr/src" and use rpm to install it. it will put the source into /usr/src/redhat/SOURCES. there is a tar file looks like the source tar ball and also many patch files for kernel. I use tar -xzvf to uncompress and extract it. and a linux source tree generated. I move this tree under the /usr/src/.
So now under /usr/src/linux already got a new source tree.
then I get in there excute
make menuconfig
make dep
make clean
make bzImage

make modules
make modules_install
then move the bzImage to /boot. modify and add a entry in /etc/lilo.conf. excute lilo
then I reboot system. I found the new kernel which I just compiled version is 2.4.2 too. it is not original 2.4.2-2.
I doubt that is becoz I didn't run all those kernel patch files so it won't become the latest version 2.4.2-2?
is that correct? if so then how to run all that patch files?
  • 4
  • 4
  • 3
  • +1
1 Solution
I don't know much about Red Hat, but I have heard before that the Linux source tree that comes with it is not the source that was used to build the kernel that comes with it.  Not without extra work on your part, anyway.

I assume your authority for what version of the kernel you have is the "uname" program.

You can quickly tell for what kernel version your source tree is by looking at the first few lines of the file "Makefile" in the top Linux source directory.  There are variables there that set the "2.4.2" or "2.4.2-2" or whatever.  If you don't see what you want, don't waste your time compiling the kernel!

Maybe you don't really want 2.4.2-2, though.  As long as you're rebuilding, maybe something like 2.4.8 would work as well or better (get various Linux kernels from  
1. there are two different packages my friends.
one is kernel-source.i???.rpm and then there is kernel2.4???.src.rpm
if you install the kernel-source one, you don't need to do anything elese, if you install the other one, little should be done.  All *.src.rpm packages will install but not patch until you run "rpm -bp *.spec" under /usr/src/redhat/SPEC directory.  that will take the tar ball, and patch it with all the patches and create your directory under /usr/src/redhat/BUILD.
all you need it the kernel-source-2.4.???.rpm.
then build.
Your build procedure is okay except your should "make mrproper" first before menuconfig.
1.1.  to make an image for another box, check with the INSTALL document.
1.2.  you just can't copy the  bzImage to another pc, there are modules that are loaded for that specific kernel, usually under /lib/modules
2. you can make your kernel say whatever you want. My advice is to rename it until you fully test it.
edit the Makefile and you will see EXTRAEXTENTION, add your name to it, 43for simple any letters.
so if you kernel is 2.4.2 and you add NtSkW you image will be 2.2.4NtSkW and so your modules directory under /lib/module

netskywalkerAuthor Commented:
to bryanh:
I didn't see the verion inside the Makefile.
but I did see the 2.4.2-2 under the /usr/src/linux-2.4.2/version.h

to garboua:
I did as you told me. and I got the kernel-source.i???.rpm
from souce CD. and run the rpm patch program as you told me. everything work fine but the final version is 2.4.2-ac3. I also see the "2.4.2-ac3" appear in the version.h under the /usr/src/linux-new/ directory.

can I just change it to the version number in version.h as
I want and compile it again?
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

in /usr/src/linux-2.4.2, edit the EXTRAVERSION line in the Makefile.  The beginning of the Makefile look like this:


Change the EXTRAVERSION line to something like this (don't add any spaces):
Then your version would be 2.4.2-2-mine

After reboot you can do a "uname -r" which will show you the name of your kernel.

Hope this helps!
Are you sure that's what you want to do?  Changing EXTRAVERSION doesn't change the version of the kernel - it changes the name of the version.  You can make 'uname' say 2.4.2-2, but it will still be 2.4.2-ac3.

But again, it isn't clear that you need 2.4.2-2.  2.4.2-ac3 may be just fine.
I think you got kernel-2.4.2.src.rpm and not kernel-source.

the kernel source should not be in the source CD rom.
this version should be fine and as diamond 1 said by changing the extraversion u could fix that.  
I sugges you look for kernel-source, it should end with .i386.rpm
the kernel with ac is a result of a patch by I think "alan cole" to fix the large file system issue.  

you can go and Download the latest kernel for the REDHAT release (Roswell) which is 2.4.7-2
netskywalkerAuthor Commented:
to garboua:
  sorry for my mistake! you are right what I really got the kernel-2.4.1.src.rpm.
  I will get the  kernel-source.i???.rpm from the ftp site later.
  but I still feel strange why the souce CD can not compile a kernel binary eaual to the binary kernel ship with CD? I prefer to use the source come with CD just because I will feel more safe. do you know that the 2.4.2-2-ac3 version and 2.4.2-2 version really make any difference?
If I just change EXTRAVERSION=-ac3 to "EXTRAVERSION=-2" then will it be working like the original runing kernel without any problem?
Are you sure that's what you want to do?  Changing EXTRAVERSION doesn't change the version of the kernel - it changes the name of the version.  You can make 'uname' say 2.4.2-2, but it will still be 2.4.2-ac3.

But again, it isn't clear that you need 2.4.2-2.  2.4.2-ac3 may be just fine.
if you want you can use the rpm command "rpm --rebuild kernel-2.4.1.src.rpm" and that will actually unpack the package, patch it and build it.  it will put the product under /usr/src/redhat/RPMS/i386
the other package IS available @ your CD 1 .
netskywalkerAuthor Commented:
to:bryanh and arboua
you both give me some useful help. but I just can give one person the point. if I can decide I will give bryanh 35% and arboua 65%.because arboua give me more detail informatio. but I can not separate that points..
so I will give 200 whole points to arboua. is that ok?
Sounds fair to me.
sorry it took me a while getting back to the net, we had to move and restore all our system after what happend in NYC.
thank U netskywalker and for next time, if you desire to split point, create two new questions and point the people to them, and delete current one.  
As I said, sorry I could not be on to suggest this @ that time.  
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now