mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 04:02:20 +00:00
A mirror of the official Linux kernel repository just in case
arch | ||
block | ||
certs | ||
crypto | ||
Documentation | ||
drivers | ||
fs | ||
include | ||
init | ||
io_uring | ||
ipc | ||
kernel | ||
lib | ||
LICENSES | ||
mm | ||
net | ||
rust | ||
samples | ||
scripts | ||
security | ||
sound | ||
tools | ||
usr | ||
virt | ||
.clang-format | ||
.cocciconfig | ||
.editorconfig | ||
.get_maintainer.ignore | ||
.gitattributes | ||
.gitignore | ||
.mailmap | ||
.rustfmt.toml | ||
COPYING | ||
CREDITS | ||
Kbuild | ||
Kconfig | ||
MAINTAINERS | ||
Makefile | ||
README |
# Linux Kernel Source Tree - Official Documentation Welcome to the official **Linux Kernel Source Tree** repository. This repository contains the source code for the Linux kernel, which powers millions of devices across the world, from personal computers and servers to smartphones, embedded systems, and more. The Linux kernel is one of the most influential and widely-used open-source projects in history. ## Table of Contents - [Introduction](#introduction) - [License](#license) - [Repository Layout](#repository-layout) - [Building the Kernel](#building-the-kernel) - [Running the Kernel](#running-the-kernel) - [Contributing](#contributing) - [Kernel Documentation](#kernel-documentation) - [Community & Support](#community-support) - [Security Disclosures](#security-disclosures) - [Maintainers](#maintainers) - [FAQ](#faq) ## Introduction The **Linux Kernel** is a monolithic Unix-like operating system kernel initially created by **Linus Torvalds** in 1991. It serves as the core component of the Linux operating system, handling process management, memory management, device drivers, and system calls. The kernel operates on a vast range of devices, including mainframes, supercomputers, mobile phones, desktops, and embedded systems. This repository contains the official source tree for the Linux kernel, updated regularly by a global community of contributors, including individuals, organizations, and companies. Linux development is open to anyone, and contributions are welcome. ## License The Linux kernel is licensed under the **GNU General Public License version 2 (GPLv2)**. This license allows you to freely use, modify, and distribute the software, provided that you release any modifications under the same license. Some parts of the kernel may be covered by other licenses, but they are all compatible with GPLv2. For more detailed licensing information, see the `COPYING` file in the root directory. ## Repository Layout The source tree is organized into various directories. Here's an overview of the key directories and their purposes: - **arch/**: Contains architecture-specific code (e.g., `x86`, `arm`, `riscv`, etc.). - **block/**: Block layer and block device drivers. - **drivers/**: Hardware drivers for various devices (e.g., networking, sound, graphics, storage). - **fs/**: File system code, including ext4, btrfs, xfs, and others. - **include/**: Kernel header files. - **init/**: System and kernel initialization code. - **ipc/**: Inter-process communication (IPC) facilities like semaphores and message queues. - **kernel/**: Core kernel code, including process scheduling and system calls. - **lib/**: Generic libraries used throughout the kernel. - **mm/**: Memory management, paging, and virtual memory code. - **net/**: Networking stack code (TCP/IP, sockets, etc.). - **scripts/**: Helper scripts for building and maintaining the kernel. - **security/**: Security-related code, such as SELinux, AppArmor, and kernel security modules. - **sound/**: Sound subsystem and audio drivers. - **tools/**: Development and diagnostic tools. - **usr/**: Initial RAM filesystem (initramfs) code. - **Documentation/**: Contains extensive documentation for developers and users. ## Building the Kernel To build the kernel from source, follow the steps below. These instructions assume you're working on a Linux-based system with a properly set up development environment. ### Prerequisites Ensure you have the necessary tools installed: - **GCC (GNU Compiler Collection)** - **binutils** - **make** - **ncurses (for menu configuration)** - **bison** - **flex** - **libssl-dev** - **libelf-dev** On Debian/Ubuntu: ```bash sudo apt-get install build-essential libncurses-dev bison flex libssl-dev libelf-dev ``` On Fedora/RHEL: ```bash sudo dnf groupinstall "Development Tools" sudo dnf install ncurses-devel bison flex elfutils-libelf-devel openssl-devel ``` ### Cloning the Repository Clone the official Linux kernel source tree: ```bash git clone https://github.com/torvalds/linux.git cd linux ``` ### Configuring the Kernel Before building the kernel, you need to configure it. You can either use an existing configuration or customize your own: 1. **Default Configuration**: Use the default configuration for your system architecture: ```bash make defconfig ``` 2. **Custom Configuration**: Customize the kernel configuration using a menu-based interface: ```bash make menuconfig ``` ### Building the Kernel Once the kernel is configured, build it: ```bash make -j$(nproc) ``` The `-j$(nproc)` flag tells `make` to use all available processor cores to speed up the build process. ### Installing the Kernel After building the kernel, install the modules and the kernel image: ```bash sudo make modules_install sudo make install ``` ### Updating the Bootloader Ensure your bootloader is updated to recognize the new kernel. For systems using GRUB: ```bash sudo update-grub ``` ### Rebooting into the New Kernel Reboot your system to load the new kernel: ```bash sudo reboot ``` After rebooting, you can confirm that the system is running the new kernel with: ```bash uname -r ``` ## Running the Kernel Running a custom-built kernel is straightforward once installed. However, make sure to test it thoroughly before deploying it on production systems. You can boot the new kernel by simply rebooting your machine after following the installation steps above. ## Contributing The Linux kernel is a community-driven project. Contributions are welcome from everyone, whether you're fixing a bug, adding new features, or improving documentation. Before contributing, please familiarize yourself with the following resources: 1. **Coding Guidelines**: Follow the coding style described in `Documentation/process/coding-style.rst`. 2. **Submitting Patches**: Read `Documentation/process/submitting-patches.rst` to understand how to submit patches. 3. **Maintainers**: Check the `MAINTAINERS` file to determine the right people and mailing lists for your changes. 4. **Patchwork**: Review active patches on `patchwork.kernel.org`. To submit a patch, follow these steps: 1. Fork the repository. 2. Create a branch for your changes. 3. Make your changes following the coding guidelines. 4. Test your changes thoroughly. 5. Submit your patch via email to the relevant maintainers and the appropriate mailing list (e.g., `linux-kernel@vger.kernel.org`). ## Kernel Documentation The kernel source tree includes extensive documentation for both new and experienced developers. You can find it in the `Documentation/` directory. Some important documentation files include: - **Coding Style**: `Documentation/process/coding-style.rst` - **Submitting Patches**: `Documentation/process/submitting-patches.rst` - **Subsystem Documentation**: `Documentation/driver-api/` and `Documentation/networking/` - **Kernel Parameters**: `Documentation/admin-guide/kernel-parameters.txt` - **Developer Tools**: `Documentation/dev-tools/` You can also access the latest kernel documentation online at [https://www.kernel.org/doc/](https://www.kernel.org/doc/). ## Community & Support The Linux kernel community is vast and supportive. Here are some ways to engage with the community: - **Mailing Lists**: The primary way to discuss kernel development. Subscribe at [https://vger.kernel.org/vger-lists.html#linux-kernel](https://vger.kernel.org/vger-lists.html#linux-kernel). - **IRC**: Join the `#kernelnewbies` channel on Libera Chat for real-time discussions and support. - **Bug Tracker**: Report kernel bugs at [https://bugzilla.kernel.org/](https://bugzilla.kernel.org/). - **Conferences**: Attend events like the Linux Plumbers Conference and Kernel Summit for face-to-face interaction. ## Security Disclosures If you discover a security vulnerability in the Linux kernel, please follow the responsible disclosure process. Report security issues to the Linux kernel security team as outlined in `Documentation/admin-guide/security-bugs.rst`. ## Maintainers The Linux kernel is maintained by a large group of individuals, including Linus Torvalds and subsystem maintainers across various architectures, drivers, and features. You can find a list of maintainers and their responsibilities in the `MAINTAINERS` file in the root directory. ## FAQ **Q: What is the Linux Kernel?** A: The Linux kernel is the core component of the Linux operating system, managing hardware resources and providing services to applications. **Q: How do I contribute to the Linux kernel?** A: Start by reading `Documentation/process/submitting-patches.rst` to learn how to submit patches. Engage with the community on mailing lists and submit changes via email. **Q: Can I build and run the kernel on my laptop or desktop?** A: Yes, the kernel can be built and run on most architectures, including x86, ARM, and others. Follow the instructions in the "Building the Kernel" section. **Q: How often are new kernel versions released?** A: The kernel follows a regular release cycle, with new stable releases every 2-3 months. ## Contact For general questions or further information, visit [https://www.kernel.org](https://www.kernel.org). You can also reach out to the community on the Linux Kernel Mailing List (LKML). Thank you for your interest in the Linux kernel! ``` This README is comprehensive, includes key information for developers, maintainers, and newcomers, and follows a clear structure. It provides instructions on building and contributing to the Linux kernel and includes details on community engagement, security practices, and more.