You are on page 1of 42

How to: Compile Linux kernel 2.

6 - nixCraft

1 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

About
Contact us
Forums
Home
Linux How-to & Tutorials
Shell Scripts
RSS/Feed

nixCraft

How to: Compile Linux kernel 2.6


by NIX Craft on September 29, 2005 154 comments LAST UPDATED May 5, 2012
in CentOS, Debian Linux, GNU/Open source
Compiling custom kernel has its own advantages and disadvantages.
However, new Linux user / admin nd it dicult to compile Linux
kernel. Compiling kernel needs to understand few things and then just
type couple of commands. This step by step howto covers compiling
Linux kernel version 2.6.xx under Debian GNU Linux. However,
instructions remains the same for any other distribution except for
apt-get command.

Step # 1 Get Latest Linux kernel code


Visit http://kernel.org/ and download the latest source code. File name would be linuxx.y.z.tar.bz2, where x.y.z is actual version number. For example le inux-2.6.25.tar.bz2
represents 2.6.25 kernel version. Use wget command to download kernel source code:
$ cd /tmp
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2

Note: Replace x.y.z with actual version number.

Step # 2 Extract tar (.tar.bz3) le


Type the following command:
# tar -xjvf linux-2.6.25.tar.bz2 -C /usr/src
# cd /usr/src

Step # 3 Congure kernel


Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

2 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Before you congure kernel make sure you have development tools (gcc compilers and
related tools) are installed on your system. If gcc compiler and tools are not installed
then use apt-get command under Debian Linux to install development tools.
# apt-get install gcc

Now you can start kernel conguration by typing any one of the command:
$ make menucong - Text based color menus, radiolists & dialogs. This option
also useful on remote server if you wanna compile kernel remotely.
$ make xcong - X windows (Qt) based conguration tool, works best under KDE
desktop
$ make gcong - X windows (Gtk) based conguration tool, works best under
Gnome Dekstop.
For example make menucong command launches following screen:
$ make menuconfig

You have to select dierent options as per your need. Each conguration option has
HELP button associated with it so select help button to get help.

Step # 4 Compile kernel


Start compiling to create a compressed kernel image, enter:
$ make

Start compiling to kernel modules:


$ make modules

Install kernel modules (become a root user, use su command):


$ su # make modules_install

Step # 5 Install kernel


So far we have compiled kernel and installed kernel modules. It is time to install kernel
itself.
# make install

It will install three les into /boot directory as well as modication to your kernel grub
conguration le:
System.map-2.6.25
cong-2.6.25
vmlinuz-2.6.25

Step # 6: Create an initrd image


Type the following command at a shell prompt:
# cd /boot
# mkinitrd -o initrd.img-2.6.25 2.6.25

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

3 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

initrd images contains device driver which needed to load rest of the operating system
later on. Not all computer requires initrd, but it is safe to create one.

Step # 7 Modify Grub conguration le - /boot/grub


/menu.lst
Open le using vi:
# vi /boot/grub/menu.lst
title
root
kernel
initrd
savedefault
boot

Debian GNU/Linux, kernel 2.6.25 Default


(hd0,0)
/boot/vmlinuz root=/dev/hdb1 ro
/boot/initrd.img-2.6.25

Remember to setup correct root=/dev/hdXX device. Save and close the le. If you think
editing and writing all lines by hand is too much for you, try out update-grub command
to update the lines for each kernel in /boot/grub/menu.lst le. Just type the command:
# update-grub

Neat. Huh?

Step # 8 : Reboot computer and boot into your new


kernel
Just issue reboot command:
# reboot

For more information see:


Our Exploring Linux kernel article and Compiling Linux Kernel module only.
Ocial README le has more information on kernel and software requirement to
compile it. This le is kernel source directory tree.
Documentation/ directory has interesting kernel documentation for you in kernel
source tree.
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!
Featured Articles:
30 Cool Open Source Software I Discovered in 2013
30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
Top 30 Nmap Command Examples For Sys/Network Admins
25 PHP Security Best Practices For Sys Admins
20 Linux System Monitoring Tools Every SysAdmin Should Know
20 Linux Server Hardening Security Tips
Linux: 20 Iptables Examples For New SysAdmins
Top 20 OpenSSH Server Best Security Practices
Top 20 Nginx WebServer Best Security Practices
20 Examples: Make Sure Unix / Linux Conguration Files Are Free From Syntax
Errors

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

4 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

15 Greatest Open Source Terminal Applications Of 2012


My 10 UNIX Command Line Mistakes
Top 10 Open Source Web-Based Project Management Software
Top 5 Email Client For Linux, Mac OS X, and Windows Users
The Novice Guide To Buying A Linux Laptop
{ 154 comments read them below or add one }
1 Anonymous March 7, 2006 at 1:40 am
According to the kernel documentation, the kernel should be compiled using gcc
2.95.x, with x >= 3. apt-get install gcc under debian gives you a recent gcc
(version > 4).
Reply
2 Matka March 17, 2012 at 6:31 pm
http://theos.in/desktop-linux/tip-that-matters/exploring-linux-kernel/
Reply
3 nixcraft March 7, 2006 at 9:52 am
It works with gcc version >= 4.0.
gcc version
gcc (GCC) 4.0.3 20060212 (prerelease) (Debian 4.0.2-9)
uname -a
Linux debian 2.6.15.4 #1 PREEMPT Fri Feb 17 20:46:04 IST 2006 i686 GNU/Linux
I have compiled above kernel using gcc 4.0.2-9. INSTALL le may be not updated.
Reply
4 Anonymous March 17, 2006 at 9:47 pm
Thanks a lot Gabber Anna,
Its works for me :-))
Reply
5 nixcraft March 17, 2006 at 11:25 pm
LOL
Note sure who are you?
But you bring back some old memories
Take care buddy :)
Reply
6 Learn Hacking March 25, 2007 at 7:57 am
Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

5 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

any guess about boot loader?


Reply
7 debianusr August 18, 2007 at 5:57 pm
After building the kernel and updating grub Ive rebooted the new kernel
successfully. Now I am wondering if this process includes updating the kernel
header les in /usr/include/. If not, what is the best way to do that and should any
new directories be added to ld.so.conf so I can update glibc?
Reply
8 nixCraft August 18, 2007 at 6:55 pm
If you also upgraded kernel-devel and headers package you should get updates. No
need to upgrade ld.so.conf or cache
Reply
9 Animesh October 13, 2007 at 4:59 pm
Info

Kernel 2.6.23 has issues with kernel headers. If you have distros like fedora it
gonna give up some wierd xdep.c error messages.
Some forums say you need to have 2.4 headers for compiling it. Kernel header is a
huge mess scattered around and well serious debates have gone down the drain
http://kerneltrap.org/node/6536
Reply
10 Pradeep April 30, 2008 at 3:04 pm
Does this kernel support RHEL4 update 5
I am using kernel 2.6.9-55.EL can i upgade the
Reply
11 dushyant May 9, 2008 at 11:50 am
How much time does it take approximately?
Reply
12 Krishna Priya Bandyopadhyay May 15, 2008 at 6:45 pm
i am trying it on mandriva 2008.i can not do $ make menucong.is there any
option to do that.please help me to get out of this as soon as possible.i wonder

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

6 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

there is no option of make.


