kernel compile nixcraft

42
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 find it difficult 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 linux- x.y.z.tar.bz2, where x.y.z is actual version number. For example file 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) file Type the following command: # tar -xjvf linux-2.6.25.tar.bz2 -C /usr/src # cd /usr/src Step # 3 Configure kernel How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html 1 of 42 Monday 10 March 2014 11:27 PM

Upload: amit786mnnit

Post on 17-Jul-2016

81 views

Category:

Documents


9 download

DESCRIPTION

compile

TRANSCRIPT

Page 1: Kernel Compile Nixcraft

AboutContact usForumsHomeLinux How-to & TutorialsShell ScriptsRSS/Feed

nixCraft

How to: Compile Linux kernel 2.6by 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 find it difficult to compile Linuxkernel. Compiling kernel needs to understand few things and then justtype couple of commands. This step by step howto covers compilingLinux kernel version 2.6.xx under Debian GNU Linux. However,instructions remains the same for any other distribution except forapt-get command.

Step # 1 Get Latest Linux kernel code

Visit http://kernel.org/ and download the latest source code. File name would be linux-x.y.z.tar.bz2, where x.y.z is actual version number. For example file inux-2.6.25.tar.bz2represents 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) file

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

# cd /usr/src

Step # 3 Configure kernel

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

1 of 42 Monday 10 March 2014 11:27 PM

Page 2: Kernel Compile Nixcraft

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

Now you can start kernel configuration by typing any one of the command:

$ make menuconfig - Text based color menus, radiolists & dialogs. This optionalso useful on remote server if you wanna compile kernel remotely.$ make xconfig - X windows (Qt) based configuration tool, works best under KDEdesktop$ make gconfig - X windows (Gtk) based configuration tool, works best underGnome Dekstop.

For example make menuconfig command launches following screen:$ make menuconfig

You have to select different options as per your need. Each configuration option hasHELP 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 kernelitself.# make install

It will install three files into /boot directory as well as modification to your kernel grubconfiguration file:

System.map-2.6.25config-2.6.25vmlinuz-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

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

2 of 42 Monday 10 March 2014 11:27 PM

Page 3: Kernel Compile Nixcraft

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

Step # 7 Modify Grub configuration file - /boot/grub/menu.lst

Open file using vi:# vi /boot/grub/menu.lst

title Debian GNU/Linux, kernel 2.6.25 Defaultroot (hd0,0)kernel /boot/vmlinuz root=/dev/hdb1 roinitrd /boot/initrd.img-2.6.25savedefaultboot

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

Neat. Huh?

Step # 8 : Reboot computer and boot into your newkernel

Just issue reboot command:# reboot

For more information see:

Our Exploring Linux kernel article and Compiling Linux Kernel module only.Official README file has more information on kernel and software requirement tocompile it. This file is kernel source directory tree.Documentation/ directory has interesting kernel documentation for you in kernelsource tree.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!Featured Articles:

30 Cool Open Source Software I Discovered in 201330 Handy Bash Shell Aliases For Linux / Unix / Mac OS XTop 30 Nmap Command Examples For Sys/Network Admins25 PHP Security Best Practices For Sys Admins20 Linux System Monitoring Tools Every SysAdmin Should Know20 Linux Server Hardening Security TipsLinux: 20 Iptables Examples For New SysAdminsTop 20 OpenSSH Server Best Security PracticesTop 20 Nginx WebServer Best Security Practices20 Examples: Make Sure Unix / Linux Configuration Files Are Free From SyntaxErrors

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

3 of 42 Monday 10 March 2014 11:27 PM

Page 4: Kernel Compile Nixcraft

15 Greatest Open Source Terminal Applications Of 2012My 10 UNIX Command Line MistakesTop 10 Open Source Web-Based Project Management SoftwareTop 5 Email Client For Linux, Mac OS X, and Windows UsersThe 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 gcc2.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 –versiongcc (GCC) 4.0.3 20060212 (prerelease) (Debian 4.0.2-9)

uname -aLinux 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 file may be not updated.

Reply

4 Anonymous March 17, 2006 at 9:47 pm

Thanks a lot Gabber Anna,It’s works for me :-))

Reply

5 nixcraft March 17, 2006 at 11:25 pm

LOLNote 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

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

4 of 42 Monday 10 March 2014 11:27 PM

Page 5: Kernel Compile Nixcraft

any guess about boot loader?

Reply

7 debianusr August 18, 2007 at 5:57 pm

After building the kernel and updating grub I’ve rebooted the new kernelsuccessfully. Now I am wondering if this process includes updating the kernelheader files in /usr/include/. If not, what is the best way to do that and should anynew 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. Noneed 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 distro’s like fedora itgonna give up some wierd fixdep.c error messages.

Some forums say you need to have 2.4 headers for compiling it. Kernel header is ahuge 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 menuconfig”.is there anyoption to do that.please help me to get out of this as soon as possible.i wonder

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

