LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Red Hat custom Kernel compilation mini-How-To for Red Hat 8-9 (https://www.linuxquestions.org/questions/red-hat-31/red-hat-custom-kernel-compilation-mini-how-to-for-red-hat-8-9-a-91503/)

Thetargos 07-28-2005 12:44 PM

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.

blooms 07-28-2005 02:12 PM

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.

sundialsvcs 08-15-2005 10:11 AM

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.

DoctorWho 09-08-2005 07:29 PM

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!

Thetargos 09-08-2005 07:39 PM

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!

DoctorWho 09-08-2005 08:00 PM

Well I feel like a complete noob, perhaps I DO need to find a new guide for my kernel version and distro which is BTW

Uname-r: 2.6.11-1.14_FC3smp (Fedora3)

I got stuck at the first step:)

Typing 'make xconfig' or 'make menuconfig'

make xconfig
make: *** No rule to make target `xconfig'. Stop.

and I stop there :)

Thetargos 09-08-2005 08:04 PM

Ahh... For xconfig, (as I wrote somewhere in the tutorial for 2.6.x) you need to have the QT-devel packages. Run make menuconfig, you should have already everything required to use that (ncurses)

DoctorWho 09-08-2005 08:12 PM

I have installed EVERY development tool I could find during the install. I maed a few aborted attempts at an install before and kept missing htis package or that so I did a re-install and just installed all development packages:) But typing 'make menuconfig' does the same thing

make menuconfig
make: *** No rule to make target `menuconfig'. Stop.

Somehow I feel that some basic things have been moved around in Fedor3. I have tried installing quite a few programs that wont compile becasue they cant find GTK libraries, and I know they are installed on my system as well ...

Thetargos 09-08-2005 08:15 PM

Where are you doing this? Are you under /usr/src/<kernel_version>?? Looks like you are not under the source tree ;)

DoctorWho 09-08-2005 08:28 PM

Thanx for bearing with me:) Under /usr/src there are three subdirectories

/redhat
/Linux
/ATI

I have changed to the redhat sources folder

cd /usr/src/redhat/sources but the same thing happans, I am pretty sure I have the sources in /usr/src/redhat/sources I can see a bunch of files along with some config LINUX.xxxxxx and Kernel.xxxxxxx files there which I assume to be the sources. EIther way I still get

