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/)

vincebs 12-08-2003 09:18 PM

Well what exactly is the source of my problem then? I included in xconfig all the modules I thought my computer would need. I used the help entries to help me decide. Yet I still get the unresolved symbols errors and my new kernel ends up being unable to load many modules. If I just copy what's in my 2.4 configuration file, then take out stuff that I think I don't need, the configuration's going to look just like it did when I didn't use the 2.4 configuration as a guide.

Thetargos 12-08-2003 09:48 PM

What compiler version are you using, I see u use two distros, is this in RH or SuSE? if in RH, you may check what gcc version you have by:
Code:

gcc --version
gcc296 --version

You should at least have gcc version 3.2 (gcc command) and the legacy compiler compatibility gcc296 (gcc 2.96 version). Also you may try to compile the kernel with either of those. To that end you may either:
  • export the CC enviroment variable (export CC="gcc296"), or
  • Change all instances of gcc to gcc296 in the top level Makefile under your 2.6 kernel sources.
Those should work, at least to attempt a 2.96 gcc compilation. That should get rid of those nasty UR (also you may be getting UR because of incomplete module load sequence... but that's another story). Try gcc296 first and then post back.

avios 12-09-2003 07:22 AM

Automated Kernel Recompile !
 
A very good article ! Must be praised ! But most ppl these days are very busy and so it becomes a pain to come back to the monitor everytime to see everystep of the kernel being compiled and then typing the appropriate commands like make to do the rest of the action. Welcome to The Automated Kernel Script ! Just configure your kernel and then have ur kernel image automatically created with this script.

Copy this script below and save it as a file and run the script.

-----------------------------------------------------------------------------------------------
# Automated Kernel Recompilation By Avinash Shankar
# Note: This was done under RH-7.3 so plz verify the paths
# Warning: Please run the Script under Xwindows

#going to kernel sources directory:
echo Entering Kernel Source Directory................
cd /usr/src/linux-2.4/

#Cleaning dep files and objs:
echo Cleaning up Junk files..................
make clean

#Configuring your New Kernel:
echo Entering Graphical kernel config.....................
make xconfig

#Making the dependencies files:
echo Making the dependecies ..................
make dep

#Backing up old module files
echo All your module files and system.map files backed up ................
mv /lib/modules/2.4.18-3/modules.dep modules.dep.old
mv /usr/src/linux-2.4/System.map System.map.old

#Make a compressed kernel:
echo Compressing the kernel image ..............................................
make bzImage

#Copy the Image to /boot directory
echo Copying the bzImage to /boot Directory......................................................
cp /usr/src/linux-2.4/arch/i386/boot/bzImage /boot

#Make the modules :
echo Compiling the Modules ...............................
make modules

#Make the Installable modules used by the new kernel
echo Making the modules executable ...................................
make modules_install

#copy the System.map file to /boot
echo Copying System.map file to /boot ....................................
cp /usr/src/linux-2.4/System.map /boot

echo Thats it you are finished ! Cool now edit the lilo.conf or your grub.conf file
echo located in the /boot directory. Copy the kernel entries and replace kernel with
echo the bzImage file and the initrd entry with System.map

-----------------------------------------------------------------------------------------------

Hope this script is used by a lot of ppl ................ Thats all a good programmer will hope for .............................. Purpose Served...

P.S If you modify or enchance this script plz post me a mail ...........

luv

Avinash Shankar

Thetargos 12-09-2003 01:23 PM

Have you tried it yourself yet? The last time I tried that, I ended up with the script being interrupted when you exited either make xconfig or make menuconfig... so that's why I ask.

avios 12-09-2003 06:43 PM

If you realize with out a kernel config script the rest of the script cannot work . That is you need a config file to configure your kernel modules ! I have tested the script many times and Have had successful compilation of kernel throughout ! So it does work ! After you use xconfig or make menuconfig please save the config file ! { the Save and exit button in Xconfig} . Please let me know if its worked out for you !

regards

artur 12-10-2003 10:43 AM

Re: Automated Kernel Recompile !
 
Quote:

Originally posted by avios
most ppl these days are very busy and so it becomes a pain to come back to the monitor everytime to see everystep of the kernel being compiled and then typing the appropriate commands like make to do the rest of the action.
You are right, we're all busy, but the kernel is such an important part of the system that it's recompilation should not be taken lightly. Another words: if you don't have the time to do it right and monitor the process - don't do it.

Quote:

Welcome to The Automated Kernel Script ! Just configure your kernel and then have ur kernel image automatically created with this script.
Well intended, but not a good idea, I'm afraid. If kernel is recompiled step by step there is a chance that person compiling it will catch any error messages and do something about them before something gets messed up... Your script does not check for sucessful completion of operations nor does it keep any logs of what's going on. I guess you truly are a busy person to not add these features to your script ;)

