LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-10-2005, 11:23 PM   #1
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Rep: Reputation: 30
can i recompile the kernel?


Hi All....
Good morning......

I am using LAS 3.0 OS .... i am having a problem with sound card....for that i would like to recompile the same kernel(version 2.4.21-15.EL) , i didn't want to upgrade it..... if I follow these four steps were enough.... i am not having any idea about these four steps....

1. make config
2. make dep
3. make clean
4. make zImage.....

1) what are the functions of make dep, make clean, make zimage.............?
2) instead of make config .... can i sue xconfig or gconfig(not sure) ?????
3) if i recompile the kernel .... is it effect the kernel's file size..??????

i don't have any idea about it....?any explanation / help about this issue would be appreciate.

thnx in advance...
zameer ahmed syed..
 
Old 01-10-2005, 11:44 PM   #2
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
is linux - newbie ... is the correct forum for this question... ? or else i have to shift from this forun to other forum like ...linux - software....



-zameer--------
 
Old 01-11-2005, 12:38 AM   #3
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
yes
you need the source package for your distribution that is that exact kernel
inside it see if you might can find some kind of defaullt configuration file as it will help to start out.

my favorite way to start is to set EXTRAVERSION= to some value in the Makefile so your new kernel won't kill the old one (safer) so you don't overwrite your old modules