make menuconfig
make: *** No rule to make target `menuconfig'. Stop.

Thetargos 09-08-2005 08:38 PM

Ok, please what does this command say:
Code:

ls -l /lib/modules/`uname -r`/
Of special interest there is the build entry of the output, since that should point to the source tree... Unless the kenrel modules are distributed with the kernel headers (usually found in /lib/modules/`uname -r`/build/include )

Edit: If build is not a symlink but a regular directory, you may need to compile a new kernel altogether or get the sources from the kernel-<version>.src.rpm, install that (which would go then to /usr/src/redhat/SOURCES/) and then extract the .tar.bz2 from that directory to /usr/src/:
Code:

cd /usr/src/redhat/SOURCES
tar jxf linux-2.6.11.tar.bz2 -C /usr/src/

This will create the /usr/src/linux-2.6.11 directory. Then you can apply the patches from that directory to the actual kernel in /usr/src/linux-2.6.11 by:
Code:

cd /usr/src/linux-2.6.11
patch -p1 -i /usr/src/redhat/SOURCES/<file1>.patch

The order to patch the kernel to have a Fedora patched kernel is outlined in the file kernel.spec found in /usr/src/redhat/SPECS
The file is easy to read and follow, just pay attention to what patches go first than which and apply them. Once done, copy the configuration for your architecture from the /usr/src/redhat/SOURCES/kernel/configs/<your_arch>.confg to /usr/src/linux-2.6.11/ as .config, then:
Code:

cd /usr/src/linux-2.6.11
make menuconfig

That seems like a lot, I know, but once you're in menuconfig's interface, you'll be able to modify the kernel configuration to meet your needs.

DoctorWho 09-08-2005 08:47 PM

OK typing that comand I get:

[root@localhost lib]# ls -l /lib/modules/`uname -r`/
total 1000
drwxr-xr-x 17 root root 4096 May 11 19:05 build
drwxr-xr-x 9 root root 4096 May 11 19:05 kernel
-rw-r--r-- 1 root root 185528 Sep 6 21:29 modules.alias
-rw-r--r-- 1 root root 69 Sep 6 21:29 modules.ccwmap
-rw-r--r-- 1 root root 225070 Sep 6 21:29 modules.dep
-rw-r--r-- 1 root root 517 Sep 6 21:29 modules.ieee1394map
-rw-r--r-- 1 root root 357 Sep 6 21:29 modules.inputmap
-rw-r--r-- 1 root root 16053 Sep 6 21:29 modules.isapnpmap
-rw-r--r-- 1 root root 160077 Sep 6 21:29 modules.pcimap
-rw-r--r-- 1 root root 86765 Sep 6 21:29 modules.symbols
-rw-r--r-- 1 root root 252865 Sep 6 21:29 modules.usbmap

Thetargos 09-08-2005 08:52 PM

Ok, build is a regular directory... So no much luck there...

If you'd ask me, I'd suggest you to compile a vanilla 2.6.12 or 2.6.11 kernel rather than trying to re-compile a Fedora kernel. You can always use your kernel's configuration, since it lives in /boot/config-<kernel>, and you'd only have to enable/disable things from there. As for any special patches, as long as you stick to the Alan Cox' patch, you'll pretty much have a native Fedora kernel... Or very close.

DoctorWho 09-08-2005 09:43 PM

Wow this is all to much information for me, I need to digest it all. Is it really that big of an issue to re-compile a Fedora Kernel? It almost sounds like I would be better off putting the original Geforce2 card in and waiting a week or two for a paycheck and then buy an NVIDIA card, the drivers are just SO much easier to install, there is no comparision. It just gets me upset becasue ATI has great hardware and IMO superior graphic quality.....

Thetargos 09-08-2005 10:48 PM

Well, yeah. Indeed, ATi has better hardware overall, but their support for Linux is laughable at best. Even performance wise, a GeForce Ti 4600 beats the heck out of a Radeon 9500 which in theory is superior due to SM 2.0 support in hardware, not to mention that some features makes it more efficient (and has a superior T&L engine too). When softmoded to a Pro card, a 9500 should beat the heck out of Ti 4600 simply because they both would have the same amount of texture units available... At least in Windows. In Linux, however, the 9500 card just doesn't cut it. Its performance is way too slow to what it should be (again in Windows).

Anyway, enough of rants, which are off topic anyway. Regarding your problem at hand, knowing how build (or re-build) a kernel will be beneficial to you even with an nVidia card, which would mean tweaking the AGP to use NVAGP which some say is faster than AGPGART, though I've only seen that increase with nForce chipsets, which I have, for others, there's no much difference. Also to trim down a bit a kernel, and in the process you may learn a lot of how Linux works at the bare bones. Though I use Fedora mainly, my kernels are based off some (some say) quite experimental patches, which makes my PC to yield the best performance off it. Sure I've crashed my system when trying to get all working the way I want, but I think it's been worth it. At least for me. I would not advise anyone to attempt these kind of stuff as a regular basis, simply because 99.9% of the users won't need to. This kind of stuff is more for enthusiasts and those who want to learn the system inside-out.

All that exposed earlier, indeed seems like a lot, but in the end it is not that difficult... Just laborous.

aq_mishu 12-31-2005 12:46 AM

RPM of kernel
 
From where can i get the RPM for kernel 2.6 stable?? For RH8.0 and 9.0. I need the link because I have made a lot search but found nothing excepr tar files.. But i need the RPM.

Thetargos 01-02-2006 02:19 AM

I'm not sure there are even 2.6 kernel packages for those distributions, as they require some hacks to get them to properly boot (for instance some regarding the USB keyboard and mouse devices). Your best bet would be to install a native 2.6 distribution. You can always test your luck and attempt to build a 2.6 kernel on them, be ware, you will require a lot of packages to be updated (binutils, modutils, etc)

windycity_linux 12-18-2006 05:12 AM

Error 13
 
this is my first try at kernel compilation and so far it has not been going well (5:00 am :scratch: )

May be my issue more related to the grub config (kernel compilation went OK, no error - I have copied the vmlinux file to /boot). but when I am trying to boot to new kernel i am getting an error message,
Error 13: invalid or unsupported executable format

Is there any thing i need to do for the initrd option in grub.conf file? My understanding & I read some where that since i am putting every thing in the main kernel file or as a module i dont need a ram disk, so i delete the initrd line. does it sound ok? or is that the problem?

here is the grub.conf file, i am trying to load the 3rd one red hat test linux

default=1
timeout=10
splashimage=(hd1,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux ES (2.6.9-22.ELsmp)
root (hd1,0)
kernel /vmlinuz-2.6.9-22.ELsmp ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-22.ELsmp.img
title Red Hat Enterprise Linux ES-up (2.6.9-22.EL)
root (hd1,0)
kernel /vmlinuz-2.6.9-22.EL ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.9-22.EL.img
title Red Hat Test LINUX (2.6.9-22.ELsmp)
root (hd1,0)
kernel /vmlinux-test ro root=LABEL=/ rhgb quiet

title Other
rootnoverify (hd0,1)
chainloader +1

here is the list of file from /boot
drwxr-xr-x 4 root root 1024 Dec 18 03:50 .
drwxr-xr-x 25 root root 4096 Dec 18 04:50 ..
-rw-r--r-- 1 root root 5824 Nov 15 2004 boot.b
-rw-r--r-- 1 root root 612 Nov 15 2004 chain.b
-rw-r--r-- 1 root root 48509 Sep 19 2005 config-2.6.9-22.EL
-rw-r--r-- 1 root root 48017 Sep 19 2005 config-2.6.9-22.ELsmp
drwxr-xr-x 2 root root 1024 Dec 18 04:47 grub
-rw-r--r-- 1 root root 490334 Dec 5 02:41 initrd-2.6.9-22.EL.img
-rw-r--r-- 1 root root 481902 Dec 5 02:41 initrd-2.6.9-22.ELsmp.img
drwx------ 2 root root 12288 Dec 4 19:56 lost+found
-rw-r--r-- 1 root root 81860 Sep 29 2004 memtest86+-1.26
-rw-r--r-- 1 root root 23108 Aug 3 2005 message
-rw-r--r-- 1 root root 21282 Aug 3 2005 message.ja
-rw-r--r-- 1 root root 640 Nov 15 2004 os2_d.b
-rw-r--r-- 1 root root 731262 Sep 19 2005 System.map-2.6.9-22.EL
-rw-r--r-- 1 root root 758606 Sep 19 2005 System.map-2.6.9-22.ELsmp
-rwxr-xr-x 1 root root 43038615 Dec 18 03:50 vmlinux-test
-rw-r--r-- 1 root root 1465064 Sep 19 2005 vmlinuz-2.6.9-22.EL
-rw-r--r-- 1 root root 1426721 Sep 19 2005 vmlinuz-2.6.9-22.ELsmp

any help is appreciated.

Thetargos 12-18-2006 05:37 PM

You do not need to update grub manually. By issuing "make install" this will automatically update your grub entry, as the routine is part of the kernel scripts, so no need to do anything but issuing the following command (assuming everyting else is correct):

Code:

make bzImage modules modules_install install
This line will have the effect of building and installing everything, the kenrel image, the modules and then install them. That's the way I have been doing this since... seems like forever now. In any case, make install will take care of that for you.

gauchy 04-11-2007 04:14 AM

why usb keyboard doesn't work?
 
hi, I recompiled Redhat9.0 with kernel-2.4.20-8,the original kernel source in Redhat9.0,the command like this:
make mrproper
make clean
make oldconfig
make dep bzImage modules modules_install install
after rebooted the computer, I chose new kernel which is 2.4.20-8custome, and it was normal until the login screen was on, the keyboard didn't work! then I can't input username and password!
also I use /boot/config-2.4.20-8 to make again, the problem is still on.my keyboard is usb interfaced.
can you tell me why?
BTW: I did nothing in make oldconfig.
thanks

IBall 04-11-2007 04:37 AM

Make sure that you compile in the correct USB modules in the kernel.

Is there any reason why you are using RH9? This is very, very old now and is unsupported. It no longer receives security updates.

You would be much better off installing a newer, supported version of Linux. Fedora is the successor to free Redhat distros, the current release is version 6 and 7 will be released soon. Alternatively, try Ubuntu or openSuse.

IMNSHO, you are wasting your time with RH9 unless you have a really specific reason why you need it.

--Ian

Thetargos 04-11-2007 11:37 AM

The problem might have to do with the options for the HID portion of the USB subsystem, you might as well want to check that with menuconfig.

gauchy 04-11-2007 08:10 PM

I did chose the USB HID support:
-------------------------------
USB support-->
---USB Human Interface Devices(HID)
[M] USB HIDBP Keyboard(basic) support
[M] USB HIDBP Mouse(basic) support
--------------------------------
and I found some messages in boot messages:
-----------------------------------
keytable: Loading keymap
kernel: Console: colour dummy device 80x25
keytable:[
keytable:
keytable: Loading system font:
keytable: ^[(K
keytable:
keytable: /sbin/setsysfont: line 40: /dev/console: No such device
rc: Starting keytable: succeeded
..
: USB HID v1.10 Keyboard [CHESEN USB Keyboard] on usb1:2.0(original RH9 has input0 before :)
usb-uhci.c: interrupt, status 2, frame# 665
: USB HID v1.10 Mouse [CHESEN USB Keyboard] on usb1:2.1(original RH9 has input1 before :)
...
usb.c: registered new driver keyboard
...
usbkbd.c: :USB HID Boot Protocol keyboard driver
-----------------------------------------
then I thought the keytable was loaded and registered keyboard driver, but why the keyboard didn't work?
BTW: why I use RH9.0?
because my boss asked me to develop my programs on RH9.0, then I have no choice! I use openSUSE10.2 as my desktop!
the reason I want to recomplie RH9.0 is I have changed my boot logo as bootsplash done, but not used bootsplash, I followed this patch which Jason McMullan had pasted: http://www.uwsg.iu.edu/hypermail/lin...10.0/0515.html and I recompile the source, then the usb keyboard didn't work!
In order to test if my changes made the mistake, I reinstalled the kernel-source* in my RH9.0, changed nothing and compiled it, the problem was the same! then the problem is not relation to my codes.
I guess the reason maybe the usb modules, which probe usb devices, on the normal RH9.0, I can plug out and plug in keyboard, it works well, but my recompiled kernel don't know the keyboard, then the usb probe doesn't work? that's right?
I'll set my login screen to autologin, then I can use mouse to see the modules loaded on my recompiled kernel.

Thetargos 04-11-2007 08:33 PM

Read the documentation, it clearly states that unless you really have a good reason to, never to build the HID basic support either into the kernel or as modules, as that will limit the functionality of your devices. I'm pretty sure in this case that's what causing the problems. I could be wrong, but it is worth trying... You *could* runa 2.6 based kernel on that machine, but that would require such an overhaul of other stuff that you may end up braking things up, so unless you had access to an RH9 sand box I wouldn't attempt it... First try disabling those modules.

PS:By HID Basic support I mean HID Keyboard (basic) and Mouse (basic) modules, not the whole HID subsystem!

gauchy 04-11-2007 09:05 PM

thanks to Thetargos, I had done what you said, that was not include supportting USB HID keyboard and mouse in .config, which is the default set in RH9.0, the problem was still on!
like this:
-----------------
USB support-->
---USB Human Interface Devices(HID)
[] USB HIDBP Keyboard(basic) support
[] USB HIDBP Mouse(basic) support
-----------------
keyboard is no response and numlock is off.
I set my RH9.0 autologin just now, and started my recompiled kernel, I used mouse to open hardware navigator in system tools, and I found :
----------------
USB Devices
82801EB USB EHCI Controller #2
82801EB USB (Hub #1)
82801EB USB (Hub #2)
82801EB USB (Hub #3)
...
System Devices
CHESEN USB Keyboard
USB UHCI Root Hub
USB UHCI Root Hub
USB UHCI Root Hub
USB UHCI Root Hub
...
Keyboard
CHESEN USB Keyboard
(information is CHESEN keybdev)
------------------------
If I pull out the usb keyboard, the keyboard item was not on the hardware navigator!
then I think the driver is loaded, and RH9.0 know the keyboard is connected, also keymap is loaded, what's the reason? I'm confused!

Thetargos 04-11-2007 09:09 PM

The USB subsystem in kernel 2.4 was kind of messy. If I may suggest you to grab the latest 2.4(32, I believe) and try to build that instead of trying to rebuild the Red Hat kernel? I had endless problems when trying to build Red Hat specific kernels, and had much more luck with plain vanilla ones, not that you miss any features (unless you require those features, which you could see in the spec file in the kernel src.rpm package, and you may even try to apply those patches by hand and see which ones are the responsible for braking your compilation... Which I'd say is a bit too much of work to do. You should be fine with a vanilla kernel and the patches you need, though.

Edit

What do you know? The latest 2.4 kernel is 2.4.34.2... Try that instead of the ancient 2.4.19 (or 20) Red Hat sports.

gauchy 04-11-2007 09:24 PM

thank you,Thetargos.
I agree with you, but the boss don't care that, he wants to run our program on RH9.0 with less modified sources!
I'll try the other things,thank you!

Thetargos 04-11-2007 09:27 PM

The kernel, even though it is core to any Linux distribution, is far from the most important part, depending what your program(s) have to do, you may find out that gcc and GlibC are a much more sensitive part of the system than the kernel itself. After all, the kernel also gets both linked and built by/against those ;)

gauchy 04-11-2007 10:11 PM

yes, I know that, also I can change the keyboard interface to ps/2.:)

brave heart 04-12-2007 10:35 PM

I want to compile my kernel from 2.4.20 to 2.6.20, after my compile(make bzImage), there is following error message:

Code:

BFD: Warning: Writing section `.bss' to huge (ie negative) file offset 0xc0241000.
objcopy: arch/i386/boot/compressed/vmlinux.bin: File truncated
make[2]: *** [arch/i386/boot/compressed/vmlinux.bin] Error 1
make[1]: *** [arch/i386/boot/compressed/vmlinux] Error 2
make: *** [bzImage] Error 2

where is my error reason? can I make this compile passed via modify somewhere?

thanks, :D

brave heart 04-12-2007 10:46 PM

during my compiling process(make menuconfig), I choose default and not change anyplace.

brave heart 04-13-2007 05:19 AM

Please leave my last 2 threads alone. For I found it's big puzzle in kernel 2.6.20 after navigating via google.

I have successfuly got kernal 2.4.20-8 to run. But now I compile with 2.4.34(for my netcard driver) and then I get a problem when I try to boot with that kernal, the screen will stop at here:

Code:

VFS: Cannot open root device "LABEL=/" or 00:00
Pleas append a correct "root=" boot option
Kernal panic: VFS :Unable to mount root fs on 00:00


Pls help!:scratch:


All times are GMT -5. The time now is 07:17 PM.