Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Operating Systems > Linux, Unix

Reply
 
LinkBack Thread Tools
Old 05-29-07   #1 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,484

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 719
Trader Rating: 0
Default [FAQ] How-to compile a custom kernel

How-to compile a custom kernel.

System used: Slackware 11


You will need root user privileges to do the following that this guide covers.

First you need to download a kernel. You can find a list of kernels at www.kernel.org. After you have downloaded the kernel, have it to the directory /usr/src.

The next thing you are going to want to do is uncompress the kernel package. If your DE(KDE, Gnome, Xfce) supports it you can right click on it and uncompress(extract) it.
The other way in by the terminal, open a terminal (console) and move to the directory of the package.
Code:
cd /usr/src
and then type: (if the package was compressed with gzip. Would have the extension is .tar.gz or .tgz)
The # represent the number of what ever the newest kernel is.
Code:
tar zxvf linux-2.6.#.tar.gz
(if the package was compressed with bzip2, Would have the extension is .tar.bz2)
Code:
tar xvjf linux-2.6.#.tar.bz2
Now that the kernel package is extracted, a new folder was created. Move into the new folder.
Code:
cd linux-2.6.#
Now in the terminal you have a few options to choose from in terms of configuring the kernel.

make gconfig - Gtk based configuration tool (available in kernels 2.6 and up).

make qconfig - Same as gconfig, but uses the Qt widget set (available in kernels 2.6 and up).

make menuconfig - Uses menu boxes to configure the kernel.

make xconfig - Uses X window for the gui to the configuration tool (available in kernels 2.6 and up)..

In the terminal type either one of the configuration options you wish to use.
Now is the part that can be a pain, go through the options and choose what you need. If it is your first time compiling the kernel, than this step may take you while (don't worry the more you compile your own kernel, the faster you'll be able to go through it).
Once you are done, click save and exit. Now a new ".config" file has been created in the current directory. This file is important if you ever what to re-compile the kernel, but don't want to go through ever thing again; you can load that file and it'll load the previous kernel configuration. (you load it after you start gconfig, menuconfig, etc).

Now in the terminal type make and then once that is done type make modules_install. Then finally type make bzImage.

