Infamous Cow
Mar 18 2004, 18:14
Downloading and installing the kernelThe new kernel is quite easy to find and download. Follow these steps.
1. First, become
root (use the: su command in a shell)
2. Go to
The Linux Kernel Archives.
3. Download the Linux 2.6.xx kernel and save it to your /usr/src directory.
4. As root, run the following commands in the console. (Note: This assumes you've installed your Linux distribution with all the developer options. If you haven't, take a look at your distribution's website for more information on 2.6 kernel packages you can download.)
CODE
tar -zxvf linux-2.6.xx.tar.gz
cd linux-2.6.xx
make menuconfig
After your machine takes a bit of time to compose the menus, you should see the Linux kernel menu system. The menu gives you the ability to choose which options are included in your kernel. After choosing these options, you'll be able to compile your kernel.
Compiling the kernelFirst, type in the following.
CODE
make bzImage
If you use LILO as your boot manager, then type the following.
CODE
make install
If you configured your kernel to use modules, which many people want to do, you'll need to type in the following command.
CODE
make modules
make modules_install
Hurry up and wait.
If it's your first time building a kernel, keep the boot disk from the first time you installed your OS. It'll come in handy if you did something wrong when configuring your kernel!
Building the kernel can take a lot of time, depending on your machine's specs. Think in terms of at least a half-hour and you won't be far off. It's a big plate of spaghetti for your computer to munch on, so be patient.
The good news is that Linux is great at multitasking, so you can go surf the Web while the kernel compiles. And have fun!
Keldyn
Mar 18 2004, 18:18
Not a bad guide. Perhaps if you could include a run down on the recommended options in the Linux Kernel Menu system? For newbies this can be a very daunting process. Remember. Always aim your guide towards first time users. Keep it as simplified as possible. Step by step instructions are a must!
Dessimat0r
Mar 18 2004, 18:22
You should really symlink linux-* to linux using ln -s /usr/src/linux-* /usr/src/linux first.
I'm not sure if you break module compatability by not doing it.
Sawyer12
Mar 18 2004, 18:36
Quote -
tar -xzvf linux-2.6.0.tar.gz
for that bit my linux file is a .bz2 file ? Im a total noob at linux here and ive just decided to give this recompiling thing a go. Can anyone help me ?
mercuryx013
Mar 18 2004, 18:48
Use jxvf instead of zxvf
Sawyer12
Mar 18 2004, 18:52
I get Unexpected EOF in archive error
I thought the one I posted
here was a little more indepth.
kongit
Mar 18 2004, 19:25
A couple of things:
1) you want to untar the file with
tar -xvjpf linux.whatever
or
tar -xvzpf linux.whatever
It keeps the permissions correct. I don't know if the p is necessary for compiling and using, but it is a good practive for kernels
2) With the latest 2.6 kernels you only need to type
make
after the menuconfig. It will make the bzlmage and the modules. then type
make modules_install
3) You don't need to symling to /usr/src/linux. This is for the kernel headers. Actually it is advisable to have this linked to an older 2.4 kernel or a 2.4 header set for backwards compatibility. It will not mess up compiling anything if you set it to a 2.4 kernel. However the 2.6 kernel's headers are slightly different than normally expected by the compiler and its libraries.
4) you can run
make install
for both lilo and grub if they are set right.
5) For the menuconfig I suggest that you get a listing of all your hardware on a piece of paper and make sure that it is very detailed. Additionally you need to check with the distro to make sure that you don't need to add in extra stuff to make that distro work right. I know you need to with gentoo.
6) lastly if you don't choose make install to install the kernel, don't overwrite the last one. and if you choose make install it will over write the last kernel installed if it has the same name. For example if you have installed a 2.6.3 kernel and want to change some things and don't do anything to the kernel source (ie add patches) and re make the 2.6.3 kernel and choose make install the original 2.6.3 kernel will be replaced with the newer one. However you can change this in the make file in the base kernel source directory. it is in the extraversion options. I suggest you patch the kernel source to see what I am talking about because most patches will change the append on the end of the image files and system map files.
7) I am sorry if I confused anyone. Compiling your own kernel isn't difficult. However you have to make sure you configure it correctly in the menuconfig. Wierd things can happen, and at worse a kernel panic. But these are all fixable. Try to have another kernel for just in case your new one fails. Then you can boot with it at lilo or grub and you can fix whatever error you made.
Quote -
I get Unexpected EOF in archive error
Most likely you downloaded a bad kernel source. download a new one and try again.
hornett
Mar 18 2004, 19:25
What about generate-modprobe.conf?
I've always had to do that in order to get everything working. Remember that you have to specify the output of the modprobe.conf file to the /etc dir tho.
Also I found make gconfig better than menuconfig, but I guess that is a matter of personal taste.
HellBender
Mar 18 2004, 19:28
Did you write that guide?
Sawyer12
Mar 21 2004, 11:43
I did all that and i dont see any difference.
Edit : As far as i know its still using my old (2.4) kernel. How do i tell it to use the new one ive just installed ? Any help would be greatly appricated.
from the console type uname -a
Sawyer12
Mar 21 2004, 12:57
That just tells me what version kernel im using. It says its using the 2.4 version. Is there any way of telling Linux to use the 2.6 version ive just installed ?
Infamous Cow
Mar 21 2004, 15:23
You have to restart your system
Sawyer12
Mar 21 2004, 15:29
Yeah Done that and theres no change
hornett
Mar 21 2004, 15:35
Make install should of updated lilo or grub for you. What distro are you using?
Sawyer12
Mar 21 2004, 15:41
Redhat, So are there any commands to use to tell linux to use the 2.6 kernel. Its created the 1.6 file in the /usr/src directory.
hornett
Mar 21 2004, 15:44
I'm not an expert but, like I think that like I said, make install will usually update grub for you so that the new kernel is listed on the statup menu.
For example here is my /etc/grub.conf file:
CODE
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,4)
# kernel /boot/vmlinuz-version ro root=/dev/hda5
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,4)/boot/grub/splash.xpm.gz
title Fedora Core (2.4.22-1.2174.nptl)
root (hd0,4)
kernel /boot/vmlinuz-2.4.22-1.2174.nptl ro root=LABEL=/ hdd=ide-scsi rhgb
initrd /boot/initrd-2.4.22-1.2174.nptl.img
title Fedora Core (2.4.22-1.2115.nptl)
root (hd0,4)
kernel /boot/vmlinuz-2.4.22-1.2115.nptl ro root=LABEL=/ hdd=ide-scsi rhgb
initrd /boot/initrd-2.4.22-1.2115.nptl.img
title Windows XP
rootnoverify (hd0,0)
chainloader +1
You see I have two different linux kernel entries (2.4.22-1.2174.nptl?& 2.4.22-1.2115.nptl)?
You could try manually adding the new kernel to the grub.conf file but to me it sounds like the install has not worked properly as it has always done this itself for me.
Sawyer12
Mar 21 2004, 16:03
So if i just tryed make_install again what would happen
The_Geek
Apr 9 2004, 03:10
For LILO try running the $lilo command from the terminal see if this adds the kernel to your config
Alternate
-----------
1.Assumes that you have "root" or "sudo"
Take a look in the "/boot" partition or file path depending on how you partitioned your drive.
use the following from your terminal of choice
$ls -F /boot
See what you have got there and double check that with your grub.conf file.
<snip>
kernel /boot/vmlinuz-2.4.22-1.2174.nptl ro root=LABEL=/ hdd=ide-scsi rhgb
initrd /boot/initrd-2.4.22-1.2174.nptl.img
title Fedora Core (2.4.22-1.2115.nptl)
root (hd0,4)
</snip>
Your output from the "ls" command should be able to be matched to one of your kernel entries,
ie..
If you have kernel named vmlinuz-2.4.22-1.nptl in your config file you should also have a file named
vmlinuz-2.4.22-1.nptl in your "/boot" directory. If for some chance your kernel image is not listed in
your "/boot" directory search for it then move it to your /"boot" directory manualy.
#Update your locate database
$updated
#Search for the kernel image
$locate vmlinuz-2.6.* | less
See what you can find, use the up & down cursor keys to navigate to the end of the results or until you
find what you are looking for, if you find the kernal image then move it to the "/boot" directory.
$mv -r /file.name/path/to file /boot
Repeat the above steps for the initrd image.
Now double check that your conf file and your kernel images line up. Restart the box to see if you get an option for the kernel at boot.
Hope this helps,
The_Geek
Juan4Ever
Apr 12 2004, 09:06
i did this question in other thread, but i guess i can repeat it here too because are pretty the same post...
wich is the diference in set to Built-in or Module on the kernel configuration when you enter the make menuconfig command?
that's all. thanks
kongit
Apr 12 2004, 10:10
built-in compiles the part into the kernel. modules compiles the part as an externel module that can be loaded or unloaded at any given time given the correct circumstances. Some parts need to be compiled in otherwise you risk a kernel panic, most doesn't and you need to experiment with those to determine the optimum settings for your computer.
hornett
Apr 12 2004, 10:27
Kongit - is there any speed advantage to using modules over compiled-in or do I have that back to front?
Specifically I'd like to improve the boot speed of the kernel as currently it takes 5 or 10 secs before my services etc start.
turbomonkeycock
Apr 12 2004, 12:50
I got a kernel panic :oops:

Couldnt mount the hard drive or something, which i imagine is pretty serious

Im sure it just needs a little bit more care and adaptation from me, and i'll try later, but if anyone has any tips that would be appreciated.
Oh, by the way, im using SuSE and have been told that i shouldnt of just compiled 2.6.0 randomly and needed a SuSE-adapted kernel. How correct is this? Sounds a load of rubbish to me
kongit
Apr 12 2004, 13:16
Quote - (hornett @ Apr 12 2004, 05:27)
Kongit - is there any speed advantage to using modules over compiled-in or do I have that back to front?
Specifically I'd like to improve the boot speed of the kernel as currently it takes 5 or 10 secs before my services etc start.
It depends. I for one have noticed no speed increase on boot with the exception of usb. I use hotplug (almost all distros do) so only the usb stuff that is plugged in at boot will be loaded. If you get your kernel properly configured and the modules that are supposed to load at boot properly configured then you will probably have the best in time for boot. However boot times for a normal linux user shouldn't matter as you stay booted for long periods of time.
It shouldn't make a difference between compiling in or as modules if everything is configured correctly for boot speed.
kongit
Apr 12 2004, 13:20
Quote - (gdub2611 @ Apr 12 2004, 07:50)
I got a kernel panic :oops:

Couldnt mount the hard drive or something, which i imagine is pretty serious

