0% found this document useful (0 votes)
43 views

Kernel Compilation

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Kernel Compilation

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Figure 1 https://www.kernel.

org

Figure 2 Browser prompt you to download the file

Figure 3 $ sudo apt-get update


Exp No : 05
Date: Linux Kernel Compilation

Aim:
To upgrade the kernel file of the linux operating system using kernel compilation
process.
Apparatus Required:
S.No
Apparatus
.
1 Linux OS
2 Personal Computer

Theory:
Linux kernel compilation provides the user to unlock the features which are not available
for the standard users. Linux compilation process allows the users to modify their kernel
depending on their hardware and software application environment. Following points
shows the steps involved in compiling a kernel.
Steps in Linux Kernel Compilation
 Installing the sources.
 Configuring the kernel (choosing which features and Drivers to compile).
 Compiling the kernel (i.e. typing a single command, and watching...).
 Installing the compiled kernel.
 Updating the boot loader to recognize the new kernel.
 Booting...
 Making the new kernel become the default.
Figure 4 Install build-essential libncurses5-dev gcc libssl-dev bc

Figure 5 Extract the tar.xz archive

Figure 6 Copy the configuration file


Figure 7 Output of menu config
Procedure:

Step 1 Download kernel file from www.kernel.org.


Step 2 $ sudo apt-get update
Step 3 Install following library
 build-essential
 libncurses5-dev
 gcc libssl-dev bc
Step 4 Run the following command to extract the tar.xz archive
$ tar xvf linux-4.14.7.tar.xz
Go to the directory where you downloaded the linux kernel source
Run the following command to navigate to the Downloads directory
$ cd ~/Downloads
Step 5 navigate to the directory with the following command
$ cd linux-4.14.7
Step 6 Copy the boot configuration into the ‘linux-4.14.7’ directory
$ cp -v /boot/config-4.9.0-3-amd64 .config

If above command not working follow step 7 otherwise go to step 8

Step 7 Install following library


$sudo apt-get install bison
If bison library not get installing, follow below command
$ sudo apt-get install flex
Then type
$make menuconfig (Refer Fig.7 for the corresponding output)
Then you will be prompted to a configuration window (Refer Fig.8) and save
the window without changing any configuration

Then press “Ok” / “enter” / “Save” for all other windows without changing
anything refer Fig. 9 and Fig.10

Step 8 $ make deb-pkg


If the above doesn’t work go to step 9 otherwise go to step 10

Step 9 Execute following commands


$sudo rm /var/lib/apt/lists/lock
$sudo rm /var/cache/apt/archives/lock

Figure 8 Configuration Window

Figure 9 Configuration Window 2

Figure 10 Configuration Window 3


$sudo rm /var/lib/dpkg/lock
$sudo apt-get install libelf-dev

Step10 $make deb-pkg

The command will execute for long time depend on the processor and RAM
power as shown in Fig.11

Step11 Run the following command to update the kernel

$ sudo dpkg -i ../linux-*.deb

After that, restart the computer ($ sudo reboot) and your boot screen will
show the updated kernel version as shown in Fig.12

Step12 Kernel version can also be checked in Terminal window, by typing the
following command

$uname -r
Figure 11 Output of dep-pkg command

Figure 12 Updated Kernel version on the boot screen


Result:

Thus the procedure was followed and the kernel file of Linux OS was updated.

You might also like