Six Easy Steps to Compiling and Installing Linux Kernel

Compiling Linux Kernel is used for making your system as very customizable one . User can change kernel modules and device drivers based on their need . Suppose if i want to disable wireless support in my desktop PC [because wifi card is not available in my system] . i can recompile and disable that option in my existing kernel. In this article , the kernel compilation has been described in Six Easy Steps

1. Download the latest version of kernel from
http://kernel.org
The Latest kernel at the time of writing this  documentation
linux-2.6.32.3.tar.gz
or
linux-2.6.32.3.tar.gz
2. Unzip or Extract the archive file [Need Root Privileges ]
# su
# tar -xzvf linux-2.6.32.3.tar.gz -C /usr/src
or
# tar -xjvf linux-2.6.32.3.tar.bz2 -C /usr/src
3. Configure Modules and Drivers [Enable or Disable Drivers Here]
# make menuconfig   (for text mode)
or
# make xconfig      (for xwindow)
or
# make gconfig      (for GNOME – Recommended)
5. Compile Kernel [make command will take min 15 minutes to compile the kernel ]
# make
# make modules
# make modules_install
6. Install Kernel
# make install
Thats it. Now You can use new kernel in your favorite Linux flavors .

4 Responses to “Six Easy Steps to Compiling and Installing Linux Kernel”

  1. manoj kumar says:

    sir, i want to implement a user defined system call. i have made changes in files as needed(as instructed in class). but after this i have to recompile the kernel. how do you do it. because if i extract the same .bz file done before it will create the same copy of kernel without changes i made in the files i made in the present compiled kernel. and i am not able to compile the kernel file i have made changes to(eg. linux folder). is there any possible way to compile the same folder again without extracting again.

  2. admin says:

    You can recompile the same kernel at so many times . Go to the kernel folder
    # su
    #cd /usr/src/linux
    #make menuconfig
    dont change anything simply save the file and exit
    now type
    #make
    Try this . Sometimes without menuconfig make command will not work .

  3. manoj kumar k says:

    sir, i have tried it again, even with a new kernel linux-2.6.32.5 and still after making necessary changes required in files and recompling, the gcc is not able to identify the newcall() function. if possible please send your mobile number to my mail(jonam4321@yahoo.com), i would like to come to you personally to see what is wrong. i am from c batch btech cse.

  4. manoj kumar k says:

    ok, i was somehow able to make the function call. but whatever value i pass to the function, i get -1 as the return. both program and the newcal() definition seems to be fine. also i tried with different data types in the printf statement. then also same output.
    if it is %d then i get -1 as output, %ld then i get fffffff as output. any possible mistake i might have overlooked?

Leave a Response