Im sure it just needs a little bit more care and adaptation from me, and i'll try later, but if anyone has any tips that would be appreciated.
Oh, by the way, im using SuSE and have been told that i shouldnt of just compiled 2.6.0 randomly and needed a SuSE-adapted kernel. How correct is this? Sounds a load of rubbish to me
The distro-specific kernels often have patches applied to them that the distro maker thinks need to be there. However it is entirely possible to get a non-distro kernel to load correctly. However jumping from a 2.4 kernel to a 2.6 kernel in many distros involves more than just upgrading the kernel. So far the only distro that I have had near complete success with doing that is slackware.
A major cause of kernel panics is an improperly configured kernel and not the kernel itself. You should be able to get a 2.6 kernel to load on almost any 2.4 based distro and get it to load, however somethings might not work correctly. I don't know the specifics on suse on how to get a 2.6 kernel to work with it, however I am positive that somewhere there is documentation on how to do it.
turbomonkeycock
Apr 12 2004, 14:53
My totally uneducated and unfounded conclusion is that it is to do with my boot loader settings. I basically ripped the current one and changed it where i saw fit but I did it in an excited and hurried state, i'll try and boot up back into 2.4 and see if i can fix it
Good tutorial btw

I had never made it this far before!
kemical
Apr 12 2004, 15:00
make install will not update lilo or grub automatically.
lilo you need to run /sbin/lilo to recycle the config once you have added the proper values in the lilo.conf file, grub, i dunno just add the correct values in the grub.conf file and youll have to restart anyways for th ekernel upgrade it will show up in the grub menu then. lilo on the other hand is different.
kongit
Apr 12 2004, 15:10
make install will install the kernel for fedora. And it adds an extra entry. It will also install for suse, however an extra entry isn't added to grub and it overwrites the last entry. In fact make install is the best way to install it in gentoo. However this won't work on every distro off the bat for grub, but it can be configured to (I don't know how). I haven't had any success with make install and lilo.
hornett
Apr 12 2004, 15:19
Quote - (gdub2611 @ Apr 12 2004, 13:50)
I got a kernel panic :oops:

Couldnt mount the hard drive or something, which i imagine is pretty serious

Im sure it just needs a little bit more care and adaptation from me, and i'll try later, but if anyone has any tips that would be appreciated.
Oh, by the way, im using SuSE and have been told that i shouldnt of just compiled 2.6.0 randomly and needed a SuSE-adapted kernel. How correct is this? Sounds a load of rubbish to me
You probably forgot to enable reiserfs support or whichever fs you are using ... they're not all enabled by default. Hope this helps.
kemical
Apr 12 2004, 17:30
when i followed the gentoo instructions i just ran make modules_install then added the entries manually guess this is sort of the same thing but i think i would prefer this way over make install
kongit
Apr 12 2004, 19:11
gentoo you can't do make install without a little bit of effort. It really isn't worth it for gentoo, however with fedora it makes an initrd and appends it to the grub automatically. I believe that in order for fedora to properly function it needs this, and it is far easier just to let the make install make and install it.
turbomonkeycock
Apr 16 2004, 13:31
I think I enabled support for all file systems! Is this bad? Is there a way that I can find out what FS I am using? And also how do i find the hard drive that it should load from? I believe that its hda6 on my computer but thats a bit weird as i have one hard drive
kongit
Apr 16 2004, 13:35
Adding support for all filesystems should not mess anything up, however it will affect the kernel size and might affect performance. If your linux is working you can check your fs in /etc/fstab. hda6 is the 6th partition on the 1st drive.
vuerro
Aug 15 2004, 16:15
after doing;
CODE
make bzImage && make install modules modules_install
i didn't get the results I needed - probably because I needed to move some files from the usr/src directory (maybe an addition for the how-to?)
so I did the following -> make rpm
and it did (after taking a hour) and places it in /usr/src/redhat/RPMS/i386/ (and a src.rpm in /usr/src/redhat/SRPMS/)
so I was able to rpm the kernel (rpm -ihv kernel-..)
and I found a vmlinux matching the kernel version in /boot
and after that I needed to make a custom initrd using /sbin/initrd -something- (on a winbox now..

) because I have a RAID controller card installed..
manually edited the /boot/grub/grub.conf file
(copied previous linux startup line's and adjusted accordingly)
et voila

new kernel up and running
it takes a bit longer but it worked twice for me..
it would be good if someone went over make menuconfig since lots of people are having problems with kernel panics and such. also, is there any way you can find .config files that are ready to go without make menuconfig? i'm sure that would make life a little bit easier for some.
after the kernel is put in /usr/src/ i make a symlink from the new kernel dir to linux.
then i copy my old .config to the new directory.
I then run a make menuconfig to check over the options
I then mount my /boot partition.
I then run this command: make; make modules modules_install install
I also run gentoo and grub as my bootloader as i find it is more robust than lilo.
btw, i have an old .config here:
http://3nd3r.info/.config
Is it possible to save the current configuration of my precompiled kernel that came with Mepis and works beautifully with my hardware, and be able to use it with a newer self-compiled kernel? That way I can take out what I know for sure I don't need and yet still maintain a fully functional kernel that supports my needs.I have compiled from scratch with Gentoo before, but I really would rather not get into that again since it can be frustrating
mr_demilord
May 5 2005, 09:45
You can better use the kernel of your distro, every version of the kernel has other compiling option RTFM, you cannot compile a 2.6 kernel with 2.4 kernel options without screwing things up.
mr_demilord
Oct 8 2005, 16:42
QUOTE
tar -xzvf linux-2.6.0.tar.gz
cd linux-2.6.0
make menuconfig
After your machine takes a bit of time to compose the menus, you should see the Linux kernel menu system. The menu gives you the ability to choose which options are included in your kernel. After choosing these options, you'll be able to compile your kernel.
Compiling the kernel
First, type in the following.
make bzImage
If you use LILO as your boot manager, then type the following.
make install
If you configured your kernel to use modules, which many people want to do, you'll need to type in the following command.
make modules
make modules_install
This wont work, the proper way is to check your current .conf file of your distro, most distros uses specific options, like the initrd ramdisk size, SuSE uses automount for example.
The proper way is to always use
make clean && make mrproper
Never asume that the kernel is clean after a download!
Check if you use make menuconfig that it doesn't load your current .conf file, move it if necessary, otherwise you get all kinds of depraced warnings.
A distro kernel is a modified kernel with other options the vanilla kernel hasn't.
if you are ready and modified the kernel do
make bzImage
make modules
make modules_install
Then do make install.
Check the grub.conf
Remove the symlinks in the /boot dir and create new ones and point them to the old kernel.
reboot
somethingthatrhymes
Jan 17 2006, 19:20
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.