# **Compiling a Linux Kernel**
## **What is a Kernel?**
>A kernel is the lowest level of software that interacts with the hardware in your computer, and it's the core of your Linux OS.
---
## **The Linux Kernel**
>The Linux kernel is monolithic, it has a large footprint and it's more complex than the other types of kernel.
---
# Compiling the Kernel
For this example we're going to use Ubuntu 14.04.5
To compile a Linux Kernel we have to follow a few steps:
---
* ### Step 1
First of all we're going to edit our grub config file:
```
sudo vim /etc/default/grub
```
And make the following changes:
***"GRUB_HIDDEN_TIMEOUT_QUIET=true"*** to ***"#GRUB_HIDDEN_TIMEOUT_QUIET=true"***
And
***"GRUB_TIMEOUT=2"*** to ***"GRUM_TIMEOUT=10"***
---
* ### Step 2
Now we're going to download the latest kernel.
In this report, we're going to use "links", but it can be downloaded through a browser or using "git".

And we're going to extract the downloaded kernel using "tar"
```
tar xvf linux-4.12-rc4.tar.gz
```
---
* ### Step 3
We're going to enter the new kernel's directory, and we'll copy our system's current config file.
```
sudo cp /boot/config-4.4.0-31-generic .config
```
For this report, we are going to make a local mod config, which will check what's currently loaded into the kernel, making the config file based on that.
***NOTE: This method shortens the compilation time, but it will take some of the compability of the kernel for new hardware, but your current setup will work fine. Since we are doing this in a virtual machine, I think that's a good idea since it wil take less time.***
```
make localmodconfig
```
We will leave our finger pressed on Enter, to accept all the defaults.
---
* * ### Step 4
Now we're going to install the tools that will allow us to compile our kernel
```
sudo apt-get install build-essential libssl-dev
```
---
* ### Step 5
Now we are finally going to compile our kernel. To do so:
```
make -j*
* the number of threads that we'll want to use
```
---
* ### Step 6
Now we'll install our brand new kernel, for that we'll input the following command:
```
sudo make modules_install install
```
---
* ### Step 7
And we are done.
Now we are going to reboot our machine, and to check if we are indeed using the new kernel, to do so we'll hit:
```
uname -a
```

---
**Sources:**
* https://www.youtube.com/watch?v=XRJDKris5Bs
Made by: Rodrigo Oliveira TIIGR0916B