Saturday, 9 September 2017

Kernel Configuration

Steps:

1.   Download latest version of kernel from https://www.kernel.org/

2.   Take permission as super user using su command and untar it.
      a. ~$ su
               then enter root password.
      b.~$ cd    /usr/src/
              goto this folder.
      c.~$ tar    -xvJf    /home/user/Downloads/linux-4.13.0
              untar it from where you already downloaded.

3.   Goto kernel directory that you already untar.
       ~$ cd   linux-4.13.0

4. Create two directories build and logs
        ~$  mkdir   build    logs
              build directory is to place complied  executable,configuration files.
              logs directory is to place all logs files. maintaining logs is not mandatory.

5. If you created logs directory then continue if not ignore this step.
      a. ~$ cd   logs
      b. ~$ touch   bzImage  modules    modules_install     install
               these files is to put logs at each step.
      c. ~$ cd   ..
               mov back to linux-4.13.0 directory
 
6. Then start your configuration
        a. ~$ apt-get install libncurses-dev
                 install this library before proceeding to next step.if already installed ignore it.
        b.~$  make O=build  menuconfig
                 To enable or disable which modules you want.Now you will get new window.
                 To modularise press m, to disable n and to put option as part of kernel press y
                 that is *.

                 Please follow the instructions provided above.
                 Finally save it. now will get .config file.

7. Now building an image for kernel bzImage and you can save logs to bzImage file and
    open other terminal to see log file bzImage.
       a.~$ apt-get install libssl-dev
               install this library before proceeding to next step.if already installed ignore it.
       b.~$ cd   logs
                in other terminal with super user mode go to logs directory.if you not created
                ignore this.
       c.~$ tail -f bzImage
               logs will be saved here you can see also.after completion.if you not created
               ignore this.
       d.~$ make O=build  bzImage >& logs/bzImage
               if you not created logs directory and files then ignore >& logs/bzImage.
               mean that only ~$ make O=build bzImage
               wait until next shell will come in first terminal.

 8. Now compiling modules putting into modules directory and you can save logs to
      modules file . In second terminal press ctrl+c.
       a.~$ tail -f  modules
               logs will be saved here you can see also.after completion.if you not created
               ignore this.
       b.~$ make O=build  modules  >&  logs/modules
               if you not created logs directory and files then ignore >& logs/modules.
               mean that only ~$ make O=build modules
               wait until next shell will come in first terminal.

9. Now installing modules putting into modules_install directory and you can save
    logs to modules_install file.In second terminal press ctrl+c.
       a.~$ tail -f  modules_install
               logs will be saved here you can see also.after completion.if you not created
               ignore this.
       b.~$ make O=build  modules_install  >&  logs/modules_install
               if you not created logs directory and files then ignore >& logs/modules_install.
               mean that only ~$ make O=build modules_install
               wait until next shell will come in first terminal.

10. Now installing kernel putting into install directory and you can save logs to install
      file.In second terminal press ctrl+c.
       a.~$ tail -f  install
               logs will be saved here you can see also.after completion.if you not created
               ignore this.
       b.~$ make O=build  install  >&  logs/install
               if you not created logs directory and files then ignore >& logs/install.
               mean that only ~$ make O=build install
               wait until next shell will come in first terminal.
11. updating grub with newest kernel version.
       a.~$ update-grub
               updating  grub with the new kernel image.
       b.~$ reboot
               rebooting the machine to take effect.


Problems after Kernel Configuartion


1.If your machine gone into kernel panic error.
     a. shutdown the machine by holding the power button(hard reboot).
     b. hold the shift button( in ubuntu) to go into advanced options 
          then choose the any kernel.
     
2.If machine going login loop means after entering password again going to login screen.
    a.shutdown the machine 
    b.hold the shift button(in ubuntu)  to go into advanced option then choose older kernel 
       version then in terminal as super (~$  su )user goto  ~$cd   /etc/default/ directory 
       open grub file that is ~$ vim grub   replace "quiet splash" option into "nomodeset".   
       this problem is due to some unwanted graphics driver.


Choosing the default kernel

  1. Go to same folder as mentioned above (step 2 )  then open  ~$ vim grub  
file then change 
     GRUB-DEFAULT= "1>2"
     because first number( in this case 1 is for advanced options) is for choosing the advanced option and to choose submenu > symbol. second number is for which kernel you want to load.kernel index starts from 0. (In this case 2 is to choose third positioned kernel version). 





No comments:

Post a Comment