Quote:

# Warning: Please run the Script under Xwindows
Why? What if one does not run X on the box they want to compile on? The script should check if X is available/running and launch 'make menuconfig' if not.

Quote:

#Backing up old module files
echo All your module files and system.map files backed up ................
mv /lib/modules/2.4.18-3/modules.dep modules.dep.old

Are the modules really backed up here? Or maybe just the module dependency file? And what's gonna happen to my original modules.dep file if I re-run the script? Should your script really say that the files are backed up before it even tries to back them up?

Quote:

#Make a compressed kernel:
echo Compressing the kernel image ..............................................
make bzImage

how about something like make bzImage 2>&1 | tee make.log?

Quote:

#Copy the Image to /boot directory
echo Copying the bzImage to /boot Directory......................................................
cp /usr/src/linux-2.4/arch/i386/boot/bzImage /boot

So, the second time this script is run, the previous kernel will get wiped out without even waiting to see if modules compile o.k.?

These are jus a few major things that would need improvement.

Please don't take this as a flame. It is not my intention to flame you. I just want to point out that using a script like yours is not a good idea, and even if it was, your script needs a lot of improvement before it can be used. A quick hack like this is just fine for personal use, but before you offer it for others to use, please put some effort into it. Think about responsibility you take (moral if not legal) if someone uses your script and messes up their computer because the script does not check for anything nor log anything.

Your easy reply would be "write your own script if you think you can do it better smart a??". I won't , because like I said I don't think it is a good idea and because I'm busy :). But I when I compile my kernels I do take my time to go step by step and log a lot.

Thetargos 12-10-2003 01:58 PM

It could be somewhat beneficial to new users know that they can start a kernel re-compile without much of the hassle, however (as artur says) since it is such an important part of the system (heck its the HEART of the system :D) anyone compiling a kernel should know something about the endevour he/she is going to undertake. On that regard the kernel's own Documentation is a precious jewl, as are the many help tid bits embeded in the tools to configure it.

I do support the idea of a kernel compilation script. If you let me, I may add some modifications to the code that may help improve its usefulness.

Regards.

Gian Paolo Mureddu
AKA Thetargos.

avios 12-10-2003 08:17 PM

Thanks for the very detailed reply ! I am very happy u pointed out the logical problems in the script artur ! Unfortuantely I got introduced to shell scripts a week bak only ! and this was a personal release ... Like I said before Its for newbies who desperately require a kernel for thier system but do not know about the commands. Futher I feel its important to record the steps in compiling the kernel image some place. Which is why I felt that such a script would be a good start.

U could replace xconfig with make menuconfig for text mode ! But most ppl use X as default these days ! And the xconfig is a much easier program for newbies to use !

Thetargos I would very much appreiciate ur support and modification of the script ! All I ask in return is acknowledgement for my script and a copy of your modifications here at the msg board !

Thanks very for the response guys ! I will work more and try to incorporate your ideas and comments into the next version .............

regards

artur 12-10-2003 09:19 PM

Good luck with your project guys.
A few more suggestions then if I may:
Your scripts will love you if you begin them with magic, e.g.
#!/bin/bash
open any script that came with your system - you'll see it there

From my own experience I learned that it is a good idea to timestamp whatever you can, especially backup files. I'd start the script with this:
my_timestamp=$(date +%y%m%d-%H%M)

and then do things like
cp /usr/src/linux-2.4/System.map /boot/System.map.$my_timestamp
ln /boot/System.map.$my_timestamp /boot/System.map