5 of 42 Monday 10 March 2014 11:27 PM

Page 6: Kernel Compile Nixcraft

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 findthe make file. Now, just give “$make menuconfig”. It will work…. :)

Reply

14 Krishna Priya Bandyopadhyay June 20, 2010 at 7:42 pm

Thanks for ur reply.I’m working fine 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 andmodules. 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 completeinstallation

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 goesokay, but failed to boot the new kernel image with the follow error messages:

PCI: BIOS Bug: MCFG area at e0000000 is not E820-reservedPCI: Not using MMCONFIG

Read Hat nash version 5.0.32 Startingmount: error mounting /dev/root on /sysroot at ext3: No such device….

In initrd.img file, I found no libata.ko or any other .ko modules are added beforemkrootdev.

Is this problem caused by incorrect or even no HDD controller driver loaded? I didnot see appropriate entry for libata in .config file. Do you guys have any suggestionon make it through?

Thanks.

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

6 of 42 Monday 10 March 2014 11:27 PM

Page 7: Kernel Compile Nixcraft

-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 modulesagain, 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 OSagain…

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 whentried to boot my system from latest compiled kernel got the Kernel Panic errorwhich says can’t findfile 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.164-bit, the command in Step # 6 is “mkinitramfs” instead of “mkinitrd”.

Can’t wait to try out my new kernel…

Reply

23 Abdul April 12, 2011 at 10:51 am

That helped me Thanks!!!!!!!

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

7 of 42 Monday 10 March 2014 11:27 PM

Page 8: Kernel Compile Nixcraft

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 config-2.6 file.What have I done wrong? I see config files from old kernel there. thanks inadvance.

Reply

26 saga December 14, 2008 at 3:43 pm

you have compiled a upstream kernel.How should i compile distribution specifickernels,like if i install fedora it has its kernel source in /usr/src/, fedora communitymight have added its own patches.Will the steps described in this article work fordistribution specific kernels?

Reply

27 anand December 21, 2008 at 4:06 am

Except for step where you create the initrd img file, rest of the steps explainedhere worked fine. The Kernel version I tried was 2.6.27.10 and the linux box hadubuntu 8.10 installed.

On ubuntu if you try to use mkinitrd you might get the message “No commandfound”. Try using mkinitramfs instead. It worked perfectly fine.

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

It’s cool.Thanks alot NIXTCRAFT.

Reply

30 Carnes December 29, 2008 at 9:53 am

I tried to cheat and copied over an older .config.. broke something and had to redoall the options by hand : /

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

8 of 42 Monday 10 March 2014 11:27 PM

Page 9: Kernel Compile Nixcraft

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 misconfiguring the kernel.If you aren’t sure what your hardware is or don’t have the time to run throughevery option. I suggest you pop in a live cd and copy “/proc/config.gz” to use asyour base config (“gzip -d config.gz” will uncompress it).

If your system is already unusable, pop in a live cd and try the following as root:“cd /”“mkdir /mnt/fixme”“mount /dev/ROOTDRIVE /mnt/fixme”“mount /dev/BOOTDRIVE /mnt/fixme/boot”“mount -t proc proc /mnt/fixme/proc”“chroot /mnt/fixme /bin/bash”

That should put you back into your computer to compile/fix whatever.

Reply

31 benny lootens January 4, 2009 at 2:40 am

i’ve just build the 2.6.28 kernel on ubuntu 8.04 LTS and it’s working like a charm.It was required, as I had some troubles installing my 500 GB Samsung drive thatwas attached to a Trust eSATA IF-3300 card. Thanks for this great tutorial !!

Reply

32 Otto January 6, 2009 at 6:41 pm

You don’t need make modules anymore. I compiled a few times the last days andjust 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.23make: *** [.tmp_vmlinux1] Error 1

Plz provide me solution for it.ThanksAkash

Reply

34 Akash January 7, 2009 at 1:06 pm

make command error:make: *** [.tmp_vmlinux1] Error 1

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

9 of 42 Monday 10 March 2014 11:27 PM

Page 10: Kernel Compile Nixcraft

Kindly suggest solutionregards————-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 menuconfig (or whatever you want)2. make-kpkg –revision kernel_image3. Install the resulting .deb package using dpkg.

The debian package management system then knows about your custom kernel andit handles all needed actions to get the kernel properly working. For example initrdis done automagically if needed.

I compile the root file system and the way to access it directly into kernel andcustomize the kernel sharply to the computer. That way you wont need initrdanymore :) and the machine boots quite fast, because the chipset drivers are activefrom 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 fedorabut when I try to run it ..it says kernal panic and doesn’t proceed any further

Reply

37 Anonymous February 17, 2009 at 9:04 am

If you have multiple CPU-kernels, you’d consider using the -j option for make, forexample make -j5 , which will use 5 instance of make to built the process. This willspeed 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:

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

10 of 42 Monday 10 March 2014 11:27 PM

Page 11: Kernel Compile Nixcraft

