# Linux Kernel source- How to compile

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

```plaintext
$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.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1699104437963/ed89c352-a4f5-4a6c-8ca0-7f2432619c75.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1699104463081/ab683a9d-b376-4140-8fd5-fd9b03a7ff27.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1699104495626/f90c4722-c083-4294-ac75-360f09a76aec.png align="center")