Reply
13 Pothikan Suresh June 4, 2008 at 8:05 am
Priya,
To make make work, go inside the kernel directory ie., /usr/src/. There, u can nd
the make le. Now, just give $make menucong. It will work. :)
Reply
14 Krishna Priya Bandyopadhyay June 20, 2010 at 7:42 pm
Thanks for ur reply.Im working ne now with the walk through given by you
Krishba Priya bandyopadhyay
Reply
15 Blues June 4, 2008 at 11:28 pm
With 2.6 kernel there is no need for make modules. make builds kernel and
modules. Have you ever read the README in kernel source directory?
Reply
16 Anil Kumar Jena June 24, 2008 at 8:38 pm
It will take near about 1 to 1.30 hours. for complete
installation
Reply
17 Lin June 25, 2008 at 9:38 am
I tried make 2.6.25 in my desktop (FC5, kernel version 2.6.15), everything goes
okay, but failed to boot the new kernel image with the follow error messages:
PCI: BIOS Bug: MCFG area at e0000000 is not E820-reserved
PCI: Not using MMCONFIG
Read Hat nash version 5.0.32 Starting
mount: error mounting /dev/root on /sysroot at ext3: No such device
.
In initrd.img le, I found no libata.ko or any other .ko modules are added before
mkrootdev.
Is this problem caused by incorrect or even no HDD controller driver loaded? I did
not see appropriate entry for libata in .cong le. Do you guys have any suggestion
on make it through?
Thanks.
Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

7 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

-Lin
Reply
18 Logic July 8, 2008 at 12:22 am
About the 4th step, as the make help says: you do not need to do make modules
again, so when using make it already compiles the modules.
:D
Reply
19 Ramkey October 9, 2008 at 11:22 pm
Lin,
Did your problem sorted out?Thans
Reply
20 Rohit Awasthi October 10, 2008 at 1:24 pm
Hi.. wt if somethin goes wrong is there any way to get OS to its former stage, say
( backup or uninstall Kernel or something ).. or will need to install whole OS
again
Reply
21 Ravi October 31, 2008 at 5:42 am
I followed the above steps in order to compile Linux kernel linux-2.6.27 but when
tried to boot my system from latest compiled kernel got the Kernel Panic error
which says cant nd
le system /boot/root at the start.
please suggest
Reply
22 Jared November 2, 2008 at 9:12 pm
This is a nice tutorial, but I have a note to make. On my installation, Ubuntu 8.04.1
64-bit, the command in Step # 6 is mkinitramfs instead of mkinitrd.
Cant wait to try out my new kernel
Reply
23 Abdul April 12, 2011 at 10:51 am
That helped me Thanks!!!!!!!

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

8 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Reply
24 same November 2, 2008 at 10:45 pm
the same thing happened to me as ravi.
Reply
25 Roman December 7, 2008 at 9:20 am
I have compiled custom kernel and I am missing in /boot directory cong-2.6 le.
What have I done wrong? I see cong les from old kernel there. thanks in
advance.
Reply
26 saga December 14, 2008 at 3:43 pm
you have compiled a upstream kernel.How should i compile distribution specic
kernels,like if i install fedora it has its kernel source in /usr/src/, fedora community
might have added its own patches.Will the steps described in this article work for
distribution specic kernels?
Reply
27 anand December 21, 2008 at 4:06 am
Except for step where you create the initrd img le, rest of the steps explained
here worked ne. The Kernel version I tried was 2.6.27.10 and the linux box had
ubuntu 8.10 installed.
On ubuntu if you try to use mkinitrd you might get the message No command
found. Try using mkinitramfs instead. It worked perfectly ne.
Reply
28 Maker December 22, 2008 at 5:51 pm
There is no such thing as bz3.
Reply
29 Axon December 28, 2008 at 7:57 am
Its cool.
Thanks alot NIXTCRAFT.
Reply
30 Carnes December 29, 2008 at 9:53 am
I tried to cheat and copied over an older .cong.. broke something and had to redo
all the options by hand : /

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

9 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Anyways, the instructions worked great with Gentoo. I had to emerge mkinitrd
but otherwise everything went very quickly, maybe 20 min to compile everything
(very short in Gentoo world).
I suggest everyone keep their old kernel and a lilo/grub option for it just incase :)
Most of the problems in the comments seem to be from misconguring the kernel.
If you arent sure what your hardware is or dont have the time to run through
every option. I suggest you pop in a live cd and copy /proc/cong.gz to use as
your base cong (gzip -d cong.gz will uncompress it).
If your system is already unusable, pop in a live cd and try the following as root:
cd /
mkdir /mnt/xme
mount /dev/ROOTDRIVE /mnt/xme
mount /dev/BOOTDRIVE /mnt/xme/boot
mount -t proc proc /mnt/xme/proc
chroot /mnt/xme /bin/bash
That should put you back into your computer to compile/x whatever.
Reply
31 benny lootens January 4, 2009 at 2:40 am
ive just build the 2.6.28 kernel on ubuntu 8.04 LTS and its working like a charm.
It was required, as I had some troubles installing my 500 GB Samsung drive that
was attached to a Trust eSATA IF-3300 card. Thanks for this great tutorial !!
Reply
32 Otto January 6, 2009 at 6:41 pm
You dont need make modules anymore. I compiled a few times the last days and
just make && make modules_install will do.
Reply
33 Akash January 7, 2009 at 12:59 pm
Following error occured during make command of compilation step for linux 2.6.23
make: *** [.tmp_vmlinux1] Error 1
Plz provide me solution for it.
Thanks
Akash
Reply
34 Akash January 7, 2009 at 1:06 pm
make command error:
make: *** [.tmp_vmlinux1] Error 1

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

10 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Kindly suggest solution


regards
Akash
Reply
35 Pekka January 14, 2009 at 11:47 am
Hi
On Debian the kernel compile is much more straightforward than this describes.
First you of course need to take the kernel source. Then:
1. make menucong (or whatever you want)
2. make-kpkg revision kernel_image
3. Install the resulting .deb package using dpkg.
The debian package management system then knows about your custom kernel and
it handles all needed actions to get the kernel properly working. For example initrd
is done automagically if needed.
I compile the root le system and the way to access it directly into kernel and
customize the kernel sharply to the computer. That way you wont need initrd
anymore :) and the machine boots quite fast, because the chipset drivers are active
from wery beginning of booting.
Reply
36 komal February 7, 2009 at 4:05 pm
I compiled the whole thing and then booted ..I see the updated version of fedora
but when I try to run it ..it says kernal panic and doesnt proceed any further
Reply
37 Anonymous February 17, 2009 at 9:04 am
If you have multiple CPU-kernels, youd consider using the -j option for make, for
example make -j5 , which will use 5 instance of make to built the process. This will
speed up things, nice tip I got on IRC :)
Reply
38 kontinumas February 18, 2009 at 7:37 pm
Hello!
got some problems while compiling new kernel using make. Error below:

{standard input}: Assembler messages:

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

11 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