Also, right after you finish configuring the kernel it is recommended to edit toplevel Makefile and change EXTRAVERSION variable. I'd do this:
cat Makefile | sed -e 's/EXTRAVERSION = .*/EXTRAVERSION = -$my_timestamp/' > /tmp/Makefile.tmp; cat /tmp/Makefile.tmp > Makefile
all the above on one line

And please use a lot of "if" and ">> log.$my_timestamp 2>&1"

I don't want to spoil your fun any further. Enjoy figuring out the rest yourselves.

Thetargos: thank you for mentioning the documentation so frequently. Answers to many questions I see asked are in the docs!

I still think it's not a good idea :D

vincebs 12-12-2003 12:18 AM

Quote:

Originally posted by Thetargos
What compiler version are you using, I see u use two distros, is this in RH or SuSE? if in RH, you may check what gcc version you have by:
Code:

gcc --version
gcc296 --version

You should at least have gcc version 3.2 (gcc command) and the legacy compiler compatibility gcc296 (gcc 2.96 version). Also you may try to compile the kernel with either of those. To that end you may either:
  • export the CC enviroment variable (export CC="gcc296"), or
  • Change all instances of gcc to gcc296 in the top level Makefile under your 2.6 kernel sources.
Those should work, at least to attempt a 2.96 gcc compilation. That should get rid of those nasty UR (also you may be getting UR because of incomplete module load sequence... but that's another story). Try gcc296 first and then post back.

No luck. I replaced all the references to gcc in Makefile to gcc296. Then I compiled again. The Unresolved Symbols errors still appear. It gave me a warning though to install mod-init-tools, which I did but to no avail.

Thetargos 12-12-2003 12:32 AM

Even after recompiling with gcc (3.2) and gcc296? I know there is a mod-utils packageespecially made for 2.6 kernels, though I haven't found it yet for Red Hat Linux systems (or Fedora for that matter). Some gentoo folks have to install it in order to get a 2.6 kernel properly working. Maybe what you are lacking has something to do with that? I don't know.

vincebs 12-12-2003 12:36 AM

I downloaded a file called module-init-tools-0.9.14.tar.gz and installed whatever was in it.

So far I've tried:
1.) Compiling normally
2.) Copying my original config-2.4.20-8 to the /usr/src/linux directory and then compiling
3.) using make mrproper instead of make clean and then compiling
4.) Using make config instead of make xconfig and then compiling
5.) Deleting the new 2.6.0 kernel files (initrd, System.map, vmlinuz, plus the /lib/modules) before recompiling again
5.) Using gcc296 instead of gcc to compile
6.) Installing module-init-tools 0.9.1.4 and then compiling

I still get unresolved symbols errors no matter what is tried

Thetargos 12-12-2003 02:43 PM

What modules do you get unresolved symbols in?

vincebs 12-12-2003 06:08 PM

I get unresolved symbols in basically every section, agp, i2c, i2o, networking, CD-ROM, IEEE394, everything.

The basic format of the error is:
"depmod: *** Unresolved symbols in ..."

There are hundreds of UR errors, here are the first few dozen::
/lib/modules/2.6.0-test10/kernel/drivers/char/agp/ali-agp.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/agp/amd-k7-agp.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/agp/intel-agp.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/agp/sis-agp.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/agp/sworks-agp.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/agp/via-agp.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/ipmi/ipmi_devintf.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/ipmi/ipmi_kcs_drv.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/ipmi/ipmi_watchdog.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/lp.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/ppdev.ko
/lib/modules/2.6.0-test10/kernel/drivers/char/tipar.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/algos/i2c-algo-bit.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/algos/i2c-algo-pcf.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-ali1535.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-ali15x3.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-amd756.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-elektor.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-elv.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-i801.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-i810.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-isa.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-philips-par.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-piix4.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-sis5595.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-velleman.ko
/lib/modules/2.6.0-test10/kernel/drivers/i2c/busses/i2c-via.ko

DropHit 12-13-2003 05:53 PM

How do i include my HPT drivers in this?
 
OK looks good easy to follow, although how do i include my HPT 370 drivers into this setup?

Zack

They where loaded when i used the standad RH9 installer program and used linux expert hde=noprobe from installer command line..

Z


All times are GMT -5. The time now is 06:45 PM.