LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-21-2003, 11:26 AM   #1
liguorir
Member
 
Registered: May 2003
Posts: 256

Rep: Reputation: 30
Building the linux kernel on redhat.


I've looked all over the net, and I haven't been able to find a clear consise set of procedures to build the linux kernel on a redhat system.

Could someone please clearly and consisely, bullet out the steps, including procedures for lilo and grub. Thanks.


Note: I'm looking for something like this...

1) Type: 'cd /usr/src/linux' // This brings you to the linux directory
2) Type" 'make menuconfig' // This does so..and...so

Thanks,

Robert Liguori
 
Old 06-21-2003, 11:54 AM   #2
zmedico
Member
 
Registered: Feb 2002
Location: Mission Viejo, California, USA
Distribution: Gentoo
Posts: 707

Rep: Reputation: 30
There are some instructions for compiling the kernel in /usr/src/linux/README. Usually it's something like this:

Code:
su
cd /usr/src/linux
make xconfig
# edit Makefile (you can add a version number)
make dep
make bzImage
make modules
make modules_install
# copy your kernel (/usr/src/linux/arch/1386/boot/bzImage) and set up boot loader

Last edited by zmedico; 06-21-2003 at 11:56 AM.
 
Old 06-21-2003, 11:55 AM   #3
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
You didn't mention which release no. of
Red Hat, so I can't give you a direct link. Visit the RedHat Linux Manuals, and for your release, check the customization guide under "upgrading the kernel".

# Compiling/installing kernel modules
You will need to have installed:
1. The developmental packages (compiler)
2. The kernel source code that matches your running kernel
3. The module source or install code

Check out your system and see what's under the hood and see if you installed the stuff you need to do the job. Open an x terminal and type in this sequence of commands to see what kernel we are running and see if you have the kernel source installed:
Code:
[phil@uilleann phil]$ su -
Password: 
[root@uilleann root]# uname -r
2.4.18-3
I am running kernel version 2.4.18-3. Do I have the proper source code?
Code:
[root@uilleann root]# cd /usr/src
[root@uilleann src]# ls -alc
total 3
drwxr-xr-x    4 root     root          136 Jun 12 14:53 .
drwxr-xr-x   16 root     root          424 Jun  4 12:04 ..
lrwxrwxrwx    1 root     root           14 Jun  4 12:11 linux-2.4 -> linux-2.4.18-3
drwxr-xr-x   16 root     root          584 Jun  4 12:11 linux-2.4.18-3
drwxr-xr-x    7 root     root          168 Jun  4 12:08 redhat
[root@uilleann src]#
I do have the same kernel version source code installed in the directory /usr/src/linux-2.4.18-3 and there is a symbolic link named linux-2.4 pointing to it.

If you don't see something similiar to this (but in color), you will need to install the kernel source.

NOTE: I noticed that Red Hat didn't make the symbolic link /usr/src/linux that all of the INSTALL files that I have read mentioned that I need, so I may as well make one now to save editing the files in the source code to install.So, I'll make it just now:
Code:
[root@uilleann src]# ln -s linux-2.4.18-3 linux         
[root@uilleann src]# ls -alc
total 3
drwxr-xr-x    4 root     root          160 Jun 12 15:46 .
drwxr-xr-x   16 root     root          424 Jun  4 12:04 ..
lrwxrwxrwx    1 root     root           14 Jun 12 15:46 linux -> linux-2.4.18-3
lrwxrwxrwx    1 root     root           14 Jun  4 12:11 linux-2.4 -> linux-2.4.18-3
drwxr-xr-x   16 root     root          584 Jun  4 12:11 linux-2.4.18-3
drwxr-xr-x    7 root     root          168 Jun  4 12:08 redhat
[root@uilleann src]#
Ah, there it is, so that's done.

Next, did I install the compiler?
Code:
[root@uilleann src]# gcc -v          
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
[root@uilleann src]#
Yes, I have a compiler installed.

If you don't have those two things installed, you have to install them first off your install CD.

If they are installed, download the source and happy comiling. Make sure you carefully read the README and INSTALL files after extracting and before compiling/installing.

# Guides to software and installation and uninstallation
LNAG - How do I install a program I downloaded from the Internet?
Rute Guide's software explanation
You might want to check out CheckInstall to manage source code installations/uninstallation

# Redhat links
RedHat Linux Manuals
Get your mp3 support here
Maximum RPM
rpmfind
Easier software management: apt4rpm - Red Carpet
RedHat 8.0 Tips & Tricks

