Skip to content

Build Kernel from source code

Xiaogang Li edited this page May 19, 2022 · 6 revisions

Environment Preparation

Here will take Ubuntu as the example.

Ubuntu 18.04+ requires additional packages:

$ sudo apt-get install libncurses5-dev flex bison gcc make git exuberant-ctags bc libssl-dev

Build kernel

Download stable kernel from https://www.kernel.org/

$ git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Or the latest kernel from https://github.com/freedesktop/drm-tip

$ git clone https://github.com/freedesktop/drm-tip.git

Then build kernel by below commands.

$ cp /boot/config-`uname -r`* .config
$ make defconfig
$ make -j8
$ sudo make modules_install
$ sudo make install

Install the kernel

$ sudo make modules_install install

Or if you don't have sudo installed, run

$ su -c "make modules_install install"
Clone this wiki locally