LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 01-29-2005, 06:35 AM   #391
joirnange
Member
 
Registered: Dec 2004
Distribution: Fedora
Posts: 88

Rep: Reputation: 15

or...is it better (easy) to use the latest kernel 2.4.29 by using Rehhat 9??? i think i could avoid those 2.6 trouble if using 2.4 kernel.

Actually i just want a fresh kernel to do my layer 7 filtering..
 
Old 01-29-2005, 12:03 PM   #392
Thetargos
Senior Member
 
Registered: Mar 2003
Location: Mexico City
Distribution: Fedora, Ubuntu & Mint
Posts: 1,679

Original Poster
Rep: Reputation: 45
Absolutely!! It's better for a RH 9 system to use a 2.4 based kernel rather than a 2.6 based one... In RH 9 I've successfully ran up to kernel 2.4.26 (that was the last kernel I tried on a RH 9 system, NOT that any other kernel above that would not run, mind you), plus the advantage of the many features back ported from 2.6 kernels (especially when compared to the stock default 2.4.20 kernel found in RH8-9 systems).
 
Old 03-03-2005, 10:57 AM   #393
luqman
Member
 
Registered: Feb 2005
Posts: 43

Rep: Reputation: 15
i have successfully installed the new kernel-2.4.25 on my redhat 9.0 (shrike). It boots correctly and i am able to ssh in to my box.

Now the problem is that when i do

#uname -r
2.4.25

that ok.

but if i do

#rpm -qa | grep kernel
kernel-pcmcia-cs-3.1.31-13
kernel-2.4.20-8

It doesn't even mention my new kernel

i have done all this to get the kernel-source package installed but :

#rpm -qa kernel-source
package kernel-source not installed

the steps for the compilation and the installtio were:

======================================================================
======================================================================
Linux Kernel Compilation

Steps in compiling a kernel:

* Installing the sources.
* Configuring the kernel (choosing which features and Drivers to compile).
* Compiling the kernel (i.e. typing a single command, and watching...).
* Installing the compiled kernel.
* Updating the boot loader to recognize the new kernel.
* Booting...
* Making the new kernel become the default.

Kernel "Types"

* The Linux kernel comes in two variants - the "vanilla" kernel, and the distribution's kernel.
* The "vanilla" kernel is the kernel officially released by Linus, or by a member of the community appointed by Linus (e.g. kernels version 2.4.X are officially maintained and released by Marcelo Tosatti).
* The distribution's kernel is normally a "vanilla" kernel, with many patches on top of it that either did not get accepted to the "vanilla" kernel, or that the distribution's maker back-ported from newer kernels.
* Thus, normally the latest "vanilla" kernel has more features...
* ... while the distribution's kernel has gone through more orderly testing and could be more stable.

Getting The Source

* The sources of linux kernels are available via the Internet, or on the distribution's CDs.
* Of-course, there are many mirrors, and since we're talking about not-so-small files (around 30MB), we better know our mirrors.
* In Israel, one may try Iglu's mirror, at http://www.iglu.org.il/, or check Hamakor's Israeli mirrors list, at http://mirror.hamakor.org.il/.

The Source Of The Distribution's Kernel

* The source code of the distribution's kernel comes as another package on the installation CDs.
* On RedHat 9, for example, it is stored in a file named 'kernel-source-2.4.20-8.i386.rpm'.
* Installing it is done like installing any other RPM package:

rpm -Uvh /path/to/kernel-source-2.4.20-8.i386.rpm


* If The distribution's maker updated the kernel, the new kernel sources would be found among the updates.
* In RedHat 9, the current file is kernel-2.4.20-28.9.src.rpm, found in the SRPMs (Source-RPMs) directory.

The Source Of The Vanilla Kernel

* The "vanilla" kernel is normally kept at ftp.kernel.org, as a tar.gz (or tar.bz2 - better compressed) file.
* For example, the latest 2.4 kernel for now is found at ftp://ftp.kernel.org/pub/linux/kern...-2.4.24.tar.bz2
* Unpack these kernel sources as root:

