Build Linux Kernel

Had a need to build Linux Kernel. There were multiple sites which detailed the how-to. Finally to me it boiled down to the following

After installing debian in the system, install required packages for building the kernel.

[ Note : I had attempted it as root user and hence did not use sudo ]

apt-get update
apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc bison flex libelf-dev

Down the latest stable (or required) version of linux kernel (Downloaded from browser so switching to Downloads folder). At the time of typing this the latest stable was 4.14.3

cd Downloads/
tar xf linux-4.14.3.tar.xz
cd linux-4.14.3

To make life simpler, just copied the module selection of current kernel with following commands. Note : I did not change the module selections as the purpose was to test building linux kernel.

cp /boot/config-$(uname -r) .config
make menuconfig

Now build the kernel (Note : 32 is the number of threads available. In my system it was 32 (output of nproc command)

Note : The update-initramfs command below may not be required – but no harm.

make -j 32
make modules_install -j 32
make install -j 32

After reboot, could see the option of kernel 4.14.3 listed in boot options.

About sandeep

Passionate about sharing information on "how to".
This entry was posted in Uncategorized and tagged , , , , . Bookmark the permalink.