then "make mrproper" to clean up (olny need to do this the first time)
then copy that default config to the top level and name it .config
not a big deal if you don't have one
then "make menuconfig" for a old style ncurses configure thingy or
"make xconfig" for a fancy gui configure thing
the config is the tricky part -- with experience you can pick only the exact things you need and nothing more and you get a very small and blazingly fast kernel -- you can also manipulate the gcc flags set in the Makefile to optimize for your machine for size or speed.
after the config
make clean (gets rid of old object files)
make dep (builds module dependancy files)
make bzImage (creates the kernel image)
make modules (builds modules)
make modules_install (installs modules)
then copy ./arch/i386/bzImage to /boot and name it something unique (don't overwrite old kernel)
backup old System.map and copy new one to /boot
make a new entry (don't overwrite old one ) in boot loader (/boot/grub/menu.lst)
if it's grub new and old kernel will show up so you can choose
(i forget how lilo works if you use that -- sorry)

then when it doesn't work right boot the old kernel and try try the config again till you figure it out

note: some stock kernels use an initrd -- to avoid having to build that just choose to build support for your hard drive and file system directly into the kernel (not as modules) and the kernel will boot without it.

it's not that hard and you will have fun
 
Old 01-11-2005, 01:33 AM   #4
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
thanx foo_bar_foo .... u gave me a bulk descritptive reply.... as i am first time hear this recompile kernel....its looking very hard to me...no problem...i am studying u r description .... in the following lane me having one doubt....
"copy that default config to the top level and name it .config not a big deal if you don't have one"....
----here i am in confused little bit...about top level of directory....
I am having a Configure file in /usr/src/linux-2.4.21-15.EL/scripts folder....
here my doubt was i have to copy this Configure file in which toplevel...either
in usr or src or linux-2.4.21-15.EL which one......
and u also told that its not a big deal ... but its a big deal for me..bcoz me a new person..... each and every step should follow as very careful i think....
any help would be appreciated...

thnx...
 
Old 01-11-2005, 02:51 AM   #5
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
hi foo_bar_foo

i got this following error message when i am trying to make bzImage....

{standard input}: Assembler messages:
{standard input}:1060: Warning: indirect lcall without `*'
{standard input}:1138: Warning: indirect lcall without `*'
{standard input}:1222: Warning: indirect lcall without `*'
{standard input}:1315: Warning: indirect lcall without `*'
{standard input}:1331: Warning: indirect lcall without `*'
{standard input}:1341: Warning: indirect lcall without `*'
{standard input}:1423: Warning: indirect lcall without `*'
{standard input}:1438: Warning: indirect lcall without `*'
{standard input}:1449: Warning: indirect lcall without `*'
{standard input}:1935: Warning: indirect lcall without `*'
{standard input}:2021: Warning: indirect lcall without `*'


could u have any idea about this message... .........

thnx ......
 
Old 01-11-2005, 03:13 AM   #6
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
hi foo_bar-foo

copy ./arch/i386/bzImage to /boot and rename it to some thing (not overwrite old kernel)
I didn't found bzImage in i386 folder . i am having bzImage in arch/i386/boot folder only..... i am little bit hanging here and confused with this point u mentioned in the above line...any help would be appreciate....i am worried here about overwrite.....

thnx ---
zameer ahmed syed.
 
Old 01-11-2005, 11:03 PM   #7
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
I follow this criteria ... result was reinstalling...
for newbies..these types of explanation is not good....
in the above procedure..
look at these lines... how a newbie can understand these...


"then copy ./arch/i386/bzImage to /boot and name it something unique (don't overwrite old kernel)
backup old System.map and copy new one to /boot
make a new entry (don't overwrite old one ) in boot loader (/boot/grub/menu.lst) "

if explanation with examples would be given then its better to do....

still i didn't want ot skip this issue... is anybody there to help me ... how to recompile the kernel detail explanation...or any sites for newbies to recompile kernel...
any help /suggestions/comments would be appreciate...


thnx in advance..
zameer ahmed syed...
 
Old 01-12-2005, 02:21 AM   #8
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
First, always keep your current known working kernel configured in your bootloader, that way if something goes wrong then you can always just boot back into it, abeit if your using kernel modules they will be replaced with the one you build when installing a kernel of the same version. This is generally not a problem so long as you do not remove something crucial.

Second, why are you wanting to stay with 2.4.21? As I recall, there have been a few security related fixes since then.

Third, until you become accustomed to what a feature does in the kernel, it's best to start with the config for your current kernel and build off that. That file is usually located in /boot along with your kernel. You'd copy it to the kernel source directory and name it .config so the kernel configuration program will find it.

The basic generic proceedure would be something like this:
1) unpack the kernel source (/usr/src is the accepted default place for it)
Code:
cd /usr/src
tar jxvf linux-2.4.21.tar.bz2
2) cd into the source directory
Code:
cd /usr/src/linux-2.4.21
3) Clean the source tree
Code:
make mrproper
4) Copy /boot/config-2.4.21 or whatever it's named on your system to the source tree as .config.
Code:
cp /boot/config-2.4.21 /usr/src/linux-2.4.21/.config
5) Run whichever configurator you want to use and add/remove whatever it is you wish to change.
Code:
make menuconfig
6) Build dependancy files
Code:
make dep
7) Build the kernel image
Code:
make bzImage
8) Build the kernel modules
Code:
make modules
9) Install the kernel modules
Code:
make modules_install
10) Install the kernel, making sure the names below DO NOT overwrite any files already present in /boot. If they do then rename the below files to something else.
Code:
cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.21
cp System.map /boot/System.map-2.4.21
cp .config /boot/config-2.4.21
11) Add an entry to config file for whatever bootloader you are using.

I'm not familair with your specific OS, therefore I do not know what bootloader it uses. But generically, grub's is usually located at /boot/grub/menu.lst. Here's a portion of one with 2 kernels:
Code:
title LFS 6.0 (2.6.10)
root (hd0,1)
kernel /boot/linux-2.6.10 root=/dev/hda2

title LFS 6.0
root (hd0,1)
kernel /boot/lfskernel-2.6.8.1 root=/dev/hda2
Your's will be different, but you should get the idea. The first 1 listed is the default one that will be booted if there is no user intervention to select one.

For lilo, the config file is usually at /etc/lilo.conf & the relevant portion would be something like this:
Code:
image = /boot/vmlinuz-2.6.1
  root = /dev/hda3
  label = Linux-2.6.1
  read-only
image = /boot/vmlinuz-2.4.26
  root = /dev/hda3
  label = Linux-2.4.26
Again 2 kernels, the first is the default. And with lilo, you must run "lilo" after editing the lilo.conf file in order to reinstall it.

The above are just general instructions for compiling a 2.4.x series kernel. Your distribution may have another more specific proceedure. Hope this helps.

Last edited by DaHammer; 01-12-2005 at 02:23 AM.
 
Old 01-12-2005, 06:25 AM   #9
zameer_india
Member
 
Registered: Sep 2004
Location: hyderabad
Posts: 210

Original Poster
Rep: Reputation: 30
thnx hammer....... Good and gr8 Explanation.... Hammer


U gave me a descritpive explanation....through which i got a success....Hurray!

I got it.... I got it.... I got it... thnx to Hammer once again....
 
  


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
how to recompile kernel 2.4.21-15.EL zameer_india Linux - Newbie 2 12-24-2004 01:02 AM
kernel recompile error (kernel panic) tombaaaaa Linux - Newbie 4 08-04-2004 04:32 PM
Recompile kernel 2.6 heema Linux - General 3 05-26-2004 10:29 AM
9.2 kernel recompile dukeinlondon Mandriva 3 11-10-2003 06:34 AM
Recompile Kernel ? Amerist Linux - Newbie 5 04-16-2002 04:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:40 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