# Redhat 7.3 down configuration commands
setup leads to several configuration tools

# Redhat 7.3 up configuration commands
Configure soundcard:
redhat-config-soundcard
Configure X server:
redhat-config-xfree86
Configure network:
redhat-config-network
 
Old 06-21-2003, 12:48 PM   #4
liguorir
Member
 
Registered: May 2003
Posts: 256

Original Poster
Rep: Reputation: 30
bzImage - boot loader

Where do I copy the image to and how do i set up the boot loader?

Thanks,

Robert Liguori
 
Old 06-21-2003, 12:58 PM   #5
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
You haven't given enough info for us to answer, no release, we have no idea of what bootloader you chose

How to ask questions about Linux

You didn't mention which release no. of Red Hat you chose, so I can't give you a direct link. Visit the RedHat Linux Manuals, and for your release, check the Customization Guide under "Upgrading the Kernel" and "Building a Custom Kernel".
 
Old 06-21-2003, 01:03 PM   #6
JayCnrs
Member
 
Registered: Mar 2003
Location: Winnipeg
Distribution: Suse 9.3 Pro
Posts: 404

Rep: Reputation: 30
I went through the steps to re-compile a RH 9 kernel in the link to the following other topic in the Laptop forum to compile the kernel to include ACPI, if you are on a desktop you can ignore the ACPI patch but the other steps will work when re-compiling a kernel, enjoy

Compiling ACPI in to RH9 kernel for a laptop

Hope this sheds some light on the compilation steps, and using RH anyway when you do the make install it puts the images in the /boot directory and adds the line to Grub and I believe Lilo
 
Old 06-21-2003, 02:26 PM   #7
zmedico
Member
 
Registered: Feb 2002
Location: Mission Viejo, California, USA
Distribution: Gentoo
Posts: 707

Rep: Reputation: 30
Re: bzImage - boot loader

Quote:
Originally posted by liguorir
Where do I copy the image to and how do i set up the boot loader?
On Redhat systems the kernel is usually kept in /boot. Maybe "make install" will do this last step for you, but you should be familiar with your boot loader in case something goes wrong. Most people use grub or lilo(older).

Last edited by zmedico; 06-21-2003 at 10:47 PM.
 
Old 06-21-2003, 03:40 PM   #8
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
Maybe "make install" will do this last step for you,
If you experimenting I would advise against using make install, as it will possibly overwrite your present kernel and system.map. If your new kernel does not work, or has other problems you're system may be rendered broken or completely screwed...

Rather, after doing make bzImage, or make modules_install, if you use a modular kernel, cp the new kernel to your /boot directory and give it a unique name. It will be in $linux_source/arch/i386/boot, where $linux_source is the top-level of your kernel source.

Then edit your bootloader .conf file to allow you to boot either, and test it. If it doesn't work you still have your old kernel, and you can try again.
 
Old 06-21-2003, 05:09 PM   #9
JayCnrs
Member
 
Registered: Mar 2003
Location: Winnipeg
Distribution: Suse 9.3 Pro
Posts: 404

Rep: Reputation: 30
I have compiled 2 different kernels for my RH 9 distro and have used make install each time, as long as before you run the make dep you edit your Makefile in /usr/src/linux-2.4.20-X-X, to include something different on the ExtraVersion line in the Makefile, which is where I usually put the date that I compiled the kernel on, this way it creates a different image file, where as if you don't add this in the Makefile it will overwrite your current kernel image it boots as was noted above by bulliver. I am still able to run the standard pre-compiled kernel by RH, also the first kernel I compiled and my newest kernel with the ACPI patch applied. Once you are sure you won't need your old kernel image you can go into the /boot directory and delete the old images otherwise your /boot directory will become full.

Once again this is for RH 9 & 8, I don't know about the other Linux distros.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Building multi-kernel compatible (Linux RHAS) apps ? cbrockwell Linux - Newbie 0 02-25-2005 12:52 PM
building a profiler for linux kernel scheduler svi_ya Programming 0 09-28-2004 05:23 PM
Building Linux kernel with 2.6 ( kernel ) raees Linux - General 1 03-16-2004 05:44 PM
Building kernel 2.6 test 7 on Fedora (RedHat) probs Jefklak Linux - Software 1 10-20-2003 05:55 PM
Building new kernel in /usr/src/linux is WRONG? jisse Linux - Software 3 09-14-2003 05:57 AM


All times are GMT -5. The time now is 08:50 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration