Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

2 red hat 7.1 compiling kernel source questions.

Posted on 2001-08-27
12
405 Views
Last Modified: 2010-04-21
 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?
thanks!
 
0
Comment
Question by:netskywalker
  • 4
  • 4
  • 3
  • +1
12 Comments
 
LVL 5

Expert Comment

by:bryanh
ID: 6449208
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 kernel.org).  
0
 
LVL 5

Expert Comment

by:garboua
ID: 6450595
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.
SO
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

0
 

Author Comment

by:netskywalker
ID: 6459414
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?
 
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Expert Comment

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

VERSION= 2
PATCHLEVEL= 4
SUBLEVEL= 2
EXTRAVERSION= -2

Change the EXTRAVERSION line to something like this (don't add any spaces):
EXTRAVERSION= -2-mine
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!
0
 
LVL 5

Expert Comment

by:bryanh
ID: 6460906
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.
0
 
LVL 5

Expert Comment

by:garboua
ID: 6461253
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
ciao
0
 

Author Comment

by:netskywalker
ID: 6462285
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?
0
 
LVL 5

Expert Comment

by:bryanh
ID: 6462762
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.
0
 
LVL 5

Accepted Solution

by:
garboua earned 200 total points
ID: 6464029
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 .
0
 

Author Comment

by:netskywalker
ID: 6471746
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?
0
 
LVL 5

Expert Comment

by:bryanh
ID: 6472959
Sounds fair to me.
0
 
LVL 5

Expert Comment

by:garboua
ID: 6488045
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.  
CIAO
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question