{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.2debian etch

got some ideas? thanx

Reply

39 trevor February 19, 2009 at 9:10 am

a very good clarification about kernels,i’m 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 file not found.

i use the following commandtitle Debian GNU/Linux, kernel 2.6.25 Defaultroot (hd0,0)kernel /boot/vmlinuz root=/dev/hdb1 roinitrd /boot/initrd.img-2.6.25savedefaultboot

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

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

11 of 42 Monday 10 March 2014 11:27 PM

Page 12: Kernel Compile Nixcraft

my mail is [email protected]

Reply

43 Hussain Jaffar 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 ofconfiguration step for linux 2.6.29.2make[1]: *** [script/kconfig/dochecklxdialog] Error 1make: *** [menuconfig] Error 2

Plz provide me solution for it.ThanksJ.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.xxThe installation guide specified to patch the linux 2.6.xx, configure and thencompile. Buti m able to proceed til the configuration 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 struckup while compiling……

Kindly help please…Wil be grateful to you…

Reply

46 chindam May 29, 2009 at 5:45 am

It’s good, but i need your help to compile;boot from a flash drive and configureoptions such that the size of the kernel is max 5Mb(minimum application liketerminal,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

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

12 of 42 Monday 10 March 2014 11:27 PM

Page 13: Kernel Compile Nixcraft

recognize coretemp,I compiled 2.6.30.1 kernel and it’s 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 missingsome files like ncurses etc, but after getting them it all flowed smoothly… thanksalot again :)

Reply

49 Kousik July 20, 2009 at 8:33 am

This is nice documentation. But I think some modification is required.

Step # 6: Create an initrd imageType the following command at a shell prompt:# cd /boot# mkinitrd -o initrd.img-2.6.25 2.6.25Instead of mkinitrd I use mkinitramfs in ubuntu 9.04

Step # 7 Modify Grub configuration file – /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 inLinux kernel 2.6,1. describe how to greate it2. describe what they do

Reply

51 Sivakumar September 23, 2009 at 1:08 am

HiI am using ubuntu distribution, I like to update my kernel , my present versionkernel is 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686GNU/Linux.i downloaded latest kernel source from kernel.org “linux-2.6.31.tar.bz2″ i followedthe following steps to configure my kernel

1. i extracted the kernel source file in usr/src2. I updated my gcc complier

root@sivakumar-desktop:/usr/src# apt-get install gccReading package lists… Done

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

13 of 42 Monday 10 March 2014 11:27 PM

Page 14: Kernel Compile Nixcraft

Building dependency treeReading state information… Donegcc is already the newest version.0 upgraded, 0 newly installed, 0 to remove and 228 not upgraded.

3. Then i tried to run make menuconfig, i got the following error

root@sivakumar-desktop:/usr/src# make menuconfigmake: *** No rule to make target `menuconfig’. Stop.

4. then i tried

root@sivakumar-desktop:/usr/src/linux-2.6.31# make menuconfig*** Unable to find the ncurses libraries or the*** required header files.*** ‘make menuconfig’ requires the ncurses libraries.****** Install ncurses (ncurses-devel) and try again.***make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1make: *** [menuconfig] Error 2

Reply

52 Aks March 26, 2011 at 6:55 pm

Hi there,

To resolve this issue you have to first complete all update of you system thentry 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 configure the kernelthat error is make: *** No rule to make target ‘menuconfig’, Stop.

Reply

55 Mukesh October 11, 2009 at 1:29 am

Hello,Can Any One Solve My Problem That Is

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

14 of 42 Monday 10 March 2014 11:27 PM

Page 15: Kernel Compile Nixcraft

after extracting there is some error when i configure the kernelthat error is make: *** No rule to make target ‘menuconfig’, 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 fix the kernel panic issue that waspointed to several time here? I have the same issue. After installing the new kerneland trying to boot into it, I see the kernel panic since it doesn’t see any of mydrives ( “/”, “/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 sucessfullyand after reboot i can see my new kernel in the grub.. but when i select .andproceed . 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 kenel2.7.13..Thanx in advance….

Reply

59 GARG November 6, 2009 at 1:10 pm

problem occur on booting…mount: unknown file 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 files created in the direction /bootKernel image: /boot/vmlinuz-2.6.31.4-smpInitrd image: /boot/initrd-2.6.31.4-smpHowever,One file config is missed.

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

15 of 42 Monday 10 March 2014 11:27 PM

Page 16: Kernel Compile Nixcraft

I update the menu.listThen ,reboot.On the way booting,there is no error.but when I inter the X-window ,my keyboard and mouse doesn’t 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 choosein the grub to run the 2.6.31.6 kernel I have the following message:Unable to find 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 thinkbecause I have installed ubuntu with ext4 file system, the kernel could notrecognize it. The kernel is residing in /usr/src which is in the same partition asubuntu.

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 lynxusers

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 filesystem structure” what wrong whit it? My kernel is 2.6.24-16 wantto 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 config file fornewly compiled and installed kernel and also after successful installation ofkernel.2.6.32 , i am not able to boot from this kernel as it says file system notdetected , /dev/hda not detected……..and kernel panic……….

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

16 of 42 Monday 10 March 2014 11:27 PM

Page 17: Kernel Compile Nixcraft

Reply

66 princelibya14 April 14, 2010 at 12:31 pm

hi, bro , just try theses commend , cause i got the same problem when i usedthem every thing is going ok, i wish them helping u, (1. make mrproper2.cp /boot/config-`uname -r` ./.config ,Then we run 3.make menuconfig) sothese two commends use them before make menuconfig, and also do not usemake 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 KVMvirtualization support. VirtualBox won’t 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 youperhaps update the article?

- Some systems now use GRUB 2, which doesn’t have a menu.lst.- Modern systems tend to use mkinitramfs or yaird, not mkinitrd.

Thanks a lot for the article, though. Off 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 myresultlesattemtions 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 insteadI used next steps to compile linux kernel(2.6.27.7).Here they are.1. first copy your /boot folder to somewhere , home folder2. go to top of your linux source tree and run(root prev required)#make-kpkg clean && make-kpkg –initrd –revision=custom.1.0 kernel_imageand after its finished with no errors run#dpkg -i .debthe latest command will update your /boot also /boot/grub/menu.lst file , but this isnot whatdo we want , and after reboot you may find your pc not booting at all.

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

17 of 42 Monday 10 March 2014 11:27 PM

Page 18: Kernel Compile Nixcraft

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.7so we have to copy these files to some temp folder , then restore our old /bootfolderfrom backup and copy back again our fresh kernel and image from temp folder to/boot.to finish we need edit /boot/grub/menu.lst file.here we can simply copy our generic boot items and make no change except namesof 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) fileI lol’d.

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 makeyou wanna do something else, but boss doesnt understand the meaning of ‘I do myjob so good nobody gets errors, therefore nobody needs IT support’) with theexcuse that my code is compiling (thanks xkcd.com for the idea). All i do is runmake on the source directory, and once im done with slackin’ i just run “makeclean” to revert any changes :b

