How to install kernel on debian !

Debian wheezy using 3.2.0-4-amd64 as default kernel which is old. For that reason today i installed the latest  kernel downloaded from kernel.org. If you are Curious that how you can install the new kernel easily then follow  instructions:

Note: Make sure you have enough space before keep going(More than 8gb)



First we download the kernel:

wget -c http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.7.8.tar.xz


Then download the sign file:

wget -c http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.7.8.tar.sign

Note: i used -c with for wget since i was resumed the download.


Now time of unxz tool:

unxz linux-3.7.8.tar.xz


To be safe i verified the signature by issuing following command:

gpg --verify linux-3.7.8.tar.sign linux-3.7.8.tar






So everything OK.


This time we need to extract the the tar file:

tar xvf  linux-3.7.8.tar ; cd linux-3.7.8


I want fresh installation , So i ran :

make menuconfig

And got error :



So i had to install libncurses5-dev: apt-get install libncurses5-dev Or install all required tools:

sudo apt-get install fakeroot build-essential kernel-package ncurses-bin ncurses-dev


 again run :

make menuconfig

And see if you need anything to change , When finished just use tab to select "Exit" or "Cancel"

At last :





When it will exit the windows , you will see output in your terminal :

root@scientific:/home/scientist/kernel/linux-3.7.8# make menuconfig
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/mconf
scripts/kconfig/mconf Kconfig
#
# using defaults found in /boot/config-3.2.0-4-amd64
#
/boot/config-3.2.0-4-amd64:1564:warning: symbol value 'm' invalid for BMP085
/boot/config-3.2.0-4-amd64:2974:warning: symbol value 'm' invalid for POWER_SUPPLY
/boot/config-3.2.0-4-amd64:3209:warning: symbol value 'm' invalid for MFD_WM8400
/boot/config-3.2.0-4-amd64:4684:warning: symbol value 'm' invalid for COMEDI_MISC_DRIVERS
/boot/config-3.2.0-4-amd64:4691:warning: symbol value 'm' invalid for COMEDI_PCI_DRIVERS
/boot/config-3.2.0-4-amd64:4748:warning: symbol value 'm' invalid for COMEDI_PCMCIA_DRIVERS
/boot/config-3.2.0-4-amd64:4756:warning: symbol value 'm' invalid for COMEDI_USB_DRIVERS
#
# configuration written to .config
#


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.



Avoid everything , Just important indication is "configuration written to .config" 


  clean all unusual files(Generated automatically) following command:

make-kpkg clean
 
 
 
I simply want to build a Debian package(.deb extension) so that i can use default tool dpkg to install the new kernel:
 
 fakeroot make-kpkg -j6 --initrd --revision=3.7.8 --append-to-version=-amd64 kernel_image kernel_headers
 
 
Also calculating the compile time you can run:
 
 time fakeroot make-kpkg -j6 --initrd --revision=3.7.8 --append-to-version=-amd64 kernel_image kernel_headers
 
Note: j5 for parallel if we have multi processor  
When you ran this command, you will see in your terminal lots of output such as :
 [M]  fs/ext2/file.o
  CC [M]  fs/ext2/ialloc.o
  CC [M]  fs/ext2/inode.o
  CC [M]  fs/ext2/ioctl.o
  CC [M]  fs/ext2/namei.o
  CC [M]  fs/ext2/super.o
  CC [M]  fs/ext2/symlink.o
  CC [M]  fs/ext2/xattr.o
  CC [M]  fs/ext2/xattr_user.o
  CC [M]  fs/ext2/xattr_trusted.o
  CC [M]  fs/ext2/acl.o
  CC [M]  fs/ext2/xattr_security.o
  LD [M]  fs/ext2/ext2.o
  LD      fs/ext3/built-in.o
  CC [M]  fs/ext3/balloc.o
  CC [M]  fs/ext3/bitmap.o
  CC [M]  fs/ext3/dir.o
  CC [M]  fs/ext3/file.o
  CC [M]  fs/ext3/fsync.o



Simply it is compiling all the sources, programming functions, system call , devices driver etc.


Install the .deb package and reboot the system and select the new kernel to boot.

entific:/home/scientist# uname -r ; arch
3.7.8-amd64
x86_64


Caution: Be careful When compiling kernel . The system may not even boot. So First try it on your vm . I have no responsible if it damages anything .


There is more easy way to install kernel from debian backport. But installing this kernel perfectly worked for me!




****If you have any questions, feedback then please comment here!

5 comments:

  1. I'm a beginner linux user but still decided to follow your directions. When i had to run the make menuconfig i got an error about make command and i had to install it with apt-get install make. Also i have debian wheezy on a 8 GB SSD (it uses 4.9 gigs) and i ran out of disk space while compiling the kernel, so you forgot to mention it requires a lot of space. Maybe the pros know this well, but there are also noobs like me. =) Otherwise it would probably work, i just can't do the final step on my small drive. Maybe i'll try to clone it to a bigger HDD and install the new kernel there.

    PS: Sorry for my english and ty for this guide!

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. I have edited the post!

      Also if peoples try compiling kernel on their old computer then it may take long time. I compiled the and took only few minutes on my core i7 Laptop.

      Delete
  2. Well, i succesfully cloned my Debian partition to a HDD with GParted and now done with compiling, everything went fine. I have only one question now: how can i remove the old kernel and clear it from the system, because it takes 11.5 gigabytes now, while previously it took only 4-5 gigs.

    ReplyDelete
    Replies
    1. Nice to hear that it went fine. First you should login to your new kernel then remove the old one(Otherwise it will ask you to remove lots of things) .

      You can remove the old kernel with following command:

      command$ dpkg --list | grep linux-image
      ii linux-image-3.2.0-4-amd64 3.2.41-2 amd64 Linux 3.2 for 64-bit PCs

      command$ apt-get remove linux-image-3.2.0-4-amd64

      Again: You should try everything in your non-important computer first. So vm is way to go first.

      Let me know how it goes!

      Delete