{standard input}:745: Error: suffix or operands invalid for `mov'


{standard input}:746: Error: suffix or operands invalid for `mov'
{standard input}:950: Error: suffix or operands invalid for `mov'
{standard input}:951: Error: suffix or operands invalid for `mov'
{standard input}:1024: Error: suffix or operands invalid for `mov'
{standard input}:1025: Error: suffix or operands invalid for `mov'
{standard input}:1120: Error: suffix or operands invalid for `mov'
{standard input}:1121: Error: suffix or operands invalid for `mov'
{standard input}:1208: Error: suffix or operands invalid for `mov'
{standard input}:1220: Error: suffix or operands invalid for `mov'
make[1]: *** [arch/i386/kernel/process.o] Error 1
make: *** [arch/i386/kernel] Error 2

gcc version 4.1.2


debian etch
got some ideas? thanx
Reply
39 trevor February 19, 2009 at 9:10 am
a very good clarication about kernels,im impressed!
Reply
40 ondrg March 18, 2009 at 10:04 am
Thanks, it works perfectly.
Reply
41 nugga April 4, 2009 at 9:31 pm
hello when i try to boot my kernel it says error le not found.
i use the following command
title Debian GNU/Linux, kernel 2.6.25 Default
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hdb1 ro
initrd /boot/initrd.img-2.6.25
savedefault
boot
im pretty noob i dont know what im doing wrong.
plzz contact me or post here.
Reply
42 nugga April 5, 2009 at 10:16 am

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

12 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

my mail is toldamtorp@gmail.com
Reply
43 Hussain Jaar May 5, 2009 at 3:16 am
37 ondrg, Which gcc version you used ?
Can any body tell that How to remove a previously compiled and installed kernel.
So as to make space for compiling and installing a new kernel ?
Reply
44 Acevedo May 7, 2009 at 6:17 pm
NIce step-by-step process, BUT Following error occured during make command of
conguration step for linux 2.6.29.2
make[1]: *** [script/kcong/dochecklxdialog] Error 1
make: *** [menucong] Error 2
Plz provide me solution for it.
Thanks
J.Acevedo
Reply
45 Anitha May 12, 2009 at 10:22 am
Hi Kindly help me please i m in serious trouble
I m trying to install RTLinux on Linux 2.6.xx
The installation guide specied to patch the linux 2.6.xx, congure and then
compile. But
i m able to proceed til the conguration of the kernel
When i give the make command, i m coming up with errors
Also i tried to install linux 2.6.xx without patching it with RTLinux,again i m struck
up while compiling
Kindly help pleaseWil be grateful to you
Reply
46 chindam May 29, 2009 at 5:45 am
Its good, but i need your help to compile;boot from a ash drive and congure
options such that the size of the kernel is max 5Mb(minimum application like
terminal,usb)
Reply
47 mavgh1 July 7, 2009 at 12:09 am
Great Tutorial .I have E8200 , Gigabyte EP43-DS3L kernel 2.6.18 that does not

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

13 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

recognize coretemp,I compiled 2.6.30.1 kernel and its working.Thanks


Reply
48 Max Baird July 13, 2009 at 2:44 pm
Hey this was great, worked for me I had some small issues where I was missing
some les like ncurses etc, but after getting them it all owed smoothly thanks
alot again :)
Reply
49 Kousik July 20, 2009 at 8:33 am
This is nice documentation. But I think some modication is required.
Step # 6: Create an initrd image
Type the following command at a shell prompt:
# cd /boot
# mkinitrd -o initrd.img-2.6.25 2.6.25
Instead of mkinitrd I use mkinitramfs in ubuntu 9.04
Step # 7 Modify Grub conguration le /boot/grub/menu.lst
# update-grub
update-grub is not required in ubuntu 9.04
Reply
50 Lady September 10, 2009 at 9:47 am
Can any body describe to me next: about the process0, process0 which happened in
Linux kernel 2.6,
1. describe how to greate it
2. describe what they do
Reply
51 Sivakumar September 23, 2009 at 1:08 am
Hi
I am using ubuntu distribution, I like to update my kernel , my present version
kernel is 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686
GNU/Linux.
i downloaded latest kernel source from kernel.org linux-2.6.31.tar.bz2 i followed
the following steps to congure my kernel
1. i extracted the kernel source le in usr/src
2. I updated my gcc complier
root@sivakumar-desktop:/usr/src# apt-get install gcc
Reading package lists Done

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

14 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Building dependency tree


Reading state information Done
gcc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 228 not upgraded.
3. Then i tried to run make menucong, i got the following error
root@sivakumar-desktop:/usr/src# make menucong
make: *** No rule to make target `menucong. Stop.
4. then i tried
root@sivakumar-desktop:/usr/src/linux-2.6.31# make menucong
*** Unable to nd the ncurses libraries or the
*** required header les.
*** make menucong requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel) and try again.
***
make[1]: *** [scripts/kcong/dochecklxdialog] Error 1
make: *** [menucong] Error 2
Reply
52 Aks March 26, 2011 at 6:55 pm
Hi there,
To resolve this issue you have to rst complete all update of you system then
try this
$ sudo apt-get install libncurses5-dev
Reply
53 saki September 28, 2009 at 7:09 am
i am also getting the same problem .plz suggest
Reply
54 Mukesh October 11, 2009 at 1:26 am
after extracting there is some error when i congure the kernel
that error is make: *** No rule to make target menucong, Stop.
Reply
55 Mukesh October 11, 2009 at 1:29 am
Hello,
Can Any One Solve My Problem That Is

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

15 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

after extracting there is some error when i congure the kernel


that error is make: *** No rule to make target menucong, Stop.
plz tell me the fast it is urgent friends.
plz
Reply
56 Redd October 13, 2009 at 2:37 pm
Mukesh seems like you need to cd into the extarcted directory to run the make.
Reply
57 Redd October 13, 2009 at 2:39 pm
Has anyone made a suggestion as to how to x the kernel panic issue that was
pointed to several time here? I have the same issue. After installing the new kernel
and trying to boot into it, I see the kernel panic since it doesnt see any of my
drives ( /, /usr, etc). Anyideas where I went amiss?
Reply
58 Raj October 30, 2009 at 4:10 am
Hi!!
i am using Redhat 4 kernel 2.6.9 and now i build kernel 2.7.13. it was sucessfully
and after reboot i can see my new kernel in the grub.. but when i select .and
proceed . i am getting the following error:
Enforcing mode requested but no policy loaded. Halting now.
Kernel panic not syncing: Attempted to kill init!
please tell me wht might the problem and suggest me how to load the kenel
2.7.13..
Thanx in advance.
Reply
59 GARG November 6, 2009 at 1:10 pm
problem occur on booting
mount: unknown le system type devfs
Kernel panic not syncing: Attempted to kill init!
Reply
60 ben November 11, 2009 at 4:17 am
In the process make install .there are two les created in the direction /boot
Kernel image: /boot/vmlinuz-2.6.31.4-smp
Initrd image: /boot/initrd-2.6.31.4-smp
However,One le cong is missed.

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

16 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

I update the menu.list


Then ,reboot.
On the way booting,there is no error.
but when I inter the X-window ,my keyboard and mouse doesnt work.
Reply
61 mahdi November 24, 2009 at 9:39 pm
Hi everybody,
I have followed all the steps above and succeeded in every step. But when I choose
in the grub to run the 2.6.31.6 kernel I have the following message:
Unable to nd a suitable fs in /proc/mounts, is it mounted ?
Use subdomainfs to override.
I have installed the linux kernel from Ubuntu 9.10. I am not sure, but I think
because I have installed ubuntu with ext4 le system, the kernel could not
recognize it. The kernel is residing in /usr/src which is in the same partition as
ubuntu.
Have anyone an idea out there ?
Thx,
Reply
62 bonz December 3, 2009 at 10:49 pm
if you want people to do your survey you should make it accessable for us lynx
users
Reply
63 Noober December 6, 2009 at 6:12 am
I need help.I follow stepbystep all is done.And but at the reboot say error 16:
inconsistent lesystem structure what wrong whit it? My kernel is 2.6.24-16 want
to upgrade kernel 2.6.31.6 plz help me thx
Reply
64 Azade December 24, 2009 at 5:18 pm
Does it work for SUSE?
Reply
65 vaidya1 January 13, 2010 at 8:22 pm
hey guys.can anyone help me.in my /boot i am not getting cong le for
newly compiled and installed kernel and also after successful installation of
kernel.2.6.32 , i am not able to boot from this kernel as it says le system not
detected , /dev/hda not detected..and kernel panic.

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

17 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Reply
66 princelibya14 April 14, 2010 at 12:31 pm
hi, bro , just try theses commend , cause i got the same problem when i used
them every thing is going ok, i wish them helping u, (1. make mrproper
2.cp /boot/cong-`uname -r` ./.cong ,Then we run 3.make menucong) so
these two commends use them before make menucong, and also do not use
make only, just use (make all) . then continue as usual commend in this article,
i wish them useful,
my regards,
Reply
67 BongoBongo January 16, 2010 at 9:30 pm
Nice.
Came in handy as I needed to recompile kernel in order to remove KVM
virtualization support. VirtualBox wont run with KVM modules loaded.
Why am I telling you this?
Reply
68 DaVince January 28, 2010 at 3:12 pm
Some of the instructions are kind of outdated on modern systems, could you
perhaps update the article?
- Some systems now use GRUB 2, which doesnt have a menu.lst.
- Modern systems tend to use mkinitramfs or yaird, not mkinitrd.
Thanks a lot for the article, though. O to test out my new kernel.
Reply
69 ahmeds February 1, 2010 at 2:32 pm
This article actually very usefull. It helped me to kompile linux kernel after my
resultles
attemtions for a long period. The only issue I had was creating initrd image.
My Ubuntu 8.10 interpid (also 8.4 hardy) do not have mkinitrd command so instead
I used next steps to compile linux kernel(2.6.27.7).Here they are.
1. rst copy your /boot folder to somewhere , home folder
2. go to top of your linux source tree and run(root prev required)
#make-kpkg clean && make-kpkg initrd revision=custom.1.0 kernel_image
and after its nished with no errors run
#dpkg -i .deb
the latest command will update your /boot also /boot/grub/menu.lst le , but this is
not what
do we want , and after reboot you may nd your pc not booting at all.
Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

18 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

what do we need is new kernel and new initrd image .


our new kernel is vmlinuz-2.6.27.7 and image is initrd.img-2.6.27.7
so we have to copy these les to some temp folder , then restore our old /boot
folder
from backup and copy back again our fresh kernel and image from temp folder to
/boot.
to nish we need edit /boot/grub/menu.lst le.
here we can simply copy our generic boot items and make no change except names
of kernel and image to new ones. reboot and enjoy.
Reply
70 vig February 1, 2010 at 11:20 pm
it really worked .. clean .. thanks .. a lot
Reply
71 Danny February 3, 2010 at 11:54 am
> Step # 2 Extract tar (.tar.bz3) le
I lold.
Reply
72 Anon13 March 9, 2010 at 4:06 am
Thanks! i was looking forward to use some source code for making a fake
compiling terminal session, so i could slack on the job eventually (slow days make
you wanna do something else, but boss doesnt understand the meaning of I do my
job so good nobody gets errors, therefore nobody needs IT support) with the
excuse that my code is compiling (thanks xkcd.com for the idea). All i do is run
make on the source directory, and once im done with slackin i just run make
clean to revert any changes :b
Reply
73 Tom March 14, 2010 at 5:13 am
This is after Ive done step#2 and installed gcc.
When I use this command make xcong Im getting this error No rule to make
target.
Any ideas on how to x this?
Reply
74 tata1 March 16, 2010 at 2:56 am
you have to be inside linux folder,
go to yor home directory with cd und then type
pla@pla# cd /usr/src/linux

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

19 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

then type
pla@pla # make menucong or make xcong
make sure that ncurses package is installed
all the best
Reply
75 princelibya14 April 18, 2010 at 10:32 pm
hi, i have done all these steps, but i got error when i enter to my new kernel there
is network to connection to internet , so can any one help me to solve this problem,
cause i am not expert in fedora 10( i mean in Linux )
my regards
Reply
76 ahmeds April 22, 2010 at 3:15 pm
Could you please explain in more detail your error about connection?
Can you run programs with new kernel?
And did you use cong le from previous kernel or new one?
Reply
77 princelibya14 May 4, 2010 at 11:35 am
hi, bro , i am sorry, i took long time to answer on your query, so my
problem is (i can not access on internet) by using wire or less card, when
i run commend (iwcong i got message no wireless extension for eth1 )so
sholud i got these from last kernel on my new kernel when i congure it,
and also when i search i got article i have to install package for wireless
chip . my chip num is b4312, i am already installed , but there is not thing
, i wish to help me, cause i waste my time on in these for month , i
attempt to solve it, but nothing.plz help me as soon as u can , cause i am
in rush.
my regards bro.
Reply
78 Malay Gopani May 4, 2010 at 10:09 am
Hi,
i want to add the support of portuguese font in linux. i dont know how to add this if
anyone knows then please tell me.
Reply
79 princelibya14 May 4, 2010 at 11:41 am
hi, bro, how r u? i wish to help u, u can enter on 1.system then
2.administration 3. choose language from the menu. 5 enter ur password, at
last choose Portuguese language ,
Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

20 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

i hope this info it is useful to u,


my regards.
Reply
80 Malay Gopani May 5, 2010 at 6:02 am
Hi,
Thanks,
But i want something dierent. I have ported linux on the device. I have
done make menucong to make on the portuguese character set ,but it
shows this error.
HOSTLD -static scripts/kcong/mconf
/usr/bin/ld: cannot nd -lncursesw
collect2: ld returned 1 exit status
make[1]: *** [scripts/kcong/mconf] Error 1
make: *** [menucong] Error 2
i have this ncursesw library installes also.
would you help me again?
Reply
81 anon May 9, 2010 at 12:30 pm
apt-get install libncurses5-dev
Reply
82 kishore May 10, 2010 at 5:12 am
Hi everybody,
I have followed all the steps above and succeeded in every step. But when I
choose in the grub to run the 2.6.31.6 kernel I have the following message:
Unable to nd a suitable fs in /proc/mounts, is it mounted ?
Use subdomainfs to override.
I have installed the linux kernel from Ubuntu 9.10. I am not sure, but I think
because I have installed ubuntu with ext4 le system, the kernel could not
recognize it. The kernel is residing in /usr/src which is in the same partition as
ubuntu.
Have anyone an idea out there ?
Thx,
Reply
83 Alex May 17, 2010 at 3:27 pm
Did you maybe load ext4 as a module and not compile it directly into the
kernel
Also if nothing else works I think you could bootstrap it with an initrd to
Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

21 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

make it boot in ext4


Reply
84 pankyubootha May 23, 2010 at 11:14 am
hi kishore, i think enabling SYSFS_DEPRECATED in the cong le i.e.
.cong and recompiling the kernel should resolve the issue. but this
may lead to udev being adversely aected. also remember to enable
LBDAF in the kernel proling segment of the .cong le. good luck.
PankyuBootha.
Reply
85 Jagan May 17, 2010 at 9:46 am
Hi All
Is there any changes needed during kernel conguration for USB boot support.
what are the steps required for USB boot, starting from the compilation.
any help would appreciated!!!!!
Regards
Jagan
Reply
86 ahmeds May 25, 2010 at 3:24 am
Hi Jaqan. I guess for USB boot support no kernel conf needed. Because
your kernel and initrd.img is loaded by grub from hd, USB or net.
Just copy your boot folder from HD to USB and istall grub on USB.
Restart and see what happens. Good lucks.
Reply
87 Federico June 1, 2010 at 12:58 pm
I guys i have a problem when I try to generate the init image.. Using Debian 5.0 it
says mkinitrd command not found.. Anyone can help me? D:
Thanks
ps: sorry for the english im italian
Reply
88 anonymous June 4, 2010 at 10:44 am
use mkinitramfs
Reply
89 ahmeds June 7, 2010 at 3:45 am
Hi Federico. I also used debian and it actually a headache to nd proper
Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

22 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

initrd.img for
new kernel, as mkinitrd doesnt work on new distrs and a lot of other stu.
I put here the answer that found
http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html/commentpage-7#comments
lucks.
Reply
90 Je June 9, 2010 at 10:51 pm
Howdy yall. I just wanted to ask about this process. We own a lot of RHEL/CentOS
systems round here and Im curious how the kernels built with this process will
dier from the kernels shipped from the standard repositories. Ive looked
countless places for a guide to recompiling a kernel specically with the source
from those OSes, but something has always failed, or not been in the right location,
etc. Im currently building a kernel using the described process and it actually
seems to be working, but Im just wondering what functionality loss there will be.
Reply
91 Je June 10, 2010 at 12:29 am
Hi everyone. I just wanted to ask about this process. We own a lot of RHEL/CentOS
systems round here and Im curious how the kernels built with this process will
dier from the kernels shipped from the standard repositories. Ive looked
countless places for a guide to recompiling a kernel specically with the source
from those OSes, but something has always failed, or not been in the right location,
etc. Im currently building a kernel using the described process and it actually
seems to be working, but Im just wondering what functionality loss there will be.
Reply
92 Je June 10, 2010 at 12:39 am
Weeell
New kernel compiled, but either doesnt have SATA or LVM support, as its
failing to mount root at boot and kernel panicing. At least I got the darn thing
compiled all I really wanted to accomplish at the moment
Reply
93 Pankyu Bootha June 10, 2010 at 6:00 pm
Hi Je, As I had said earlier, for RHEL, CentOS and such cognate
systems, I have found that one has to enable SYSFS_DEPRECATED while
compiling the kernel versions > 2.6.33. As for enabling SATA support, in
the relevant section of the .cong le one has to enable scsi/ide support
while conguring the kernel. Pl rst copy .cong on desktop after
uncompressing the tarball in your home directory-

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

23 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

$ bzip2 -dc linux-2.6.34.tar.bz2 | tar -xvf -. You can copy .cong le by$ mv /home/je/linux-2.6.34/.cong /home/je/Desktop/cong.text. Then
copy cong.text in your home folder/directory.
Now read the cong.text le carefully in gedit. you can search for
SYSFS_DEPRECATED by using the interactivesearch available in the top
window-bar of gedit. Also go through the scsi and ide drivers section.
To manually enable the required features doCONFIG SYSFS_DEPRECATED=y
Remember to uncomment the relevant by removing the #.
Ater you have thus enabled the relevant features, replace cong.text to
linux-2.6.34 by$ mv /home/je/Desktop/cong.text /home/je/linux-2.6.34/.cong
Now cd to linux-2.6.34 and do make
.
Any further queries are welcome. Good Luck. Pankyu Bootha
Reply
94 Rajgopal August 17, 2011 at 3:20 pm
@pankyu .. Hi.. how does one enable the LVM support ?
Reply
95 Rocky July 26, 2010 at 7:01 am
Hi,
I followed this nice link for kernel compilation.Everything is done nicely.There is no
any error while doing compilation process.But after step 5( Step # 5 Install kernel
# make install ) , I am not getting cong le in /boot for new
kernel. I m getting systemmap,vmlinuz and initrd for new kernel.So as
per step 6 for mkinitrd, it shows already exists.
And when i rebooted machine with new kernel , getting kernel panic , /
dev/root leystem not found.
OS: CENTOS 5.5
KERNEL : 2.6.34.1
Reply
96 ahmeds July 27, 2010 at 4:13 am
Good day Rocky. I dont know what the issue was that cong le missed for new
Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

24 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

kernel at /boot folder, but you can copy it manually from source directory of the
new kernel that you compiled. At step 3 you have to congure your new kernel
using make menucong, make oldcong , or another one of your choise. This step
will do nothing else but create
.cong le at the top of your source dir. As usual all les in unix that begin with dot
are hidden so .cong le too. Just copy it to your /boot folder using
# cp .copng /boot/cong-2.6.x.y
Regarding kernel panic you have to specify right root lesystem.
Either the problem is with your initrd le and sometimes it is becoming real
headache
to get proper initrd for new kernel that doesnt panic.
What I do really advice just try if it will work do make oldcong. This will cong
your
kernel using conguration of currently running one. And dont use make initrd but
rename
and use initrd le le of your currnetly running kernel for new one.
Reply
97 Rocky July 28, 2010 at 10:21 am
Hi Ahmeds,
I followed your reply.But getting same.
Rocky
Reply
98 ahmeds July 29, 2010 at 4:19 am
Hi Rocky. It is ok if your kernel again did panic. If you want to compile kernel
just for update your current system then I cant help you. But if you want to
compile kernel so that you could start to kernel programming then just say hello
to bulk of the problems waiting you ahead. I spent 4 month for compiling my kernel
that didnt panic. It was 2.6.27.7 . I also learned how to congure kernel to
compile all necessary drivers built in so that kernel loaded without headache initrd.
But with 2.6.34.xx things are a little bit dierent. I didnt come yet to this level but
what I may advice you is next:
1. download kernel source code of the exact version that is currently running, so
that make oldcong doesnt complain to anything and if it does say yes.
2. try again more and more.
3. specify RIGHT ROOT lesystem. i.e. root=/dev/sda5 or root=/dev/hda2
The list of lesystems and your root lesystem you can nd by df command
for example my root le system(/) mounted on /dev/sda7
john@lnx:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda7 18482044 15095664 2447528 87% /
none 504828 304 504524 1% /dev
none 509044 212 508832 1% /dev/shm

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

25 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

4. If these wouldnt help try compiling necessary drivers built in. To do this do next:
1. GET list of all of your modules loaded using lsmod.
john@lnx:~$ lsmod
Module Size Used by
binfmt_misc 6587 1
rfcomm 33421 4

get module information for each module using modinfo.


john@lnx:~$ modinfo binfmt_misc | grep lename
lename: /lib/modules/2.6.32-21-generic/kernel/fs/binfmt_misc.ko
Go to your kernel source code open fs/Makele le. Find binfmt_misc.o string
(Note: .o not .ko).
obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.o
Then open .cong le of your kernel (o course after make oldcong ) and nd
CONFIG_BINFMT_MISC.
CONFIG_BINFMT_MISC=m
m means compile as module. If you want this driver to be compiled built in just
change m here to y and save your .cong le.
CONFIG_BINFMT_MISC=y
You dont have to compile all of your drivers as built in just those which is necessary
for mounting root le system, i.e. hard disk drivers, scsi if present, ext3 or 4 if they
are compiled as module. It is up to you. If df prints something like
/dev/sda4 for (root fs,/) this means you have scsi disk. /dev/hda says you have ide
disk.
Huh. It is not fun at the end. Good lucks.
Reply
99 Marten July 31, 2010 at 10:41 am
Hello,
I have the exact same problem as Rocky: centos 5.5 with running kernel
2.6.18-194.3.1.el5 and I want to install 2.6.34.1. All teh steps went ne, no errors,
but I had to manually copy .cong into /boot/cong-2.6.34.1. After reboot, same
errors like Rocky and also Volume group Volgroup00 not found which is why / is
not mounted.
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
71G 21G 46G 32% /
/dev/sda1 99M 35M 59M 37% /boot
tmpfs 950M 0 950M 0% /dev/shm
# cat /boot/grub/menu.lst
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this le
# NOTICE: You have a /boot partition. This means that

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

26 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

# all kernel and initrd paths are relative to /boot/, eg.


# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=2
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.34.1)
root (hd0,0)
kernel /vmlinuz-2.6.34.1 ro root=/dev/mapper/VolGroup00-LogVol00 rhgb quiet
initrd /initrd-2.6.34.1.img
title CentOS (2.6.18-194.8.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.8.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-194.8.1.el5.img
title CentOS (2.6.18-194.3.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.3.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-194.3.1.el5.img
Any help?:)
Reply
100 Rocky August 1, 2010 at 3:52 pm
Hi,
You can resolve this error.Follow this steps.
After menucong.open .cong le and add
CONFIG_SYSFS_DEPRECATED_V2=y and then compile the kernel.Your issue
wiil be resolved.If you have any query, let me know.
Rocky
Reply
101 Marten August 2, 2010 at 8:19 am
Hi Rocky,
Thanks for the help, it worked. I still get this strange error mesage:
insmod: error inserting /lib/dm-region-hash.ko: -1 File exists
but the system boots up ok, so I guess I can ignore it.
Kernel 2.6.34.1 running :D :
uname -rs
Linux 2.6.34.1
Reply

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

27 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

102 ragul August 16, 2010 at 2:32 pm


how to recompile linux kernal?
i am working on module programming . . so i ve to disable the versoning . . can any
1 help me
Reply
103 ahmeds August 19, 2010 at 3:53 am
Hi ragul.
Pls write the command you use for compiling your module.
and also uname -r.
bye.
Reply
104 uui August 21, 2010 at 11:09 am
For step 2, I dont think youre suppose to do it in /usr/src when youre installing.
Reply
105 deepak goel October 20, 2010 at 6:12 am
hiii
i am using kernel 2.6.33 but i want to compile 2.6.23
i get a error getline function conict when i change the name of it ill get errors in
make install command
ERROR: modinfo: could not nd module garp
ERROR: modinfo: could not nd module stp
plz suggest how ill proceed
thnx in advance
Reply
106 goo November 21, 2010 at 6:44 am
i am using kernel linux-2.6.36-21 and i want to update it to 2.6.36
everything is ok during compiling and installing
but after reboot my system it tell me could not load /lib/modules2.6.36
/modules.dep: no such le or directory.
any one have met this problem?
please help me, thanx
Reply
107 subhash November 26, 2010 at 4:53 pm
i m using ubuntu 10.10..completed upto step5
In mkinitrd -o initrd.img-2.6.25 2.6.25 its giving command not found.

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

28 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

on trying to install initrd-tools getting the following error..Unable to locate


package initrd-tools.its very urgent.please can anyone tell what is getting
wrong
Reply
108 ahmeds November 29, 2010 at 4:41 am
Good day subhash. I also had the issue with initrd.img compiling linux.
I put my solution in above comment ahmeds February 1, 2010.
The only mistake in this solution is #dpkg -i .deb.
prior issuing this command you have to cd ..
and then run dpkg with the deb le prodced by
#make-kpkg clean && make-kpkg initrd revision=custom.1.0 kernel_image
Reply
109 Hammad December 6, 2010 at 3:43 am
Hi,
I followed these instructions and managed to compile the kernel on an ubuntu
virtual box. I had some issues with installing the ncurses library, and then with the
mkinitrd command, but managed to resolve both of them.
However, just the make step took nearly 6 hours to complete. I thought this was OK
until I read in several places that it usually takes around the order of 20 minutes or
so. What might I be doing wrong?
I am running ubuntu on a virtual machine, with 512 MB RAM and 10 GB HDD
space. Any help would be greatly appreciated.
Thanks!
Reply
110 anany December 24, 2010 at 10:33 am
Hi
thanks dude.. you did a rocking job..
I Remembered what youhv written somewhere.
Dont send a boy to do a Mens job..
Reply
111 CFB January 20, 2011 at 8:55 pm
Listen people, do not use this post to build a 2.6 kernel in debian stable or testing.
The post is from 2005 and much has changed since then.

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

29 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

I am writing up hos to do it and will follow up with a post.


This is where the internet fails, keeping old, useless information around for too
long.
Reply
112 Mahesh February 18, 2011 at 12:18 pm
Guys,
I am newbie to linux kernel build, downloaded linux-2.6.36 from kernel.org and gcc
version is 4.4,
uname -a gives msgs
Linux A2MD15118 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC
2011 i686 GNU/Linux
I am trying to build the kernel, but make command is gives me below error,
ubuntu/linux-2.6.36/arch/x86/Makele:81: stack protector enabled but no compiler
support
CHK include/linux/version.h
CHK include/generated/utsrelease.h
CC kernel/bounds.s
cc1: error: unrecognized command line option -mregparm=3
kernel/bounds.c:1: error: bad value (i586) for -march= switch
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2
Please kindly help me to avoid this error
Thanks in advance..
Mahesh
Reply
113 Mahesh February 18, 2011 at 12:30 pm
Thanks solved the problem by giving full details to make cmd
$make KERNELDIR=/home/ubuntu/linux-2.6.36 CROSS_COMPILE=/usr/bin/
Reply
114 R4to0.exe February 21, 2011 at 2:26 am
Step # 2 Extract tar (.tar.bz3) le
bz3
I lold
Reply
115 Neal Anderson March 23, 2011 at 6:44 am

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

30 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

I found something and thought to share it with you people.


I was compiling the kernel on fedora 13 when i issued make makecong command i
got some errors same as make*** . Thats ok , the solution is install ncurses-devel
ne enough??
ok now shoot yum clean alll.
thats it.
now again run make makecong ;) here you go :D
Reply
116 deadman April 10, 2011 at 7:27 am
hey
im having problems while doing make for 2.6.38
its shows 44 sections mismatch(es)
i ignored it and installed the thing
but on loading its shows kernel panic
plz help
Reply
117 Gareld April 14, 2011 at 11:35 am
Just want to share something that I found useful.
Autokernconf can probe your hardware for necessary drivers and creates a
cong le.
Depending on your distro, you might also have to add a few other kernel
options like CONFIG_TMPFS for /dev
Take a look at: http://cateee.net/autokernconf/
Reply
118 Mike Shah April 14, 2011 at 9:50 pm
Hello,
Where can I get development tools (gcc compilers and related tools) (not source)
(binary form) (free)(download)? Can you send me URL or link?
I would like the build Linux Kernel but I need make, gcc, linker etc?
Thanks for your help!
Mike
Reply
119 Tanish May 2, 2011 at 5:06 pm
Hi,
Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

31 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

I am trying to build the new kernel (2.6.38) and facing the similar issue as in the
comment # 97. I followed the instructions in comment #98 but not able to x the
problem. As I start the make, the .cong le is renamed to .cong.old and the
changes is lost. Can you help me xing the issue? I am using CentOS 5.5.
-regards,
Tanish S.
Reply
120 vo tuan anh June 14, 2011 at 4:58 am
hi all,
I have a new PC. I want install kernel linux for it.
pls guide me create and install kernel linux [kernel.org - linux-3.0-rc3.tar.bz2]
Thank you
Reply
121 vinodsreehari July 7, 2011 at 4:19 pm
Hi ,
Nicely explained. Worked for me like a charm. But I didnt have to apply teh last
two steps ,ie, creating initrd image and editing the boot loader. Those steps ahev
been automatically done . Btw, I performed it in SuSe 11.3. Will it be the same in
other distros also ?? Curios !!
NB: I upgraded 2.6.34 to 2.6.39
Reply
122 Grzeziek July 18, 2011 at 10:56 am
Kernel panic not syncing: VFS: Unable to mount root fs ..
Ive solved this problem by creating an initrd image with mkinitramfs function.
mkinitramfs -o initrd.img-2.6.39.3 2.6.39.3
Tried to use mkinitrd but there were no such command in Debian (even after
installing kernel-package)
now everything works ne, thx for tutorial.
Reply
123 xyz July 27, 2011 at 7:27 pm
hello
i tried all the steps mentioned above.
but while using make command following error is occuring.

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

32 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

make: *** No rule to make target `menucong. Stop.


also i have tried.
sudo apt-get install libncurses5-dev
but following error is occuring.
Reading package lists Done
Building dependency tree
Reading state information Done
E: Couldnt nd package libncurses5-dev
plz..plz.. reply soon.
Reply
124 vinodbhasi July 28, 2011 at 2:21 am
@XYZ
I guess you are trying to make outside the linux directory. change directory to
linux (cd /usr/src/linux )
Reply
125 Mayank August 25, 2011 at 6:22 am
hi
I am using RHEL6 kernel version 2.6.32-71.el6.x86_64
and recompile on kernel version 3.0.3
upto this make install step everything going smoothly
after doing this i am not getting that three les
* System.map-3.0.3
* cong-3.0.3
* vmlinuz-3.0.3
so i am not be able to make initramfs.img le with this version
so now what i can do
is there any compitablity problem
plz help me out
Reply
126 PC September 1, 2011 at 7:58 pm
Make sure you are root when you do the install. Or it will fail.
Reply
127 Tom September 9, 2011 at 4:36 pm
Thanks. Theres a mistake in the Step # 2 title. It should be .bz2 not .bz3.

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

33 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Reply
128 Vasavi September 18, 2011 at 8:54 am
Hi,
Open le using vi:
# vi /boot/grub/menu.lst
title Debian GNU/Linux, kernel 2.6.25 Default
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hdb1 ro
initrd /boot/initrd.img-2.6.25
savedefault
boot
I tried to open the menu.lst le but it is being opened in vi as a new le. So, I just
updated grub and rebooted but in the boot loader list I dont have the kernel I
installed to select it. Please help.
Thanks in advance.
Reply
129 Gayathri November 14, 2011 at 8:14 pm
I am facing the same problem. Any solutions ?
Reply
130 xeno December 5, 2012 at 6:58 am
Im using Ubuntu 12.04.1 LTS. There is not menu.lst in it either. I ignored the
menu.lst and just ran update-grub and restarted the system, it worked ne for
me. Try uname -a to see if you already have the kernel.
I update from 3.2.x to 3.7.0
Reply
131 mubarik October 8, 2011 at 9:54 pm
there is an error in sudo make. i am using 64 bit ubuntu 11.4.
arch/x86/kernel/entry_64.S: Assembler messages:
arch/x86/kernel/entry_64.S:1558: Error: .size expression for
do_hypervisor_callback does not evaluate to a constant
make[2]: *** [arch/x86/kernel/entry_64.o] Error 1
make[1]: *** [arch/x86/kernel] Error 2
make: *** [arch/x86] Error 2
Reply
132 Kevin Kirkwood January 4, 2012 at 7:45 pm
I am having the identical problem.

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

34 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

have you found a solution to the problem yet?


This is something I need resolved ASAP.
If so I would really appreciate the x.
Thanks
Thanx
Kevin
Reply
133 lambda October 16, 2011 at 7:24 pm
can anyone tell me how to load an kernel image without modules and gui.
i just want to load a kernel image without any conguration.
Reply
134 bhavin December 3, 2011 at 2:30 am
hey,
I used this method to compile kernel 3.1.2 on my PC.
but Im stuck with samples/hidraw/hid-example.c
Its is like this

samples/hidraw/hid-example.c:49: warning: unused variable info


samples/hidraw/hid-example.c:48: warning: unused variable rpt_desc
samples/hidraw/hid-example.c: In function bus_str:
samples/hidraw/hid-example.c:171: error: BUS_VIRTUAL undeclared (rst use in
this function)
make[2]: *** [samples/hidraw/hid-example] Error 1
make[1]: *** [samples/hidraw] Error 2
make: *** [vmlinux] Error 2

So can anyone tell me what I should do. All other steps are going ne.
Thanks
Bhavin
Reply
135 Anisha Kaul January 20, 2012 at 5:36 am
Do,
# cd /boot/grub
# ls
Do you nd menu.lst there? If yes, the do
# cat /boot/grub/menu.lst

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

35 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

This will show you what all is already present there.


You can open it through a text editor, and add the new and the old kernels, as
shown here.
Reply
136 Amit Shaw January 20, 2012 at 8:02 am
NICE TO SEE THE DEFINE ITS AWESOME. Thanks.
Reply
137 Sakib January 20, 2012 at 4:18 pm
Conrmed Working on rhel-5.6 32bit. No need to use mkinitrd -o initrd.img2.6.25 2.6.25 command.
Today I have install 2.6.30.5 kernel.
Thanks
Sakib
Reply
138 mouli February 7, 2012 at 3:48 am
I followed the tutorial till step 7. On step 7 Modify Grub conguration le
/boot/grub/menu.lst, I am not able to nd menu.lst.
I am using ubuntu 10.04, how do I go from here to edit menu.lst?
Thanks,
Mouli
Reply
139 mouli February 7, 2012 at 4:03 am
Ok, this command worked perfectly ne: update-grub
I see the new kernel after reboot :)
Reply
140 vinod bhasi May 4, 2012 at 9:05 am
Yes, even I did successfully in Debian . update-grub did the job.
Reply
141 tm February 27, 2012 at 11:55 am
when i type sudo make :

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

36 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

tm@ubuntu:/usr/src/linux-2.6.27.12$ sudo make


