|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Operating Systems > Linux, Unix | |
[FAQ] How-to compile a custom kernel
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | ||||||||||||||
|
Photography nut
![]() |
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 The # represent the number of what ever the newest kernel is. Code:
tar zxvf linux-2.6.#.tar.gz Code:
tar xvjf linux-2.6.#.tar.bz2 Code:
cd linux-2.6.# 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.#.# Code:
mv /boot/bzImage /boot/vmlinuz 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 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 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:
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
Last edited by dangerousHobo : 02-10-08 at 04:28 PM |
||||||||||||||
|
|
|
|
#2 (permalink) | |||||||||||||
|
Angry Linux Gamer
![]() |
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.
__________________
CPU-Z Validation GPU-Z Validation FGLRX look out thread Linux ATI driver installation ATI Overclocking in Linux ATI open source driver installation
|
|||||||||||||
|
|
|
|
#3 (permalink) | ||||||||||||||
|
Photography nut
![]() |
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:
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
|
||||||||||||||
|
|
|
|
#4 (permalink) | ||||||||||
|
makin' the big noise
![]() |
Quote:
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!
__________________
There are two muffins in an oven. One muffin says, "Wow! Its getting hot in here!" The other muffin yells, "Ahhh! A talking muffin!!"
Like cars? Check out http://www.carforum.net! || Like dogs? Check out http://www.dogforum.org! I get a lot of private messages - I will get back to you, I promise!
Last edited by Chipp : 05-29-07 at 10:57 PM |
||||||||||
|
|
|
|
#5 (permalink) | |||||||||||||||
|
Photography nut
![]() |
I have that in there, but it may not be clear. I'll work on re-wording it.
Quote:
__________________
"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:
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
|
|||||||||||||||
|
|
|
|
#6 (permalink) | |||||||||||||
|
Intel Overclocker
Join Date: Feb 2007
Location: Dark Side of the Moon
Posts: 240
Rep: 15
![]() Unique Rep: 14
Trader Rating: 0
|
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:
|
|||||||||||||
|
|
|
|
|
#7 (permalink) | ||||||||||||||
|
Photography nut
![]() |
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:
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
|
||||||||||||||
|
|
|
|
#8 (permalink) | ||||||||||||||
|
Intel Overclocker
Join Date: Feb 2007
Location: Dark Side of the Moon
Posts: 240
Rep: 15
![]() Unique Rep: 14
Trader Rating: 0
|
Quote:
__________________
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:
|
||||||||||||||
|
|
|
|
|
#9 (permalink) | ||||||||||||||
|
Photography nut
![]() |
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:
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
|
||||||||||||||
|
|
|
|
#10 (permalink) | |||||||||||||
|
Intel Overclocker
Join Date: Feb 2007
Location: Dark Side of the Moon
Posts: 240
Rep: 15
![]() Unique Rep: 14
Trader Rating: 0
|
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:
|
|||||||||||||
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|