terça-feira, 16 de fevereiro de 2016

How to compile kernel CentOS 7

Pre-requisites:

1 - We need to install some packages, they are gcc* bison ncurses-devel rpm-build make wget openssl-devel bc, see below.

1.1 From terminal like root type yum install gcc* bison ncurses-devel rpm-build make wget openssl-devel bc:









2 - Download the last kernel version Kernel Linux. Go to https://www.kernel.org web site and check out, see below:

2.2 From terminal like root type wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.1.tar.gz:


2.3 Checking the Current kernel; From terminal type uname -r:




 

 

Steps to recompile the kernel

3 - Copy the file previously downloaded to /usr/src, it will be installed and compiled. From terminal like root type cp /<directory-whereis-the-file-downloaded /usr/src:



3.1 - Go to /usr/src directory; Type cd /usr/src.
3.2 - Unzip the file; From terminal type tar -xvf linux-4.4.1.tar.gz:
 


3.3 - Go to the directory where the files were unziped; From terminal type cd linux-4.4.1:




3.4 - Copy the Kernel configurations to the directory; From terminal type  cp /boot/config-$(uname -r) ./.config:



3.5 - Configure the menuconfig; From terminal type make menuconfig
    - On Kernel configuration go to Load an Alternate configuration file and type .config > click OK
    - Save the configuration and close






 

 

Starting the Kernel compilation 

4 - From terminal type make or make -j4:



Wait the compilation finish, it may delay from 2 to 4 hours.

5 - From terminal type make modules_install:



6 - From terminal type cp arch/x86_64/boot/bzImage /boot/vmlinuz-4.4.1:



7 - From terminal type cp .config /boot/config-4.4.1:



8 - From terminal type cp System.map /boot/System.map-4.4.1:


9 - From terminal type dracut /boot/initramfs-4.4.1.img 4.4.1:


10 - Invoke the mkconfig, type sudo /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg:
11 - From terminal type reboot and check the new kernel:
12 - Finally after the reboot, type uname -r to see the current kernel version:
 




 

This is it. I hope it may help someone. See you guys !

 

  


 



Nenhum comentário:

Postar um comentário