LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-07-2002, 12:52 PM   #1
rootlinux
Member
 
Registered: Dec 2001
Location: California
Distribution: Red Hat 7.2, Slackware 8.0
Posts: 53

Rep: Reputation: 15
Kernel Compile Nightmare


Hello everyone. Well, as the subject states, i'm having one heck of a time compiling my first kernel. It appears that everything was going smooth until I rebooted after the compile and picked the new kernel from LILO...then everything went downhill. Missing files, failed this, failed that...needless to say, it was a nightmare.

Let me start off with what im runnig:
Running RH 7.2, kernel 2.4.9-31. I was trying to compile to 2.4.18.

Here is what I did: (By the way, i've read so many things on compiling a kernel that i very confused and my heads about to spin off)


First, I grab the source from www.kernel.org. Im using the 2.4.18 stable version at this point. (I grab it through FTP)


Ok, here is one question I have. I’ve read different things on where to d/l the file. Some say d/l it to a temp directory of some sort, others say to download it right to /usr/src.
So, I’ve been downloading it to /usr/src directory.


Once I’ve got it downloaded, I rename my old linux directory to the current kernel installed (2.4.9-31). Once that’s renamed, I untar the kernel. (tar –xzvf <filename>)
First of all, should I even rename the Linux directory? What's recommended here?


Of the three type of makes I know (Make config, make menuconfig, make xconfig) so far, I prefer make menuconfig the best. So I run make menuconfig and run through the process of picking and choosing what I would like.

After that, I run the following: make dep followed by make clean.

Once these are finished, its time for the big one: make bzImage.

Now, this is where im confused. It was fairly easy up till this point. My main question is, what step is next? I’ve read so many different things its confusing. (Maybe that’s why I cant get it to work ) I’ve read that I should make modules followed all sorts of stuff. I’ve read articles where I should manually copy over the new kernel. (I’ve posted some links that I’ve used for reference)

I guess my main question is, whats next after I make bzImage? Do I need to make modules? make modules_install? Do I need to manually copy over the kernel?

And whats the best way to edit LILO?

In a nutshell:
1. Grab source code for kernel
2. Download to a directory and untar.
3. make menuconfig
4. make dep
5. make clean

After that, im confused.

I appreciate anyone who can help me out here. I feel like im close, im just missing a step OR adding a extra step.

Thanks for everyones input!

R
 
Old 05-07-2002, 01:03 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
make bzImage and make modules are independant, and can be switched around in any order, just need a make modules_install after you have made the modules. editing lilo.. just make a copy of your current default linux mode and edit the image values. then rerun lilo as root. you'll only need to use make clean if you've already compiled a kernel once using that source.
 
Old 05-07-2002, 01:10 PM   #3
rootlinux
Member
 
Registered: Dec 2001
Location: California
Distribution: Red Hat 7.2, Slackware 8.0
Posts: 53

Original Poster
Rep: Reputation: 15
So basically:

after I run make dep, do the following:

make bzImage
make modules
make moduels_install

what about it some places, I see that before you edit LILO, you actually issue a make install command, or you manually copy over the kernel the /boot directory? Anyone seen that?

RL
 
Old 05-07-2002, 01:25 PM   #4
Half_Elf
LQ Guru
 
Registered: Sep 2001
Location: Montreal, Canada
Distribution: Slackware; Debian; Gentoo...
Posts: 2,163

Rep: Reputation: 46
If your distribution is RedHat, you doN't have to do a Make install I think.
So (one of) the right ways is:
make menuconfig
make dep
make clean
make bzImage
make modules
make modules_install

then you should run lilo if you didn't done it yet.

In slackware, between make bzImage and make modules you can do a "make install" but it's not a good idea to do it on another distrib I think.

First of all, should I even rename the Linux directory? What's recommended here?
It's VERY recommended to rename your current linux directory to another name (no matter the name you give it) before untaring because kernel untar by default in "linux" directory. In other words, if you do not rename the old directory, you will loose your old kernel.
 
Old 05-07-2002, 01:26 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
modules. not moduels.

no you wouldn't overwrite your existing vmlinuz image, that's suicide i don't personally use make bzlilo of such, i just copy the arch/i386/boot/bzImage file manually
 
Old 05-07-2002, 02:22 PM   #6
Lazarus
Member
 
Registered: Dec 2001
Location: Kent in UK
Distribution: Fedora 2
Posts: 170

Rep: Reputation: 30
For what its worth here is my script for compiling 2.4.18 for redhat 7.2

put kernel source in /usr/src/linux
the linux may be s symlink to a directory somewhere else in my case
cd /usr/src
ln -s /spare/linux.2.4.18 linux
then
cd /usr/src/linux

make menuconfig
gives a menu allows you to customise your kernel. What file systems NIC's etc to support
then enter:-

rebuild_kernel vmlinuz.2.4.18
puts kernel in /boot

here is my rebuild_kernel script

#!/bin/sh
#
# alternative target can be set in parameter 1
#
# last modified to set target to /boot on 31/8/00
#
target='/boot/vmlinuz'
if [ -n "$1" ]
then
target=/boot/$1
fi
echo target set to $target
sleep 2
cd /usr/include
rm -rf linux
rm -rf asm
ln -s /usr/src/linux/include/linux linux
ln -s /usr/src/linux/include/asm-i386 asm
ln -s /usr/src/linux/include/scsi scsi
cd /usr/src/linux
make dep
if [ -z "$2" ]; then
make clean
else
echo "no make clean today"
sleep 2
fi
make bzImagecp /usr/src/linux/arch/i386/boot/bzImage $target
make modules
make modules_install
depmod -a


Hope this sets you off in the right direction
 
Old 05-07-2002, 09:14 PM   #7
Jazm
LQ Newbie
 
Registered: Apr 2002
Distribution: RH & SuSE
Posts: 17

Rep: Reputation: 0
Rh has a different step for make modules_install. I don't have my doc here with me but i remember RH was different in that step.
would also make oldconfig first. that way your current settings are saved prior to changes.

The symlinks that lazarus has in his script are critical in redirects the /usr/include back to your new kernel source.

Last edited by Jazm; 05-07-2002 at 09:16 PM.
 
Old 05-08-2002, 05:23 AM   #8
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992

Rep: Reputation: 30
make menuconfig(or xconfig)

This is the step where a lots of people make mistake. Going by your description it seems that you have not selected the proper modules during the 'make menuconfig' or 'make xconfig' step.
 
Old 05-08-2002, 03:13 PM   #9
rootlinux
Member
 
Registered: Dec 2001
Location: California
Distribution: Red Hat 7.2, Slackware 8.0
Posts: 53

Original Poster
Rep: Reputation: 15
Ok..let me see if I have this correct. Let me run through the steps, and everyone telll me if i'm right, wrong, or way off.

1. Download kernel 2.4.18 tarball to /usr/src
2. Rename the current Linux dir to 2.4.9 (current kernel)
3. Untar 2.4.18 tarball
4. cd to /usr/src/linux
5. make menuconfig (I like menuconfig)
6. Run through the kernel config.
7. Once #6 is done, run make dep.
8. make modules
9. make modules_install
10. make bzImage

Now, manually copy over the new bzimage to the /boot directory? This is where I need a bit of help.

Thanks everyone!

RL
 
Old 05-08-2002, 04:42 PM   #10
rootlinux
Member
 
Registered: Dec 2001
Location: California
Distribution: Red Hat 7.2, Slackware 8.0
Posts: 53

Original Poster
Rep: Reputation: 15
Ok...been researching this more and more.

I've come to the conclusion that I should rename my original /usr/src/linux directory to the old kernel version, then just untar the most recent kernel source tarball in /usr/src and let it creat the new linux directory. I got that.

I understand that I need to perform the basic commands next.

make menuconfig
make dep
(i believe after this, make modules and make modules_install are optional)
make bzImage

Ok...after my new kernel is compiled (2.4.18), this is where I need help.

I know that my current kernel, 2.4.9, is currently in the /boot directory.

NOW. What do I do next? What do I need to do to the old kernel in the /boot directory? Rename? Remove?

After that, I manually move my new kernel, 2.4.18, over the boot directory. (I was told I can rename if I like)

This is the last bit of help I do need help with. I'm looking forward to some help here. FYI, Red Hat 7.2 is what im running.

THanks everyone!

RL
 
Old 05-08-2002, 05:27 PM   #11
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
leave the old one where it is and call the new one vmlinuz-test-2.4.18 or something
 
Old 05-08-2002, 05:34 PM   #12
Jazm
LQ Newbie
 
Registered: Apr 2002
Distribution: RH & SuSE
Posts: 17

Rep: Reputation: 0
You will need to run GRUB or LILO.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel nightmare! norkers Linux - Software 19 04-26-2005 04:01 PM
Kernel Rebuild Nightmare squirellplaying Linux - General 2 01-20-2005 04:31 PM
Kernel nightmare noobist Mandriva 10 09-04-2004 10:10 AM
Kernel Problems. Howto Compile a new kernel from 4.2 with backwards compatibility ? ShoCkwave Linux - General 2 06-19-2004 06:02 AM
Kernel 2.4.23 compile causes kernel panics on ATA RAID-1 (mirror) array Raptor Ramjet Slackware 3 12-18-2003 01:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:32 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
Open Source Consulting | Domain Registration