Linux Kernel source- How to compile

Linux Kernel source- How to compile

·

2 min read

To configure the Linux kernel, enter into a directory of newly unpacked set of kernel sources and configure them using the text based menuconfig configuration utility, as follows:
$ make menuconfig

Building the Kernel

Building the Linux kernel is actually quite straightforward. You simply use the GNU make command,and the kernel Kbuild system (that is layered upon make) will make the appropriate calls to those utilities that are needed to build the entire system. A successful build can take a long time.
$ make
The Linux kernel source has a top-level directory structure that is always similar to the following:
arch:-arch Architecture-specific files
block:- block Support for block devices such as hard disks.
crypto:-crypto Cryptographic library functions
Documentation:- Documentation supplied with the Linux kernel.
drivers- Device drivers
fs:- Implementation of every filesystem supported by the Linux kernel.
include:-include Header files supplied with the Linux kernel init:-init Higher-level startup code
ipc:-ipc The location of the implementation of various Inter-Process Communica-tion (IPC) primitives used in the Linux kernel.
Kernel:-kernel The higher-level core kernel functions.
lib:- Library routines such as CRC32 checksum calculation and various other higher-level library code
mm:- Memory management routines supporting the Linux implementation of virtual memory.
net:- Contains an implementation of each of the networking standards that are supported by the Linux kernel scripts:- Various miscellaneous scripts used to configure and build the Linux kernel. security:- Linux includes support for the SELinux (Security-Enhanced Linux) functional
sound:- Contains an implementation of the ALSA (Advanced Linux Sound Architecture) sound subsystem as used in recent Linux kernels.

usr:- Various support utilities for building initial ramdisks

Commands for Compiling Linux Kernel

$make menuconfig   
$make oldconfig     
$make   
$sudo apt-get install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf

System.map:-

This file will generate automatically after compilation.