CHK include/linux/version.h
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
VDSO arch/x86/vdso/vdso32-int80.so.dbg
gcc: error: elf_i386: No such le or directory
make[1]: *** [arch/x86/vdso/vdso32-int80.so.dbg] Error 1
make: *** [arch/x86/vdso] Error 2
can you guys help me about this error !!!
btw i dont know what shall i do when u type make menucong :( and i have already
3.0.0-16-generic
Reply
142 thiyagi March 8, 2012 at 6:13 pm
thanks for info, very useful..
Reply
143 bluesean May 13, 2012 at 8:45 pm
#.after
$sudo make modules_install install
#initramfs for ubuntu eg:$sudo update-initramfs -u -k 3.3.6
$sudo update-grub
PS: 3.3.6 is my kernel version &
fyi
$ ls -rt /boot/ | tail -n 5
vmlinuz-3.3.6
System.map-3.3.6
cong-3.3.6
initrd.img-3.3.6
grub
Reply
144 ramana July 4, 2012 at 6:04 pm
hi all,
i have a facing some issue like:
iam currently using ubuntu 11.04 linux 2.6.35 verison.
now i want to add the linux 2.6.27 sources, the compilation and installation is
success but after reboot it was going to initird$ promt, but i want GUI to login .can
any one please tell me the proceser for how to bring up the board to GUI..
Reply

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

37 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

145 Handra July 20, 2012 at 1:31 am


Hi, thanks mate.. I follow your tutorial. It works like a charm. Kernel version
3.4.5 is now Running on my Ubuntu 12.04. Great.. Keep up the good work.
Reply
146 paul July 30, 2012 at 9:17 pm
hi i can run make menucong but when i run make afterwards i get the following
error
root@paul-MS-N014:/usr/src/linux-headers-3.2.0-26-generic-pae# make
make[1]: *** No rule to make target `arch/x86/tools/relocs.c, needed by `arch/x86
/tools/relocs. Stop.
make: *** [archscripts] Error 2
i am running ubuntu 12.04ls
Reply
147 Handra August 4, 2012 at 10:28 am
Hi Paul,
Are you sure you are compiling using the full source code? I see from the
directory name, it is just the header les. Make sure that you download the
full source code rst before compilation.
Cheers
Reply
148 ketan August 7, 2012 at 3:20 pm
how to print any simple message on login screen on Linux.
Reply
149 Shubham Saraswat August 17, 2012 at 12:07 pm
wow i didnt knew compiling linux kernel 2.6 was so easyvivek man you have
explained it well in just 8 steps..
Reply
150 Pankaj August 27, 2012 at 8:48 am
When i am giving the command make menucong
i am getting an error below
No rule to make target `menucong. Stop.
please anybody can help

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

38 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Reply
151 Akash September 3, 2012 at 1:57 pm
type cd /usr/src/linux-3.6-rc4 and then use make command.
Reply
152 Srini November 6, 2012 at 2:03 pm
It is not working for me giving errors while compiling kernel.
follow these steps.
make menucong
make clean
make bzImage
make modules
make modules_install
make install
these steps worked for me
Reply
153 aditya January 8, 2014 at 9:36 am
[aditya@localhost linux-3.12.6]$ make menucong
Makele:323: /home/aditya/linux-3.12.6/scripts/Kbuild.include: No such le or
directory
make: *** empty variable name. Stop.
make: *** [scripts_basic] Error 2
please help
Reply
154 M Khan February 4, 2014 at 5:09 am
I downloaded this from this site. Now I simply want to unzip it. I am practicing how
to build a Kernel. can someone tell me how I can unzip it and should it go to /src.
stable: 3.13.1 2014-01-29 [tar.xz] [pgp] [patch] [view patch] [cgit] [changelog]
Reply
Leave a Comment
Name *
E-mail *

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

39 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Notify me of followup comments via e-mail.

Submit
Tagged as: command tar, compile kernel, compiling linux kernel, conguration option,
conguration tool, gnu linux, how to compile linux kernel, kernel code, kernel
conguration, kernel image, kernel source code, kernel v2, kernel version, latest linux
kernel, linux kernel version
Previous post: Knoppix 4.0.2 DVD Released
Next post: The importance of Linux partitions

To search, type and hit enter


nixCraft
Follow

+1

+ 10,343

Tweets by @nixcraft

Related Posts

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

40 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Howto: Build Linux Kernel Module Against Installed Kernel w/o


Full Kernel Source Tree

Redhat Enterprise Linux securely mount remote Linux /


UNIX directory or le system using SSHFS

Ksplice: Patch The Linux Kernel Without Rebooting System

Download of the day: Linux kernel 2.6.24

How To Patch Running Linux Kernel Source Tree

How to: Compile Linux kernel modules

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

41 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

HowTo: Linux Check IDE / SATA Hard Disk Transfer Speed

Linux command to gathers up information about a Linux


system

Increase the maximum number of pseudo terminals ~ PTY


on Linux for remote Login session

Debian Linux Version 6.0.2 Released


nixCraft
Like
42,580 people like nixCraft.

Facebook social plugin

Latest Linux/Unix Q & A

Monday 10 March 2014 11:27 PM

How to: Compile Linux kernel 2.6 - nixCraft

42 of 42

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

HowTo: Setup SSH Keys on a Linux / Unix System


Linux / Unix: chroot Command Examples
Minify and Compress CSS & Javascript Files At a Linux/Unix Shell Prompt
CentOS Install Lighttpd Web-server With yum Command
CentOS Install Java SDK using yum Command
CentOS: rpmdb: PANIC: fatal region error detected; run recovery error and
solution
HowTo: Update gcutil / gcloud Components On a Linux / Unix / OS X
curl Command Resume Broken Download
FreeBSD Show Disk Quota Limits Command
Explain: {,} in cp or mv Bash Shell Commands
Ubuntu Copy File Command
Linux: Log Suspicious Martian Packets / Un-routable Source Addresses
Increase NFS Client Mount Point Security For a Web-Server noexec, nosuid,
nodev Options
HowTo: Prevent Yum From Upgrading The Kernel On a CentOS / Red Hat
Enterprise Linux
Unix / Linux: Check New Files In File System /var/www/uploads/
Linux / Unix: Check Last Time User Logged In On The System
CentOS / RHEL: Yum Lock Package Version At a Particular Version
CentOS Linux 5/6: Change OpenSSH Port Number
Linux / Unix: whereis Command Examples
Nginx: Redirect Backend Trac Based Upon Client IP Address

Subscribe to nixCraft
Learn something new about Linux/Unix by email
Enter your email address:

Subscribe
2004-2014 nixCraft. All rights reserved. Privacy Policy - Terms of Service - Questions
or Comments - We are proudly powered by Linux + Nginx + WordPress.
The content is copyrighted to nixCraft and may not be reproduced on other websites.

Monday 10 March 2014 11:27 PM

You might also like