Reply

73 Tom March 14, 2010 at 5:13 am

This is after I’ve done step#2 and installed gcc.When I use this command “make xconfig” I’m getting this error “No rule to maketarget”.Any ideas on how to fix 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

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

18 of 42 Monday 10 March 2014 11:27 PM

Page 19: Kernel Compile Nixcraft

then typepla@pla # make menuconfig or make xconfigmake sure that ncurses package is installedall 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 thereis 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 config file 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 myproblem is (i can not access on internet) by using wire or less card, wheni run commend (iwconfig i got message no wireless extension for eth1 )sosholud i got these from last kernel on my new kernel when i configure it,and also when i search i got article i have to install package for wirelesschip . 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 , iattempt to solve it, but nothing.plz help me as soon as u can , cause i amin 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 don’t know how to add this ifanyone 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 then2.administration 3. choose language from the menu. 5 enter ur password, atlast choose Portuguese language ,

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

19 of 42 Monday 10 March 2014 11:27 PM

Page 20: Kernel Compile Nixcraft

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 different. I have ported linux on the device. I havedone “make menuconfig” to make on the portuguese character set ,but itshows this error.HOSTLD -static scripts/kconfig/mconf/usr/bin/ld: cannot find -lncurseswcollect2: ld returned 1 exit statusmake[1]: *** [scripts/kconfig/mconf] Error 1make: *** [menuconfig] Error 2i 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 Ichoose in the grub to run the 2.6.31.6 kernel I have the following message:Unable to find 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 thinkbecause I have installed ubuntu with ext4 file system, the kernel could notrecognize it. The kernel is residing in /usr/src which is in the same partition asubuntu.

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 thekernel

Also if nothing else works I think you could bootstrap it with an initrd to

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

20 of 42 Monday 10 March 2014 11:27 PM

Page 21: Kernel Compile Nixcraft

make it boot in ext4

Reply

84 pankyubootha May 23, 2010 at 11:14 am

hi kishore, i think enabling SYSFS_DEPRECATED in the config file i.e.“.config” and recompiling the kernel should resolve the issue. but thismay lead to udev being adversely affected. also remember to enableLBDAF in the kernel profiling segment of the .config file. good luck.PankyuBootha.

Reply

85 Jagan May 17, 2010 at 9:46 am

Hi AllIs there any changes needed during kernel configuration for USB boot support.what are the steps required for USB boot, starting from the compilation.

any help would appreciated!!!!!RegardsJagan

Reply

86 ahmeds May 25, 2010 at 3:24 am

Hi Jaqan. I guess for USB boot support no kernel conf needed. Becauseyour 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 itsays mkinitrd command not found.. Anyone can help me? D:Thanksps: 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 find proper

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

21 of 42 Monday 10 March 2014 11:27 PM

Page 22: Kernel Compile Nixcraft

