Linux kernel licensing rules — The Linux Kernel documentation
The Linux Kernel 7.4.0-rc3 Quick search Contents Working with the development community Development process Submitting patches Code of conduct Maintainer handbook All development-process docs Internal API manuals Core API Driver APIs Subsystems Locking Development tools and processes Licensing rules License identifier syntax License identifiers MODULE_LICENSE Writing documentation Development tools Testing guide Hacking guide Tracing Fault injection Livepatching Rust User-oriented documentation Administration Build system Reporting issues Userspace tools Userspace API Firmware-related documentation Firmware Firmware and Devicetree Architecture-specific documentation CPU architectures Other documentation Unsorted documentation Translations Translations This Page Show Source English Chinese (Simplified) Chinese (Traditional) Italian Portuguese (Brazilian) Linux kernel licensing rules ¶ The Linux Kernel is provided under the terms of the GNU General Public License version 2 only (GPL-2.0), as provided in LICENSES/preferred/GPL-2.0, with an explicit syscall exception described in LICENSES/exceptions/Linux-syscall-note, as described in the COPYING file.
This documentation file provides a description of how each source file should be annotated to make its license clear and unambiguous. It doesn’t replace the Kernel’s license. The license described in the COPYING file applies to the kernel source as a whole, though individual source files can have a different license which is required to be compatible with the GPL-2.0: GPL-1.0+ : GNU General Public License v1.0 or later GPL-2.0+ : GNU General Public License v2.0 or later LGPL-2.0 : GNU Library General Public License v2 only LGPL-2.0+ : GNU Library General Public License v2 or later LGPL-2.1 : GNU Lesser General Public License v2.1 only LGPL-2.1+ : GNU Lesser General Public License v2.1 or later Aside from that, individual files can be provided under a dual license, e.g. one of the compatible GPL variants and alternatively under a permissive license like BSD, MIT etc.
The User-space API (UAPI) header files, which describe the interface of user-space programs to the kernel are a special case. According to the note in the kernel COPYING file, the syscall interface is a clear boundary, which does not extend the GPL requirements to any software which uses it to communicate with the kernel. Because the UAPI headers must be includable into any source files which create an executable running on the Linux kernel, the exception must be documented by a special license expression.
The common way of expressing the license of a source file is to add the matching boilerplate text into the top comment of the file. Due to formatting, typos etc. these “boilerplates” are hard to validate for tools which are used in the context of license compliance. An alternative to boilerplate text is the use of Software Package Data Exchange (SPDX) license identifiers in each source file. SPDX license identifiers are machine parsable and precise shorthands for the license under which the content of the file is contributed.
SPDX license identifiers are managed by the SPDX Workgroup at the Linux Foundation and have been agreed on by partners throughout the industry, tool vendors, and legal teams. For further information see https://spdx.org/ The Linux kernel requires the precise SPDX identifier in all source files. The valid identifiers used in the kernel are explained in the section License identifiers and have been retrieved from the official SPDX license list at https://spdx.org/licenses/ along with the license texts.
License identifier syntax ¶ Placement: The SPDX license identifier in kernel files shall be added at the first possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the ‘#!PATH_TO_INTERPRETER’ in the first line. For those scripts, the SPDX license identifier goes into the second line. The license identifier line can then be followed by one or multiple SPDX-FileCopyrightText lines if desired.
Style: The SPDX license identifier is added in form of a comment. The comment style depends on the file type: C source: // SPDX-License-Identifier: <SPDX License Expression> C header: /* SPDX-License-Identifier: <SPDX License Expression> */ ASM: /* SPDX-License-Identifier: <SPDX License Expression> */ scripts: # SPDX-License-Identifier: <SPDX License Expression> .rst: .. SPDX-License-Identifier: <SPDX License Expression> .dts{i}: // SPDX-License-Identifier: <SPDX License Expression> If a specific tool cannot handle the standard comment style, then the appropriate comment mechanism which the tool accepts shall be used.
This is the reason for having the “/* */” style comment in C header files. There was build breakage observed with generated .lds files where ‘ld’ failed to parse the C++ comment. This has been fixed by now, but there are still older assembler tools which cannot handle C++ style comments. Syntax: A <SPDX License Expression> is either an SPDX short form license identifier found on the SPDX License List, or the combination of two SPDX short form license identifiers separated by “WITH” when a license exception applies.
When multiple licenses apply, an expression consists of keywords “AND”, “OR” separating sub-expressions and surrounded by “(”, “)” . License identifiers for licenses like [L]GPL with the ‘or later’ option are constructed by using a “+” for indicating the ‘or later’ option.: // SPDX-License-Identifier: GPL-2.0+ // SPDX-License-Identifier: LGPL-2.1+ WITH should be used when there is a modifier to a license needed.
For example, the linux kernel UAPI files use the expression: // SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note // SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note Other examples using WITH exceptions found in the kernel are: // SPDX-License-Identifier: GPL-2.0 WITH mif-exception // SPDX-License-Identifier: GPL-2.0+ WITH GCC-exception-2.0 Exceptions can only be used with particular License identifiers.
The valid License identifiers are listed in the tags of the exception text file. For details see the point Exceptions in the chapter License identifiers . OR should be used if the file is dual licensed and only one license is to be selected. For example, some dtsi files are available under dual licenses: // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause Examples from the kernel for license expressions in dual licensed files: // SPDX-License-Identifier: GPL-2.0 OR MIT // SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause // SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 // SPDX-License-Identifier: GPL-2.0 OR MPL-1.1 // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR MIT // SPDX-License-Identifier: GPL-1.0+ OR BSD-3-Clause OR OpenSSL AND should be used if the file has multiple licenses whose terms all apply to use the file.
For example, if code is inherited from another project and permission has been given to put it in the kernel, but the original license terms need to remain in effect: // SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) AND MIT Another other example where both sets of license terms need to be adhered to is: // SPDX-License-Identifier: GPL-1.0+ AND LGPL-2.1+ License identifiers ¶ The licenses currently used, as well as the licenses for code added to the kernel, can be broken down into: Preferred licenses : Whenever possible these licenses should be used as they are known to be fully compatible and widely used.
These licenses are available from the directory: LICENSES/preferred/ in the kernel source tree. The files in this directory contain the full license text and Metatags . The file names are identical to the SPDX license identifier which shall be used for the license in source files. Examples: LICENSES/preferred/GPL-2.0 Contains the GPL version 2 license text and the required metatags: LICENSES/preferred/MIT Co
The rest of this page is on the live site.