Building Linux kernel on the Debian OS (Debian 10 Buster) (Short Edition)

Building Linux kernel on the Debian OS (Debian 10 Buster) (Short Edition).

This blog-post describes (short edition) simple method of the Linux Kernel building on Operational System Linux Debian 10.

  • If current user is root, all next commands (including copy to /usr/srcdpkg -i, … ) can be executed without any additional changes of permissions. In another case, it’s necessary to care about permissions and add sudo before some commands.
  • Some software needs to be installed:
    • apt-get install gcc make git exuberant-ctags bc libssl-dev libelf-dev elfutils fakeroot build-essential zlib1g-dev libncurses5-dev.
  • Download necessary version of the Linux Kernel here: www.kernel.org.
  • Unpack archive here: /usr/src.
  • Copy current config file of the current kernel from /boot.
    • For example: /boot/config-4.19.0-13-amd64.
  • Create file .config (base config file of the Linux Kernel):
    • cp ./config-4.19.0-13-amd64 ./.config
  • Run:
    • make menuconfig.
  • Configure of just save configuration to the file .config (new options for current version of the Linux Kernel will be added);
  • Then open file (in sources directory): Makefile
    and setup value: EXTRAVERSION (EXTRAVERSION = -amd64).
  • Follow commands can be used for cleaning and build:
    • make clean – cleaning built binaries and temporary files
      or
    • make deb-pkg – full build and binary images creating.
  • For installing built .deb modules, use follow commands:
    • dpkg -i ./linux-*.deb
  • After that, new kernel will be installed to the directories:
    • /boot
    • /usr/lib/modules/5.12.10-amd64
    • /usr/lib/debug/lib/modules/5.12.10-amd64
    • /usr/src