initrd.img fornew kernel, as mkinitrd doesn’t work on new distrs and a lot of other stuff.I put here the answer that foundhttp://www.cyberciti.biz/tips/compiling-linux-kernel-26.html/comment-page-7#commentslucks.

Reply

90 Jeff June 9, 2010 at 10:51 pm

Howdy y’all. I just wanted to ask about this process. We own a lot of RHEL/CentOSsystems round here and I’m curious how the kernels built with this process willdiffer from the kernels shipped from the standard repositories. I’ve lookedcountless places for a guide to recompiling a kernel specifically with the sourcefrom those OSes, but something has always failed, or not been in the right location,etc. I’m currently building a kernel using the described process and it actuallyseems to be working, but I’m just wondering what functionality loss there will be.

Reply

91 Jeff June 10, 2010 at 12:29 am

Hi everyone. I just wanted to ask about this process. We own a lot of RHEL/CentOSsystems round here and I’m curious how the kernels built with this process willdiffer from the kernels shipped from the standard repositories. I’ve lookedcountless places for a guide to recompiling a kernel specifically with the sourcefrom those OSes, but something has always failed, or not been in the right location,etc. I’m currently building a kernel using the described process and it actuallyseems to be working, but I’m just wondering what functionality loss there will be.

Reply

92 Jeff June 10, 2010 at 12:39 am

Weeell…

New kernel compiled, but either doesn’t have SATA or LVM support, as it’sfailing to mount root at boot and kernel panicing. At least I got the darn thingcompiled … all I really wanted to accomplish at the moment

Reply

93 Pankyu Bootha June 10, 2010 at 6:00 pm

Hi Jeff, As I had said earlier, for RHEL, CentOS and such cognatesystems, I have found that one has to enable SYSFS_DEPRECATED whilecompiling the kernel versions > 2.6.33. As for enabling SATA support, inthe relevant section of the .config file one has to enable scsi/ide supportwhile configuring the kernel. Pl first copy “.config” on desktop afteruncompressing the tarball in your home directory-

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

22 of 42 Monday 10 March 2014 11:27 PM

Page 23: Kernel Compile Nixcraft

$ bzip2 -dc linux-2.6.34.tar.bz2 | tar -xvf -. You can copy .config file by-

$ mv /home/jeff/linux-2.6.34/.config /home/jeff/Desktop/config.text. Thencopy config.text in your home folder/directory.

Now read the config.text file carefully in gedit. you can search forSYSFS_DEPRECATED by using the interactivesearch available in the topwindow-bar of gedit. Also go through the scsi and ide drivers section.

To manually enable the required features do-

CONFIG SYSFS_DEPRECATED=y

Remember to uncomment the relevant by removing the ‘#’.

Affter you have thus enabled the relevant features, replace config.text tolinux-2.6.34 by-