Now copy the "bzImage" over to the /boot directory (in the last few lines of the command make bzImage, it gives you the path to the bzImage)
Rename the file /boot/vmlinuz (may be something like vmlinuz-2.#.#) to something like: (Replace # with what ever the old kernel was)
Code:
 mv /boot/vmlinuz /boot/vmlinuz-2.#.#
Now rename the bzImage that you copied over to the directory /boot.
Code:
 mv /boot/bzImage /boot/vmlinuz
Now in /boot you have the new kernel and the old one that you know worked.

Now finally change the grub boot loader to boot the new kernel. Usually found in /boot/grub/menu.list

I highly recommend that when you add to the grub menu.list, you have two options to boot into for the OS that you just compiled the kernel for. One that boots the OS using the old kernel (the one you know is good), and the new one. This way if you forgot some important configuration for the kernel, you can still boot into the old kernel, so you can re-configure the new kernel.
MAKE SURE that you change the line that begins with "kernel" and edit /boot/### with what ever you renamed the old kernel, else you won't be able to boot into it. Then copy that boot configuration option and past it under the original and edit the line beginning with "kernel" and change /boot/### to what ever you named the new kernel.

Example:
Lets say my original kernel image is called /boot/vmlinuz. I compiled my kernel and moved to /boot. Now I renamed my original kernel from /boot/vmlinuz to /boot/vmlinuz-linux-2.4.33.3. Then I renamed the new kernel from /boot/bzImage to /boot/vmlinuz.

The change in my grub menu.lst file would be like so:

Original /boot/grub/menu.lst (part of it)
Code:
title        Slackware Linux (Slackware 11.0.0) (on /dev/sda6)
root        (hd0,5)
kernel        /boot/vmlinuz root=/dev/sda6 
savedefault
boot
NEW /boot/grub/menu.lst (part of it)
NOTE the bold lines.
Code:
# Original Kernel
title        Slackware Linux (Slackware 11.0.0) 2.4.33.3
root        (hd0,5)
kernel        /boot/vmlinuz-linux-2.4.33.3 root=/dev/sda6 
savedefault
boot

# Option to boot into the new kernel
title        Slackware Linux (Slackware 11.0.0) 2.6.18
root        (hd0,5)
kernel        /boot/vmlinuz root=/dev/sda6 
savedefault
boot
After this you can reboot into your new kernel.


Just patching a kernel
If you just want to patch your kernel to the newest kernel release, you can find kernel patchs at www.kernel.org and here, which are patches by Con Kolivas.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD

Last edited by dangerousHobo : 02-10-08 at 05:28 PM
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 05-29-07   #2 (permalink)
Angry Linux Gamer
 
Melcar's Avatar
 
amd ati

Join Date: Sep 2005
Location: L.A.
Posts: 6,135

Rep: 499 Melcar is a proven memberMelcar is a proven memberMelcar is a proven memberMelcar is a proven memberMelcar is a proven member
Unique Rep: 335
Trader Rating: 1
Default

Good guide. I constantly see guys recommending that you build your own kernel, but rarely does anybody give precise instructions on how to do it.

System: Magicbox
CPU
Phenom X4 9650 @ 3GHz
Motherboard
DFI DK 790FX-M2RS
Memory
2x2GB G.Skill DDR2 1000
Graphics Card
HD4850 @ 750/1100
Hard Drive
WD 640GB SATAII / Seagate 160GB SATAII
Sound Card
Audigy 2ZS
Power Supply
OCZ GameXStream 700W
Case
Chenming 602 server case
CPU cooling
Apogee
GPU cooling
MCW60
OS
Ubuntu 64bit / WindowsXP 32bit
Monitor
Acer X193W+BD 19" WS LCD (1680x1050)
Melcar is offline Overclocked Account   Reply With Quote
Old 05-29-07   #3 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,484

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 719
Trader Rating: 0
Default

Thank you. The guide is still a bit rough I feel, but I plan to add to it here and there.
Also want to add the Ubuntu and Fedora ways of re-compiling the kernel. This way will work for every dirsto though, to my knowledge.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 05-29-07   #4 (permalink)
Me? Oh, I live here.
 
Chipp's Avatar
 
intel ati

Join Date: Dec 2004
Location: Tampa Bay
Posts: 15,538
Blog Entries: 29

FAQs Submitted: 18
Folding Team Rank: 475
Hardware Reviews: 3
Trader Rating: 12
Default

Quote:
Originally Posted by dangerousHobo View Post
Thank you. The guide is still a bit rough I feel, but I plan to add to it here and there.
Also want to add the Ubuntu and Fedora ways of re-compiling the kernel. This way will work for every dirsto though, to my knowledge.
It should. Nothing you used was distro-specific.

One thing I would change though is that instead of replacing the old kernel in the boot loader, copy it's settings to a new entry, then change the name to the new kernel. That way if you messed up the new kernel config, you still have easy access to your old kernel as a backup.

Nice guide though! Manual compiles are not too easy to make understandable!

System: OC'd Once Again
CPU
Intel E2160 @ 3.4ghz
Motherboard
Abit IP35-E
Memory
2x1gb OCZ Plat Rev. 2 DDR2
Graphics Card
Radeon 3850
Hard Drive
WD 640gb AAKS / 250gb Seagate 7200.9
Sound Card
E-Mu 0404 USB / M-Audio Firewire Solo
Power Supply
CoolerMaster RM-500
Case
CoolerMaster Centruion 5
CPU cooling
Ultra90 (lapped) and Sanyo Denki 92mm
GPU cooling
Zalman VF900
OS
Windows 7 RC1
Monitor
Viewsonic VE175b

Last edited by Chipp : 05-29-07 at 11:57 PM
Chipp is offline I fold for Overclock.net Overclocked Account Chipp's Gallery   Reply With Quote
Old 05-29-07   #5 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,484

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 719
Trader Rating: 0
Default

I have that in there, but it may not be clear. I'll work on re-wording it.
Quote:
I recommend that when you add to the grub menu.list, you have two options to boot into for the OS that you just compiled the kernel for. One that boots the OS using the old kernel (the one you know is good), and the new one. This way if you forgot some important configuration for the kernel, you can still boot into the old kernel, so you can re-configure the kernel.
MAKE SURE that you change the line that begins with "kernel" and edit /boot/### with what ever you renamed the old kernel, else you won't be able to boot into it.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 05-30-07   #6 (permalink)
Intel Overclocker
 
mariogreymist's Avatar
 
intel nvidia

Join Date: Feb 2007
Location: Dark Side of the Moon
Posts: 240

Rep: 15 mariogreymist Unknown
Unique Rep: 14
Trader Rating: 0
Default

I can't find the grubmenu list anywhere. I've done every step up to that, and still 2.4.33.3 is loading. How the hell do I find it?
__________________
Anonymous does not forgive.

"Deciding between a Republican and a Democrat is like being picky about the flavor of the Kool-aid that Jim Jones is offering you." - me

Quote:
A good day ain't got no rain. A bad day's when I lie in bed and think of things that might have been.
Paul Simon

System: Does the trick
CPU
Core 2 Duo E6600 @3.08Ghz
Motherboard
MSI P6n SLI 650i
Memory
2x1Gb GSkill & 2X512mb Kingston PC6400
Graphics Card
EVGA 8800GTS 320
Hard Drive
WD 250GB SATA 7200RPM + Seagate 7200.10 80gb
Power Supply
Mad Dog 550
Case
Antec Sonata II
CPU cooling
Zalman 7000 W adapter
GPU cooling
Stock
OS
Vista home premium 64
Monitor
37' Westinghouse 1080P hdtv
mariogreymist is offline   Reply With Quote
Old 05-30-07   #7 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,484

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 719
Trader Rating: 0
Default

B/c Slackware is basiclly one of the only distros still using LILO as its boot loader instead of Grub. So you'll have to edit /etc/lilo.conf.

Would look something like this:
default="linux"
boot=/dev/hda
prompt
nowarn
timeout=150
message=/boot/message
menu-scheme=wb:bw:wb:bw
image=/boot/vmlinuz
label="linux"
root=/dev/hda8
initrd=/boot/initrd.img
append="devfs=nomount acpi=ht"
read-only
other=/dev/hda1
label="windows"
table=/dev/hda

other=/dev/hda2
label="windows1"
table=/dev/hda

image=/boot/vmlinuz
label="failsafe"
root=/dev/hda8
initrd=/boot/initrd.img
append="failsafe acpi=ht devfs=nomount"
read-only

image=/boot/vmlinuz
label="FC4-linux"
root=/dev/hda11
initrd=/boot/initrd.img
append="devfs=nomount acpi=ht"


Would add something like the following to it:
#What ever the name for the new kernel is
image=/boot/vmlinuz-new
label="Slackware 2.6.##"
root=/dev/hd##

#What ever the name for the old kernel is
image=/boot/vmlinuz-2.4.33.3
label="Slackware 2.4.33.3"
root=/dev/hd##

Then run the command lilo after editing and saving the file.
I don't use lilo even though I use slackware, I use the grub loader from my Arch install. So I'm not 100% sure on the lilo syntax but it should be very close to that if not it.
I believe you can run liloconfig on slackware too, to configure lilo.
However you can install grub on Slackware.
download: ftp://slackware.oregonstate.edu/pub/....97-i486-2.tgz

then type: installpkg grub-version.tgz
then: grubconfig

Now you have grub on slackware.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 05-30-07   #8 (permalink)
Intel Overclocker
 
mariogreymist's Avatar
 
intel nvidia

Join Date: Feb 2007
Location: Dark Side of the Moon
Posts: 240

Rep: 15 mariogreymist Unknown
Unique Rep: 14
Trader Rating: 0
Default

Quote:
Originally Posted by dangerousHobo View Post
However you can install grub on Slackware.
download: ftp://slackware.oregonstate.edu/pub/....97-i486-2.tgz

then type: installpkg grub-version.tgz
then: grubconfig

Now you have grub on slackware.
Will that automatically replace Lilo, or will I need to do more?
__________________
Anonymous does not forgive.

"Deciding between a Republican and a Democrat is like being picky about the flavor of the Kool-aid that Jim Jones is offering you." - me

Quote:
A good day ain't got no rain. A bad day's when I lie in bed and think of things that might have been.
Paul Simon

System: Does the trick
CPU
Core 2 Duo E6600 @3.08Ghz
Motherboard
MSI P6n SLI 650i
Memory
2x1Gb GSkill & 2X512mb Kingston PC6400
Graphics Card
EVGA 8800GTS 320
Hard Drive
WD 250GB SATA 7200RPM + Seagate 7200.10 80gb
Power Supply
Mad Dog 550
Case
Antec Sonata II
CPU cooling
Zalman 7000 W adapter
GPU cooling
Stock
OS
Vista home premium 64
Monitor
37' Westinghouse 1080P hdtv
mariogreymist is offline   Reply With Quote
Old 05-31-07   #9 (permalink)
Photography nut
 
dangerousHobo's Avatar
 
amd nvidia

Join Date: Dec 2005
Location: ~/
Posts: 3,484

Rep: 409 dangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven memberdangerousHobo is a proven member
Unique Rep: 215
FAQs Submitted: 7
Folding Team Rank: 719
Trader Rating: 0
Default

That will over write lilo.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn

Try out the latest Programming Challenge
Quote:
Originally Posted by Melcar
Only one reasonable way to solve this... a dance off.

CPU-Z Validation
@ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15


Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More

System: Anomaly
CPU
Athlon 3700 SD(KACAE)0546 @3.02ghz
Motherboard
DFI UT nF4 Ultra-D
Memory
G.Skill 2x512 UTT(BH-5)
Graphics Card
evga 6800gs
Hard Drive
Maxtor 300GB + WD 250GB
Sound Card
onboard
Power Supply
Ultra 500w V-series
Case
one from Ultra
CPU cooling
Big Typhoon
GPU cooling
80mm fan mounted on
OS
Arch64 & Slackware 12.1
Monitor
Acer AL2216W 22" WS LCD
dangerousHobo is offline I fold for Overclock.net Overclocked Account dangerousHobo's Gallery   Reply With Quote
Old 05-31-07   #10 (permalink)
Intel Overclocker
 
mariogreymist's Avatar
 
intel nvidia

Join Date: Feb 2007
Location: Dark Side of the Moon
Posts: 240

Rep: 15 mariogreymist Unknown
Unique Rep: 14
Trader Rating: 0
Default

Another question - does the "make" command after configuring the kernel also take on the function of the old "make modules" or do I still need to do both before "make modules_install"?

btw - you left an "l" off install in the "make modules_install" commoand in the orignal faq. (anal boy likes things letter perfect in instructions)
__________________
Anonymous does not forgive.

"Deciding between a Republican and a Democrat is like being picky about the flavor of the Kool-aid that Jim Jones is offering you." - me

Quote:
A good day ain't got no rain. A bad day's when I lie in bed and think of things that might have been.
Paul Simon

System: Does the trick
CPU
Core 2 Duo E6600 @3.08Ghz
Motherboard
MSI P6n SLI 650i
Memory
2x1Gb GSkill & 2X512mb Kingston PC6400
Graphics Card
EVGA 8800GTS 320
Hard Drive
WD 250GB SATA 7200RPM + Seagate 7200.10 80gb
Power Supply
Mad Dog 550
Case
Antec Sonata II
CPU cooling
Zalman 7000 W adapter
GPU cooling
Stock
OS
Vista home premium 64
Monitor
37' Westinghouse 1080P hdtv
mariogreymist is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -4. The time now is 06:34 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.17229 seconds with 8 queries