How to view and browse the linux kernel source?

29/12/2020
Chưa phân loại
The Linux Kernel is the operating system (OS) core which allows it to support and manage the hardware, protocols and more. In this tutorial the kernel source structure will be briefly explained. The kernel’s root folder located at /usr/src/, usually /usr/src/linux* contains it’s source like the one you can browse at https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/?h=v5.1.3

The source directory contains the following subdirectories called kernel tree, learning the structure of the kernel tree and the function of each path is the first step to start browsing the kernel.

Kernel tree root directory:

Documentation/: kernel source documentation.

LICENSES/: It contains the licenses to be applied to the kernel source and individual source files which may have different licenses. Inside this directory you will find 3 subdirectories: preferred (GNU GPL), exceptions listed in the COPYING file and other.

arch/: source codes for specific architectures (e.g powerpc, x86,etc). Inside this directory you’ll find subdirectories belonging to each supported architecture lie i386, sparc, arm, etc.

block/: block I/O layer, contains code for the management of block devices (such as hard disks, dvd, floppy disks, etc.) and their requests.

Certs/:
certificates and sign files to enable module signature to make the kernel load signed modules, this can be useful to prevent malicious code from running with kernel modules like rootkits.

Crypto/: Crypto API. Contains cryptographic ciphers which handles cryptographic and compression tasks.

drivers/: Hardware device drivers. Contains code of device drivers to support hardware, inside this directory you’ll find subdirectories for each hardware such as video, bluetooth,etc (any hardware supported).

fs/: code for the Virtual File System and additional filesystems. This directory contains the code to support, read and write filesystems.

include/: kernel headers. This directory contains C headers for kernel files such as functions to compile code.

init/: kernel boot. Contains source code related to the initialization of the kernel. The source code is stored in a file called  mainc.c within the directory /init. The code initializes the kernel and some initial processes.

ipc/: Inter-Process Communication such as signals and pipes.

kernel/: Core subsystems, such as the scheduler signal handling code, etc.

lib/: library routines common string operations, hardware dependent operations, debugging routines and command line parsing code.

mm/:  Memory management and virtual memory. The kernel manages both the hardware and virtual memory (swap). This directory stores code for the memory management.

net/: Network stack. Contains code related to communication protocols such as IP, TCP,UP, etc.

samples/: sample code and configuration files.

scripts/: scripts to build the kernel.

security/: Linux Security Module (LSM)  is a framework to enable security policies to access modules control.

sound/: The sound subsystem, here you’ll find sound drivers and code related to sound such as ALSA,


tools/:
tools for compressed kernel development such as ACPI, cgroup, USB testing tools, vhost test module, GPIO, IIO and spi tools, Inter energy policy tool among more.

usr/: initramfs which roots the filesystem and init in the kernel memory cache.

virt/: Virtualization, this directory contains the KVM (Kernel Virtual Machine) module for hypervisor.

These are the main subdirectories of the kernel tree and their function, hope its helpful for you.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Kubernetes Jobs and Cron Jobs

Most of the applications that run on a distributed system like Kubernetes are always live like web servers or databases...
29/12/2020

How to Create and Use a Ramdisk on Ubuntu 18.04

The slowest part of a computer is the hard drive. So loading program and files from hard drive is really slow. RAM or Random...
29/12/2020

Hack Facebook using Social Engineering

I love hacking humans. There is a sense of art to operating in the realm of mind tricking. If you are a magician, you may...
28/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

Dịch Vụ Xây Dựng Hệ Thống Peering Với Internet Exchange (IXP)
04/04/2025

Dịch Vụ Triển Khai VPN Site-to-Site & Remote Access
04/04/2025

Dịch Vụ Thiết Lập Hệ Thống Tường Lửa (Firewall)
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ảo Hóa & Cloud
04/04/2025

Dịch Vụ Triển Khai Hệ Thống Ceph
04/04/2025