$ mv /home/jeff/Desktop/config.text /home/jeff/linux-2.6.34/.config

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 noany error while doing compilation process.But after step 5( Step # 5 Install kernel# make install ) , I am not getting config file in /boot for newkernel. I m getting systemmap,vmlinuz and initrd for new kernel.So asper step 6 for mkinitrd, it shows already exists.

And when i rebooted machine with new kernel , getting kernel panic , /dev/root fileystem not found.

OS: CENTOS 5.5KERNEL : 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 config file missed for new

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

23 of 42 Monday 10 March 2014 11:27 PM

Page 24: Kernel Compile Nixcraft

kernel at /boot folder, but you can copy it manually from source directory of thenew kernel that you compiled. At step 3 you have to configure your new kernelusing make menuconfig, make oldconfig , or another one of your choise. This stepwill do nothing else but create.config file at the top of your source dir. As usual all files in unix that begin with dotare hidden so .config file too. Just copy it to your /boot folder using# cp .copnfig /boot/config-2.6.x.yRegarding kernel panic you have to specify right root filesystem.Either the problem is with your initrd file and sometimes it is becoming realheadacheto get proper initrd for new kernel that doesn’t panic.What I do really advice just try if it will work do make oldconfig. This will configyourkernel using configuration of currently running one. And dont use make initrd butrenameand use initrd file file 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 kerneljust for update your current system then I can’t help you. But if you want tocompile kernel so that you could start to kernel programming then just say helloto bulk of the problems waiting you ahead. I spent 4 month for compiling my kernelthat didn’t panic. It was 2.6.27.7 . I also learned how to configure kernel tocompile all necessary drivers built in so that kernel loaded without headache initrd.But with 2.6.34.xx things are a little bit different. I didn’t come yet to this level butwhat I may advice you is next:1. download kernel source code of the exact version that is currently running, sothat make oldconfig doesn’t complain to anything and if it does say yes.2. try again more and more.3. specify RIGHT ROOT filesystem. i.e. root=/dev/sda5 or root=/dev/hda2The list of filesystems and your root filesystem you can find by df commandfor example my root file system(/) mounted on /dev/sda7john@lnx:~$ dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/sda7 18482044 15095664 2447528 87% /none 504828 304 504524 1% /devnone 509044 212 508832 1% /dev/shm

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

24 of 42 Monday 10 March 2014 11:27 PM

Page 25: Kernel Compile Nixcraft

4. If these wouldn’t 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:~$ lsmodModule Size Used bybinfmt_misc 6587 1rfcomm 33421 4…get module information for each module using modinfo.john@lnx:~$ modinfo binfmt_misc | grep filenamefilename: /lib/modules/2.6.32-21-generic/kernel/fs/binfmt_misc.koGo to your kernel source code open fs/Makefile file. Find “binfmt_misc.o” string(Note: .o not .ko).obj-$(CONFIG_BINFMT_MISC) += binfmt_misc.oThen open .config file of your kernel (off course after make oldconfig ) and find“CONFIG_BINFMT_MISC”.

CONFIG_BINFMT_MISC=mm means compile as module. If you want this driver to be compiled built in justchange m here to y and save your .config file.CONFIG_BINFMT_MISC=y

You dont have to compile all of your drivers as built in just those which is necessaryfor mounting root file system, i.e. hard disk drivers, scsi if present, ext3 or 4 if theyare 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 idedisk.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 kernel2.6.18-194.3.1.el5 and I want to install 2.6.34.1. All teh steps went fine, no errors,but I had to manually copy .config into /boot/config-2.6.34.1. After reboot, sameerrors like Rocky and also “Volume group Volgroup00 not found” which is why / isnot mounted.# df -hFilesystem Size Used Avail Use% Mounted on/dev/mapper/VolGroup00-LogVol0071G 21G 46G 32% //dev/sda1 99M 35M 59M 37% /boottmpfs 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 file# NOTICE: You have a /boot partition. This means that

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

25 of 42 Monday 10 March 2014 11:27 PM

Page 26: Kernel Compile Nixcraft

# 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/sdadefault=2timeout=5splashimage=(hd0,0)/grub/splash.xpm.gzhiddenmenutitle CentOS (2.6.34.1)root (hd0,0)kernel /vmlinuz-2.6.34.1 ro root=/dev/mapper/VolGroup00-LogVol00 rhgb quietinitrd /initrd-2.6.34.1.imgtitle 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 quietinitrd /initrd-2.6.18-194.8.1.el5.imgtitle 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 quietinitrd /initrd-2.6.18-194.3.1.el5.imgAny help?:)

Reply

100 Rocky August 1, 2010 at 3:52 pm

Hi,

You can resolve this error.Follow this steps.After menuconfig.open .config file and addCONFIG_SYSFS_DEPRECATED_V2=y and then compile the kernel.Your issuewiil 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 existsbut the system boots up ok, so I guess I can ignore it.Kernel 2.6.34.1 running :D :uname -rsLinux 2.6.34.1

Reply

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

26 of 42 Monday 10 March 2014 11:27 PM

Page 27: Kernel Compile Nixcraft

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 any1 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 don’t think you’re suppose to do it in /usr/src when you’re installing.

Reply

105 deepak goel October 20, 2010 at 6:12 am

hiiii am using kernel 2.6.33 but i want to compile 2.6.23i get a error getline function conflict when i change the name of it i’ll get errors inmake install commandERROR: modinfo: could not find module garpERROR: modinfo: could not find module stp

plz suggest how i’ll 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.36everything is ok during compiling and installingbut after reboot my system it tell me “could not load /lib/modules2.6.36/modules.dep: no such file 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.

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

27 of 42 Monday 10 March 2014 11:27 PM

Page 28: Kernel Compile Nixcraft

on trying to install initrd-tools getting the following error…..Unable to locatepackage initrd-tools….its very urgent….please can anyone tell what is gettingwrong

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 file 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 ubuntuvirtual box. I had some issues with installing the ncurses library, and then with themkinitrd command, but managed to resolve both of them.

However, just the make step took nearly 6 hours to complete. I thought this was OKuntil I read in several places that it usually takes around the order of 20 minutes orso. What might I be doing wrong?

I am running ubuntu on a virtual machine, with 512 MB RAM and 10 GB HDDspace. Any help would be greatly appreciated.

Thanks!

Reply

110 anany December 24, 2010 at 10:33 am

Hithanks 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.

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

28 of 42 Monday 10 March 2014 11:27 PM

Page 29: Kernel Compile Nixcraft

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 toolong.

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 gccversion is 4.4,uname -a gives msgsLinux A2MD15118 2.6.32-28-generic #55-Ubuntu SMP Mon Jan 10 21:21:01 UTC2011 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/Makefile:81: stack protector enabled but no compilersupportCHK include/linux/version.hCHK include/generated/utsrelease.hCC kernel/bounds.scc1: error: unrecognized command line option “-mregparm=3″kernel/bounds.c:1: error: bad value (i586) for -march= switchmake[1]: *** [kernel/bounds.s] Error 1make: *** [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) filebz3I lol’d

Reply

115 Neal Anderson March 23, 2011 at 6:44 am

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

29 of 42 Monday 10 March 2014 11:27 PM

Page 30: Kernel Compile Nixcraft

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

I was compiling the kernel on fedora 13 when i issued make makeconfig command igot some errors same as make*** . Thats ok , the solution is install ncurses-devel… fine enough??

ok now shoot yum clean alll….thats it….now again run make makeconfig ;) here you go :D

Reply

116 deadman April 10, 2011 at 7:27 am

heyi’m having problems while doing make for 2.6.38its shows 44 sections mismatch(es)i ignored it and installed the thingbut on loading its shows kernel panicplz help

Reply

117 Garfield 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 aconfig file.Depending on your distro, you might also have to add a few other kerneloptions 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,

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

30 of 42 Monday 10 March 2014 11:27 PM

Page 31: Kernel Compile Nixcraft

I am trying to build the new kernel (2.6.38) and facing the similar issue as in thecomment # 97. I followed the instructions in comment #98 but not able to fix theproblem. As I start the make, the .config file is renamed to .config.old and thechanges is lost. Can you help me fixing 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 didn’t have to apply teh lasttwo steps ,ie, creating initrd image and editing the boot loader. Those steps ahevbeen automatically done . Btw, I performed it in SuSe 11.3. Will it be the same inother 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 ..I’ve 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 afterinstalling kernel-package)

now everything works fine, 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….

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

31 of 42 Monday 10 March 2014 11:27 PM

Page 32: Kernel Compile Nixcraft

make: *** No rule to make target `menuconfig’. Stop.

also i have tried….

sudo apt-get install libncurses5-dev

but following error is occuring….Reading package lists… DoneBuilding dependency treeReading state information… DoneE: Couldn’t find package libncurses5-devplz..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 tolinux (cd /usr/src/linux )

Reply

125 Mayank August 25, 2011 at 6:22 am

hiI am using RHEL6 kernel version 2.6.32-71.el6.x86_64and recompile on kernel version 3.0.3upto this “make install” step everything going smoothlyafter doing this i am not getting that three files* System.map-3.0.3* config-3.0.3* vmlinuz-3.0.3so i am not be able to make initramfs.img file with this version

so now what i can dois 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. There’s a mistake in the “Step # 2″ title. It should be “.bz2″ not “.bz3″.

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

32 of 42 Monday 10 March 2014 11:27 PM

Page 33: Kernel Compile Nixcraft

Reply

128 Vasavi September 18, 2011 at 8:54 am

Hi,Open file using vi:# vi /boot/grub/menu.lst

title Debian GNU/Linux, kernel 2.6.25 Defaultroot (hd0,0)kernel /boot/vmlinuz root=/dev/hdb1 roinitrd /boot/initrd.img-2.6.25savedefaultbootI tried to open the menu.lst file but it is being opened in vi as a new file. So, I justupdated grub and rebooted but in the boot loader list I don’t have the kernel Iinstalled 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

I’m using Ubuntu 12.04.1 LTS. There is not menu.lst in it either. I ignored themenu.lst and just ran update-grub and restarted the system, it worked fine forme. 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 fordo_hypervisor_callback does not evaluate to a constantmake[2]: *** [arch/x86/kernel/entry_64.o] Error 1make[1]: *** [arch/x86/kernel] Error 2make: *** [arch/x86] Error 2

Reply

132 Kevin Kirkwood January 4, 2012 at 7:45 pm

I am having the identical problem.

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

33 of 42 Monday 10 March 2014 11:27 PM

Page 34: Kernel Compile Nixcraft

have you found a solution to the problem yet?

This is something I need resolved ASAP.

If so I would really appreciate the fix.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 configuration.

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 I’m 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 (first use inthis function)make[2]: *** [samples/hidraw/hid-example] Error 1make[1]: *** [samples/hidraw] Error 2make: *** [vmlinux] Error 2”So can anyone tell me what I should do. All other steps are going fine.

ThanksBhavin

Reply

135 Anisha Kaul January 20, 2012 at 5:36 am

Do,# cd /boot/grub# ls

Do you find menu.lst there? If yes, the do# cat /boot/grub/menu.lst

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

34 of 42 Monday 10 March 2014 11:27 PM

Page 35: Kernel Compile Nixcraft

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, asshown 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

Confirmed …Working on rhel-5.6 32bit. No need to use “mkinitrd -o initrd.img-2.6.25 2.6.25″ command.

Today I have install 2.6.30.5 kernel.

ThanksSakib

Reply

138 mouli February 7, 2012 at 3:48 am

I followed the tutorial till step 7. On step 7 Modify Grub configuration file –/boot/grub/menu.lst, I am not able to find 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 fine: update-grubI 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 :

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

35 of 42 Monday 10 March 2014 11:27 PM

Page 36: Kernel Compile Nixcraft

tm@ubuntu:/usr/src/linux-2.6.27.12$ sudo makeCHK include/linux/version.hCHK include/linux/utsrelease.hCALL scripts/checksyscalls.shCHK include/linux/compile.hVDSO arch/x86/vdso/vdso32-int80.so.dbggcc: error: elf_i386: No such file or directorymake[1]: *** [arch/x86/vdso/vdso32-int80.so.dbg] Error 1make: *** [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 menuconfig :( and i have already3.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 5vmlinuz-3.3.6System.map-3.3.6config-3.3.6initrd.img-3.3.6grub

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 issuccess but after reboot it was going to initird$ promt, but i want GUI to login .canany one please tell me the proceser for how to bring up the board to GUI…..

Reply

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

36 of 42 Monday 10 March 2014 11:27 PM

Page 37: Kernel Compile Nixcraft

145 Handra July 20, 2012 at 1:31 am

Hi, thanks mate….. I follow your tutorial. It works like a charm. Kernel version3.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 menuconfig but when i run make afterwards i get the followingerror

root@paul-MS-N014:/usr/src/linux-headers-3.2.0-26-generic-pae# makemake[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 thedirectory name, it is just the header files. Make sure that you download thefull source code first 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 didn’t knew compiling linux kernel 2.6 was so easy…vivek man you haveexplained it well in just 8 steps..

Reply

150 Pankaj August 27, 2012 at 8:48 am

When i am giving the command “make menuconfig”i am getting an error belowNo rule to make target `menuconfig’. Stop.please anybody can help

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

37 of 42 Monday 10 March 2014 11:27 PM

Page 38: Kernel Compile Nixcraft

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 menuconfigmake cleanmake bzImagemake modulesmake modules_installmake installthese steps worked for me…

Reply

153 aditya January 8, 2014 at 9:36 am

[aditya@localhost linux-3.12.6]$ make menuconfigMakefile:323: /home/aditya/linux-3.12.6/scripts/Kbuild.include: No such file ordirectorymake: *** empty variable name. Stop.make: *** [scripts_basic] Error 2please 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 howto 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 *

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

38 of 42 Monday 10 March 2014 11:27 PM

Page 39: Kernel Compile Nixcraft

Notify me of followup comments via e-mail.

Submit

Tagged as: command tar, compile kernel, compiling linux kernel, configuration option,configuration tool, gnu linux, how to compile linux kernel, kernel code, kernelconfiguration, kernel image, kernel source code, kernel v2, kernel version, latest linuxkernel, 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

+ 10,343

Follow +1

Tweets by @nixcraft

Related Posts

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

39 of 42 Monday 10 March 2014 11:27 PM

Page 40: Kernel Compile Nixcraft

Howto: Build Linux Kernel Module Against Installed Kernel w/oFull Kernel Source Tree

Redhat Enterprise Linux securely mount remote Linux /UNIX directory or file 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

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

40 of 42 Monday 10 March 2014 11:27 PM

Page 41: Kernel Compile Nixcraft

HowTo: Linux Check IDE / SATA Hard Disk Transfer Speed

Linux command to gathers up information about a Linuxsystem

Increase the maximum number of pseudo – terminals ~ PTYon Linux for remote Login session

Debian Linux Version 6.0.2 Released

nixCraft

42,580 people like nixCraft.

Facebook social plugin

Like

Like

Latest Linux/Unix Q & A

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

41 of 42 Monday 10 March 2014 11:27 PM

Page 42: Kernel Compile Nixcraft

HowTo: Setup SSH Keys on a Linux / Unix SystemLinux / Unix: chroot Command ExamplesMinify and Compress CSS & Javascript Files At a Linux/Unix Shell PromptCentOS Install Lighttpd Web-server With yum CommandCentOS Install Java SDK using yum CommandCentOS: rpmdb: PANIC: fatal region error detected; run recovery error andsolutionHowTo: Update gcutil / gcloud Components On a Linux / Unix / OS Xcurl Command Resume Broken DownloadFreeBSD Show Disk Quota Limits CommandExplain: {,} in cp or mv Bash Shell CommandsUbuntu Copy File CommandLinux: Log Suspicious Martian Packets / Un-routable Source AddressesIncrease NFS Client Mount Point Security For a Web-Server noexec, nosuid,nodev OptionsHowTo: Prevent Yum From Upgrading The Kernel On a CentOS / Red HatEnterprise LinuxUnix / Linux: Check New Files In File System /var/www/uploads/Linux / Unix: Check Last Time User Logged In On The SystemCentOS / RHEL: Yum Lock Package Version At a Particular VersionCentOS Linux 5/6: Change OpenSSH Port NumberLinux / Unix: whereis Command ExamplesNginx: Redirect Backend Traffic Based Upon Client IP Address

Subscribe to nixCraft

Learn something new about Linux/Unix by emailEnter your email address:

Subscribe

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

How to: Compile Linux kernel 2.6 - nixCraft http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

42 of 42 Monday 10 March 2014 11:27 PM