Hi,
In this post we are going to deal with building Linux kernel from scratch
You must be asking when there are plenty of online resources available to build linux kernel why should we have an other one talking about the same.
Well the answer is pretty simple, this blog is an other way to have linux kernel built in a precise manner which is to the point of building it with no blah blah blah.....
Lets get it started...
From the prerequisites section, download the require softwares and put those in one of your favourite locations...If not open a terminal and navigate to the location you prefer and fire the command below
Mostly we will be using terminal to perform the operations.
The procedure is going to be similar to forth coming versions of linux kernel and to some extent of the past version of kernel as well.
Now is the time verify the kernel that we have downloaded in order to do that proceed as described below...
The development tools packages need to installed and can be done via the following way
The above command set can be executed in one single line as given below but I have split it up to have good view of what we are installing
we have not yet verified the signature of the downloaded kernel package...
In order to verify it, use the following command
The response of the above command execution would be as follows...
The above response is a normal one and to verify the signature, grab the pgp key form pgpserver as given below..
Use the RSA key from the GPG server to verify the signature, In order to do that use the following command
Do not be panic, this is quite an usual response of the execution, if you get any other responses apart form "bad URI" or "bad Signature" which is also fine.
Now untar the file using the following command....
Before we build the kernel we have to build the features and select the modules required, this is a daunting task for a new comer.
We do have a shortcut to perform the operation, use the copy command to copy the existing config file using the following command(s)
The execution of the above command would be resulted as follows
Pick the appropriate one form the option to configure the kernel.
1. config-5.2.8
2. initrd.img-5.2.8
3. vmlinuz-5.2.8
the image given below would justify that too...
This confirms the installation of kernel in to the system.
Well that is it, hope you had great time reading it.
Thanks.
In this post we are going to deal with building Linux kernel from scratch
Prerequisites | |||
---|---|---|---|
Name | Version | Download Page | Direct Link |
Linux Kernel | 5.2.8 | Linux Kernel Download Page | Click here to Download |
You must be asking when there are plenty of online resources available to build linux kernel why should we have an other one talking about the same.
Well the answer is pretty simple, this blog is an other way to have linux kernel built in a precise manner which is to the point of building it with no blah blah blah.....
Lets get it started...
From the prerequisites section, download the require softwares and put those in one of your favourite locations...If not open a terminal and navigate to the location you prefer and fire the command below
> wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.2.8.tar.xz
Mostly we will be using terminal to perform the operations.
NOTE : this article was written when linux kernel was at version 5.2.8
The procedure is going to be similar to forth coming versions of linux kernel and to some extent of the past version of kernel as well.
Now is the time verify the kernel that we have downloaded in order to do that proceed as described below...
1. Installing Development Tools
Before we build the kernel, it is required to install or required to have the supporting software in place.The development tools packages need to installed and can be done via the following way
> sudo apt-get install build-essential
> sudo apt-get install libncurses-dev
> sudo apt-get install bison
> sudo apt-get install flex
> sudo apt-get install libssl-dev
> sudo apt-get install libelf-dev
The above command set can be executed in one single line as given below but I have split it up to have good view of what we are installing
> sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev
2. Extracting the linux kernel package
Open a terminal and navigate to the location where you have downloaded the kernel package, use the following command to untar the file> unxz -v linux-5.2.8.tar.xzOR
> xz -d -v linux-5.2.8.tar.xz
3. Linux kernel package verification
The first step in the verification process is to get the signature, but how to get that?, well do not worry...use the command below to get the signature> wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.2.8.tar.signthe above operation can be verified as verified from a image below...
we have not yet verified the signature of the downloaded kernel package...
In order to verify it, use the following command
> gpg linux-5.2.8.tar.sign
The response of the above command execution would be as follows...
The above response is a normal one and to verify the signature, grab the pgp key form pgpserver as given below..
Use the RSA key from the GPG server to verify the signature, In order to do that use the following command
> gpg --recv-keys 6092693EThe command execution would be as follows....
Do not be panic, this is quite an usual response of the execution, if you get any other responses apart form "bad URI" or "bad Signature" which is also fine.
Now untar the file using the following command....
> tar -xfv linux-5.2.8.tar
4. Features and Modules Configuration
Before we build the kernel we have to build the features and select the modules required, this is a daunting task for a new comer.
We do have a shortcut to perform the operation, use the copy command to copy the existing config file using the following command(s)
> cd linux-5.2.8
> cp -v /boot/config-$(uname -r) .config
The execution of the above command would be resulted as follows
5. Kernel Configurations
Kernel configuration is the next process involved in building the kernel, the following command would help us to configure it from a GUI like window, run the command form the command line as mentioned below...> make menuconfigthe above command would result something like the one given below...
Pick the appropriate one form the option to configure the kernel.
6. Compiling the Kernel
This is a long process, form the linux kernel directory that we are going to build, fire the following command to compile the kernel.
> makedepending the no of cores available and to make the compiling process faster we can compile the kernel with the following command as well
> make -j 4or
> make -j $(nproc)relax till the process is completed.
7. Installing Kernel Modules
To install the kernel modules fire the command below...
> sudo make modules_install
8. Install the Kernel
To install the kernel, fire the command below...
> sudo make installThe above command will install three file as part the process under /boot directory.... namely,
1. config-5.2.8
2. initrd.img-5.2.8
3. vmlinuz-5.2.8
the image given below would justify that too...
This confirms the installation of kernel in to the system.
Well that is it, hope you had great time reading it.
Thanks.
No comments:
Post a Comment