cd /usr/src/
tar xjf /path/to/linux-2.4.24.tar.bz2


* You will get a new directory named 'linux-2.4.24', containing the sources.

"Readying" The Sources

* Before we do anything with the sources, we should make sure the source tree does not contain any old object files or configuration information...
* ... That got there accidentally.
* This is especially true for distribution kernels - they tend to contain various stale files.
* To do this, go into the source directory and run the command:

make mrproper

Configuring The Kernel

* Before we compile the kernel, we need to configure it.
* This includes telling it which drivers and features to compile ...
* ... and how to compile them (as modules or inside the kernel's main file).
* Several configuration programs are supported by the kernel, to be launched using one of the following commands:

make config
A simple text-mode program, that asks a zillion questions one after the other. Not recommended.
make menuconfig
A full-screen text-mode program. Use it if you don't have X windows running, or if you're connected from a remote location.
make xconfig
A Graphical program. Use this one when you can.

* There is yet another, which will be shown later...

Tips Regarding Configuring The Kernel

* Each item has a help section - read it.
* Each help text contains a suggestion of what to do if you're not sure. Use these suggestions, indeed.
* The first time around, take a tour around the different options, without changing them.
* The configuration process generates a file called ".config" in the top directory of the kernel sources. Keep a backup before making changes.
* Don't configure a kernel when you don't have enough free time - it's a long task (1-2 hours) the first time around.
* Do not despair - eventually, you'll configure kernels in 5 minutes

Compiling The Kernel

* Once configured, Compiling the kernel is easy.
* First, make sure we start afresh (takes a few seconds):

make clean

* Then, prepare the dependencies list (might take a minute):

make depend

Compiling The Kernel (Cont.)

* Then, compile the kernel's main part (might take 5-30 minutes):

make bzImage

After this step, we should have the following new file:

[root@simey linux]# ls -l arch/i386/boot/bzImage
-rw-r--r-- 1 root root 1064017 Jan 16 01:53 arch/i386/boot/bzImage


* Then, compile the kernel modules (might take 5-30 minutes):

make modules

Compilation Errors

* A normal compilation process might result several warnings.
* But errors should not happen, unless you're compiling a non-stable kernel.
* Make sure you started from a fresh compilation (i.e. ran 'make clean').
* Make sure that you have read/write access to the source tree (i.e. if the sources belong to 'root', compile them as user 'root').

Installing The New Kernel

* Installing the kernel is split into two parts:
1. First, installing the kernel itself.
2. Then, installing the kernel modules.
* Before we install the kernel, we want to make sure we do not overrun our current kernel, or a previously existing kernel.
* So we will install the kernel itself manually.
* Avoiding overrunning the kernel modules is more difficult, since the location of the modules is hard-coded into the kernel (its version number) and the module loading tools.

Installing The Kernel's Main File

* Runnable kernels are expected to be in the /boot directory.
* Simple way to install the kernel (assuming it is version 2.4.20-8):

cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.20-8

* Make sure the name is unique, and especially different then the current kernel...
* ... cause if we got a broken kernel, we will want to be able to switch back to the current kernel.

Installing The Kernel Modules

* The kernel modules will normally be placed in /lib/modules/<version>
* If the compiled kernel is of the same version as an existing kernel, we better first back-up the modules library:

cp -rp /lib/modules/2.4.20-8 /lib/modules/2.4.20-8.old

* This assumes that the older kernel can boot into a working system without working loadable modules...
* ... or that we can boot from a rescue CD/floppy to restore the modules.
* And now install the modules:

make modules_install

The "initrd" (Init Ram-Disk) File

* Sometimes, we need to pack modules that are needed before the kernel can access the disk partitions, into the 'initrd' file.
* To do this, we need to use the 'mkinitrd' command:

mkinitrd /boot/initrd-2.4.20-8.img 2.4.20-8

This creates an initrd file named '/boot/initrd-2.4.20-8.img', containing hard-disk and file-system related modules, for kernel version 2.4.20-8.
* The initrd command uses the modules installed under /lib/modules/, so it must be executed after make modules_install.

Updating The Boot Loader

* Once we installed the new kernel and its new modules, we need to tell the boot loader about it.
* Generally, we need to supply the following information:
o Kernel image file path (e.g. /boot/vmlinuz-2.4.20-8).
o Partition of the root directory - copy it from the spec of the current kernel.
o Kernel parameters - may be copied from the current kernel, if it has not changed drastically.
o Optional initrd file path.
o Label.

Instructions For "lilo"

* If your system uses "lilo" as the boot loader, the config file is normally at /etc/lilo.conf
* A normal entry for our example kernel would look like this:

image = /boot/vmlinuz-2.4.20-8
initrd=/boot/initrd-2.4.20-8.img
label = rh9-mykernel
append="hdc=ide-scsi"
root=/dev/hda1

* the 'root' entry may be omitted, if we have 'root=current' in the global section.
* If we do not need initrd, the initrd entry may be omitted.

Instructions For "lilo" (Cont.)

* Finally, run "lilo" to make the actual update of the boot loader:

[root@simey ~]# lilo
Added linux-2.4.18
Added rh9-mykernel
Added dos

MANY people forget this step!

Instructions For "grub"

* For systems with "grub" as their boot loader, the config file is normally at /boot/grub/grub.conf
* An entry for our example kernel would look like this:

title Red Hat Linux (2.4.20-8)
root (hd0,0)
kernel /boot/vmlinuz-2.4.20-8 ro root=/dev/hda1 hdc=ide-scsi
initrd /boot/initrd-2.4.20-8.img

* The disks and partitions are numbered by bus numbers, rather then by letters: hd0,0 means /dev/hda1.
* If we have /boot on its own partitions, the path names should NOT contain /boot, and the "root" entry should point to the /boot partition.
* No need to run anything after updating the config file - grub will read it during system boot.

Booting The New Kernel

* Once everything is set, reboot your machine.
* At the boot loader's prompt/menu, chose the new kernel.
* Watch the boot messages - are they similar to what you are familiar with? Are there any errors or failures?
* If boot fails - reboot again with the previous (working) kernel.
* If boot succeeds, check that everything works (including networking, sound card, modem...).

Troubleshooting The Boot Process

* The boot process logs all its messages into /var/log/messages
* Possibly also in /var/log/dmesg
* Look in those files for error messages, and try to analyze them or look them up on the Internet.
* Sometimes you'll notice a problem resulting from kernel configuration - reconfigure, recompile from scratch (make clean...), re-install and try again.
* If you see that all modules fail to load with unresolved symbols, make sure you compiled and installed the modules.

Boot Problems - No Root Device

* Symptom: you get the message that no root device was found.
* Reboot to the previous kernel.
* Check the exact syntax of your lilo/grub entry for the new kernel. Are you sure you specified the root device entry properly?
* Make sure you compiled the drivers for your hard-disk and the partitions into the kernel image, or you have them in the initrd image.

Boot Problems - "lilo" says "LI"

* Symptom: you get the message "LI" (or a similar message) and then nothing, or an endless loop of garbage.
* Reboot to the previous kernel.
* Check the syntax of the lilo entry for the kernel - something there is terribly wrong.
* If you can't see what is wrong, delete the entry, and create it again. Often mistakes done in the first copy+paste do not occur in the second attempt.

When Installing A Newer Kernel...

* Check the file 'Documentation/Changes' in the source directory, for packages that might need upgrading before booting the new kernel.
* Don't configure the new kernel from scratch - copy your previous kernel's '.config' file to the new kernel's source directory, and run make oldconfig - you will only need to answer questions about new features.
* If you used a distribution's kernel previously, it normally has a config file matching the installed kernel.
* On RedHat, this file is usually under /boot/config-<version>

External Device Drivers

* Various types of hardware might have drivers available not as part of the kernel sources.
* Perhaps this is a new driver, that didn't yet get accepted into the normal kernel.
* Or the driver is maintained by the manufacturer of the hardware...
* ... and possibly delivered in binary-only mode?
* We need to be able to install such drivers on our own, then.

External Device Drivers Formats

* An external device driver might come with full sources, that we need to compile. This is the best scenario.
* An external device driver might come as a binary-only module. In this case we need to get a driver that was compiled specifically for the kernel version we are using.
* If we use a less-commonly-used distribution, we might not find a driver for our distribution's kernel...
* At which time we either dumb the hardware, or take the best "vanilla" kernel for which there is a binary driver available.
* The driver could come as a hybrid - half source, and half binary. the Source-part need to be compiled against our kernel, and it'll make sure the binary part works.

Notes On External Device Drivers Compilation

* You need to have your kernel source tree configured properly, matching your running kernel.
* You don't have to actually compile the kernel source tree in this case.
* Sometimes the driver has a script that will compile the driver for you, hiding the actual compilation process.
* If it thinks your kernel sources are under /lib/modules/2.4.20-8/build, this is ok - this should be a symbolic link pointing to the right location of the sources....
* ... But it does not hurt to make sure.
* Otherwise, read the driver's installation instructions, and follow them carefully.

Originally written by Valid HTML 4.01!guy keren
======================================================================
======================================================================


Kindest
Muhammad Muzzamil Luqman
 
Old 03-03-2005, 10:59 PM   #394
Thetargos
Senior Member
 
Registered: Mar 2003
Location: Mexico City
Distribution: Fedora, Ubuntu & Mint
Posts: 1,679

Original Poster
Rep: Reputation: 45
Well, the kernel's there, just NOT present in the RPM database, so obviously rpm -qa | grep kernel won't list it... If you wanted it that way, you can compile an rpm kernel using a .spec file from an official .src.rpm as a template for your vanilla kernel

Last edited by Thetargos; 03-03-2005 at 11:05 PM.
 
Old 03-04-2005, 02:41 AM   #395
luqman
Member
 
Registered: Feb 2005
Posts: 43

Rep: Reputation: 15
thankx Thetargos but from where can i get the .src.rpm for the kernel 2.4.24.040218?
I have googled a lot for it but i couldn't find it
 
Old 03-04-2005, 03:14 PM   #396
Thetargos
Senior Member
 
Registered: Mar 2003
Location: Mexico City
Distribution: Fedora, Ubuntu & Mint
Posts: 1,679

Original Poster
Rep: Reputation: 45
The process would be like this:
  • Get a .src.rpm from redhat, not matter actually which kernel .src.rpm you get (as long as it is a 2.4.2* kernel), check http://www.fedoralegacy.org/ for one
    Official kernel.src.rpm for kernel 2.4.20-42.9 for instance
  • Set up your rpmbuild environment (check the man page or google around for a howto on building RPM packages).
  • Install the sources with rpm -ivh kernel-<snip>.src.rpm
  • Check and edit the .spec file according to your needs.
  • Build the kernel, install the kernel with rpm.
This would be an outline of what you need to do to build an rpm kenrel nowadays. I hope this information helps.
 
Old 04-15-2005, 11:27 AM   #397
aw_wolfe
Member
 
Registered: Apr 2005
Posts: 50

Rep: Reputation: 15
module compile errors

Thanks for taking the time and effort to make your post. For us newbies, it is quite useful.

However, I am getting an error when I try to compile the modules and I was hoping that you could point me in the right direction.

Final dump after "make modules" gives me the following....


...
make[2]: *** [dummy.o] Error 1
make[2]: Leaving directory `/usr/src/linux-2.4.20-31.9-ntfs/drivers/net'
make[1]: *** [_modsubdir_net] Error 2
make[1]: Leaving directory `/usr/src/linux-2.4.20-31.9-ntfs/drivers'
make: *** [_mod_drivers] Error 2


Being a newbie, not even sure where to begin to figure this out.

Thanks for any help,

Tony
 
Old 04-15-2005, 07:33 PM   #398
Thetargos
Senior Member
 
Registered: Mar 2003
Location: Mexico City
Distribution: Fedora, Ubuntu & Mint
Posts: 1,679

Original Poster
Rep: Reputation: 45
Well, apparently there is a module that cannot be built (this has happened to me LOTS of times when trying to rebuild Red Hat kernels. It looks as if you were building a dummy driver of some sort, maybe you selected or left at defaults the dummy network driver?? My suggestion for you is to check that.
 
Old 06-10-2005, 12:02 AM   #399
ERBRMN
Member
 
Registered: Mar 2005
Location: Japan
Distribution: TurboLinux, RHEL, SUSE
Posts: 96

Rep: Reputation: 15
Redboot and Kernel build

Redboot and Kernel building

I want to create Linux system which is boot and start linux from compact flash disk (size is 128Mb).
Computer CPU is VIA , i386 compatible.
Short, I want to create embedded linux.

Please help me some advise and experience for REDBOOT and building Kernel.

First I want to set Redboot which is booting, Then I want to build Kernel, X windows ...
I am going to use this system for execute progfram on GUI.
I have creating some execute programm which is use C.


Last edited by ERBRMN; 06-10-2005 at 12:17 AM.
 
Old 07-28-2005, 10:51 AM   #400
blooms
LQ Newbie
 
Registered: Jul 2005
Posts: 2

Rep: Reputation: 0
about kernel compilation again.

Hi, everybody. I read many articles and documents about Kernel compilation and really want to
upgrade my Red Hat 9 linux-2.4.20-8 kernel. However, very strangly, there is nothing
in my /usr/src/ directory. (I installed my RH9 almost using all default.)

I tried to follow the instructions in the pinned topic at here. However,

STEP 1, I have trouble. It always gives me some error message uisng gpg. ( I tried myriad times, and I
just wonder about those magic operations.)

STEP2, I cannot download modutils-2.4.21-23.src.rpm. and using
"rpm -q modutils", I found I have modutils-2.4.22-8 which is higher then 2.4.21-23.

STEP3, using both "./configure --prefix=/" and "./configure", I got error, and I skipped this step.

STEP4, I just skipped this step

STEP5, I am really having trouble with this step. As I said I don't have anything in my /usr/src/
directory. I even cannot run "make xconfigure" and "make menuconfigure", it gives some errors.
I also tried to copy /boot/config-2.4.20-8 to .config, but no use. Finally I have to use
"make oldconfigure" and this gets me lost. Seems there are many new items in version 2.6.12.

I did manage to finish STEP 13, and after reboot and choose 2.6.12, there are some failed items and
I know it's because I didn't configure kernel correctly. And in version 2.6.12, many things go very strangely,
and I cannot even connect to the internet.

Is there any complete manual for configure the lastest kernel version? Thanks in advance for help.
 
Old 07-28-2005, 12:44 PM   #401
Thetargos
Senior Member
 
Registered: Mar 2003
Location: Mexico City
Distribution: Fedora, Ubuntu & Mint
Posts: 1,679

Original Poster
Rep: Reputation: 45
First of all, to upgrade RH9 to a 2.6.x kernel is too much of a trouble to begin with, due to a miriad of thing that need updating/generating. The package modutils basically its importance is that it now also recognizes modprobe.conf as the modules' confiugration file (instead of the deprecated modules.conf). You can run a command to generate this file, and if you see another 2.4.2x based distro (like Fedora 1) you'll notice this one comes with a modprobe.conf file that includes another one which contains the information of a lot more of other devices to be 2.6.x compatible.

Your best chance with RH9 is to upgrade to a 2.4.x based kenrel, instead of a 2.6.x kernel, for a newer 2.6.x kernel, you should use a newer distribution like Fedora (any of them, actually) which would accept a 2.6.x kernel nicely, or upgrade altogether your distribution to one based on a 2.6.x kernel.

I know that answering you like this is not what you expected, but would allow you to save a lot of head aches and potential problems that may trash your distribution.
 
Old 07-28-2005, 02:12 PM   #402
blooms
LQ Newbie
 
Registered: Jul 2005
Posts: 2

Rep: Reputation: 0
Thank you very much for your prompt response. Actually the reason why I want to upgrade my linux-2.4.20-8 kernel is try to follow the baby steps in www.linuxfromscratch.org. It says I need linux-2.6.** kernel in order to use Udev (I don't know this stuff). I don't care much as long as the linux-2.6.** can be made as a host system for LFS. But now, it even cannot connect to the internet and I cannot even download anything with my upgraded kernel.

However, I find I am still a very very weak n00b. So I will stop trying to LFS unless I can be very familiar with the kernel and its compilations.
So I am happy to hack around my sleazy kernel until the computer gets corrupted totally and then I will reinstall with Fedora.
 
Old 08-15-2005, 10:11 AM   #403
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
If you want to follow the LFS route, you'll find that you must upgrade your kernel to 2.6 before you can successfully build the new glibc. You cannot do the build when the running kernel is 2.4. However, also note that the kernel itself does not use glibc, and therefore it can be upgraded using the tools that you now have.

If you use this route, realize also that you are pretty-much going to be dumping the "rpm" system and leaving it behind. Packages are fine as long as everything that you actually have on your system came from a package! When you start updating core-utilities, the kernel, modutils and so-on (as you must do), it is no longer quite so safe to continue using packages.
 
Old 09-08-2005, 07:29 PM   #404
DoctorWho
LQ Newbie
 
Registered: Sep 2005
Posts: 20

Rep: Reputation: 0
First let me thank you Thetargos for an excellent HOW-TO on recompiling your kernel, your apparant depth of knowledge concerning all things Linux is truly amazing! I need to recompile my kernel, if you like see post by DoctorWho in the Hardware section, as it appears the latest ATI driver does not like somthing or other in my current configuration. However I am also interested in what changes you made to your Kernel regarding GAMING. I am also a gamer and am running cedega on my machine along with Anarchy Online, which was working great until I installed the ATI card and broke all 3d acceleration I am curious to see exactly what changes you made to your kernel for gaming and why you made those changes. Thanx for your excellent tutorial, I am gonna try for a recompile this evening ......... crosses fingers!
 
Old 09-08-2005, 07:39 PM   #405
Thetargos
Senior Member
 
Registered: Mar 2003
Location: Mexico City
Distribution: Fedora, Ubuntu & Mint
Posts: 1,679

Original Poster
Rep: Reputation: 45
Hello, DoctorWho.

Thank you for kind comments. Well, this thread is a bit old, since it is primarily targetted to kernel version 2.4.x. Some of it may still apply for kernel 2.6.x, but deffinitely not the RPM section.

The changes I did... Well for starters, I have wondered a long time searching for a good patch to enable low-latency (for better overall system performance) and others... The question really comes to what distribution do you have and what kernel version do you currently have.

Now regarding your graphics card, I will check the post you reffer me to and try to see if there's anything you can do to have 3D back.

Good luck with your (re)compile!
 
  


Reply

Tags
howto, tutorial



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
Red Hat/Fedora ALSA mini-HowTo. Thetargos Red Hat 182 04-01-2006 12:12 PM
red hat 9 kernel compilation b0nd Linux - Newbie 1 08-11-2005 10:05 AM
Kernel compilation (2.4.25 - Red Hat) on DELL Inspiron 2650 rohitmordani Linux - Laptop and Netbook 7 04-05-2004 05:10 PM
Red Hat does not plan to release another product in the red hat linux line... Whitehat General 5 11-03-2003 06:33 PM
Red Hat Update Agent for kernel updates and custom kernels SparceMatrix Linux - General 5 09-03-2002 04:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 12:14 AM.

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