1 # SPDX-License-Identifier: GPL-2.0-or-later OR GFDL-1.2-no-invariants-or-later
3 OpenOCD licensing rules
4 =======================
6 The OpenOCD source code is provided under the terms of the GNU General
7 Public License version 2 or later (GPL-2.0-or-later), as provided in
8 LICENSES/preferred/GPL-2.0.
10 The OpenOCD documentation is provided under the terms of the GNU Free
11 Documentation License version 1.2 or later without Invariant Sections
12 (GFDL-1.2-no-invariants-or-later).
14 Few stand-alone applications coexist in the same code tree of OpenOCD
15 and are provided under the terms of the GNU General Public License
16 version 3 (GPL-3.0), as provided in LICENSES/stand-alone/GPL-3.0.
18 This documentation file provides a description of how each source file
19 should be annotated to make its license clear and unambiguous.
20 It doesn't replace the OpenOCD's license.
22 The license described in the COPYING file applies to the OpenOCD source
23 as a whole, though individual source files can have a different license
24 which is required to be compatible with the GPL-2.0:
26 GPL-1.0-or-later : GNU General Public License v1.0 or later
27 GPL-2.0-or-later : GNU General Public License v2.0 or later
28 LGPL-2.0 : GNU Library General Public License v2 only
29 LGPL-2.0-or-later : GNU Library General Public License v2 or later
30 LGPL-2.1 : GNU Lesser General Public License v2.1 only
31 LGPL-2.1-or-later : GNU Lesser General Public License v2.1 or later
33 Aside from that, individual files can be provided under a dual license,
34 e.g. one of the compatible GPL variants and alternatively under a
35 permissive license like BSD, MIT etc.
37 The common way of expressing the license of a source file is to add the
38 matching boilerplate text into the top comment of the file. Due to
39 formatting, typos etc. these "boilerplates" are hard to validate for
40 tools which are used in the context of license compliance.
42 An alternative to boilerplate text is the use of Software Package Data
43 Exchange (SPDX) license identifiers in each source file. SPDX license
44 identifiers are machine parsable and precise shorthands for the license
45 under which the content of the file is contributed. SPDX license
46 identifiers are managed by the SPDX Workgroup at the Linux Foundation and
47 have been agreed on by partners throughout the industry, tool vendors, and
48 legal teams. For further information see https://spdx.org/
50 OpenOCD requires the precise SPDX identifier in all source files.
51 The valid identifiers used in OpenOCD are explained in the section
52 `License identifiers` and have been retrieved from the official SPDX
53 license list at https://spdx.org/licenses/ along with the license texts.
55 License identifier syntax
56 -------------------------
60 The SPDX license identifier in OpenOCD files shall be added at the
61 first possible line in a file which can contain a comment. For the
62 majority of files this is the first line, except for scripts which
63 require the '#!PATH_TO_INTERPRETER' in the first line. For those
64 scripts the SPDX identifier goes into the second line.
68 The SPDX license identifier is added in form of a comment. The comment
69 style depends on the file type::
71 C source: // SPDX-License-Identifier: <SPDX License Expression>
72 C header: /* SPDX-License-Identifier: <SPDX License Expression> */
73 ASM: /* SPDX-License-Identifier: <SPDX License Expression> */
74 makefiles: # SPDX-License-Identifier: <SPDX License Expression>
75 scripts: # SPDX-License-Identifier: <SPDX License Expression>
76 texinfo: @c SPDX-License-Identifier: <SPDX License Expression>
77 text: # SPDX-License-Identifier: <SPDX License Expression>
79 If a specific tool cannot handle the standard comment style, then the
80 appropriate comment mechanism which the tool accepts shall be used. This
81 is the reason for having the "/\* \*/" style comment in C header
82 files. There was build breakage observed with generated .lds files where
83 'ld' failed to parse the C++ comment. This has been fixed by now, but
84 there are still older assembler tools which cannot handle C++ style
89 A <SPDX License Expression> is either an SPDX short form license
90 identifier found on the SPDX License List, or the combination of two
91 SPDX short form license identifiers separated by "WITH" when a license
92 exception applies. When multiple licenses apply, an expression consists
93 of keywords "AND", "OR" separating sub-expressions and surrounded by
96 License identifiers for licenses like [L]GPL with the 'or later' option
97 are constructed by using a "-or-later":
99 // SPDX-License-Identifier: GPL-2.0-or-later
100 // SPDX-License-Identifier: LGPL-2.1-or-later
102 WITH should be used when there is a modifier to a license needed.
103 Exceptions can only be used with particular License identifiers. The
104 valid License identifiers are listed in the tags of the exception text
107 OR should be used if the file is dual licensed and only one license is
108 to be selected. For example, some source files are available under dual
111 // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-1-Clause
112 // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
113 // SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause
115 AND should be used if the file has multiple licenses whose terms all
116 apply to use the file. For example, if code is inherited from another
117 project and permission has been given to put it in OpenOCD, but the
118 original license terms need to remain in effect::
120 // SPDX-License-Identifier: GPL-2.0-or-later AND MIT
125 The licenses currently used, as well as the licenses for code added to
126 OpenOCD, can be broken down into:
128 1. `Preferred licenses`:
130 Whenever possible these licenses should be used as they are known to be
131 fully compatible and widely used. These licenses are available from the
136 in the OpenOCD source tree.
138 The files in this directory contain the full license text and
139 `Metatags`. The file names are identical to the SPDX license
140 identifier which shall be used for the license in source files.
144 LICENSES/preferred/GPL-2.0
146 Contains the GPL version 2 license text and the required metatags.
150 The following meta tags must be available in a license file:
152 - Valid-License-Identifier:
154 One or more lines which declare which License Identifiers are valid
155 inside the project to reference this particular license text. Usually
156 this is a single valid identifier, but e.g. for licenses with the 'or
157 later' options two identifiers are valid.
161 The URL of the SPDX page which contains additional information related
166 Freeform text for usage advice. The text must include correct examples
167 for the SPDX license identifiers as they should be put into source
168 files according to the `License identifier syntax` guidelines.
172 All text after this tag is treated as the original license text
174 File format examples::
176 Valid-License-Identifier: GPL-2.0
177 Valid-License-Identifier: GPL-2.0-only
178 Valid-License-Identifier: GPL-2.0-or-later
179 SPDX-URL: https://spdx.org/licenses/GPL-2.0.html
181 To use this license in source code, put one of the following SPDX
182 tag/value pairs into a comment according to the placement
183 guidelines in the licensing rules documentation.
184 For 'GNU General Public License (GPL) version 2 only' use:
185 SPDX-License-Identifier: GPL-2.0
187 SPDX-License-Identifier: GPL-2.0-only
188 For 'GNU General Public License (GPL) version 2 or any later version' use:
189 SPDX-License-Identifier: GPL-2.0-or-later
195 Some licenses can be amended with exceptions which grant certain rights
196 which the original license does not. These exceptions are available
201 in the OpenOCD source tree. The files in this directory contain the full
202 exception text and the required `Exception Metatags`_.
206 LICENSES/exceptions/eCos-exception-2.0
210 The following meta tags must be available in an exception file:
212 - SPDX-Exception-Identifier:
214 One exception identifier which can be used with SPDX license
219 The URL of the SPDX page which contains additional information related
224 A comma separated list of SPDX license identifiers for which the
225 exception can be used.
229 Freeform text for usage advice. The text must be followed by correct
230 examples for the SPDX license identifiers as they should be put into
231 source files according to the `License identifier syntax`_ guidelines.
235 All text after this tag is treated as the original exception text
237 File format examples::
239 SPDX-Exception-Identifier: eCos-exception-2.0
240 SPDX-URL: https://spdx.org/licenses/eCos-exception-2.0.html
241 SPDX-Licenses: GPL-2.0-only, GPL-2.0-or-later
243 This exception is used together with one of the above SPDX-Licenses.
244 To use this exception add it with the keyword WITH to one of the
245 identifiers in the SPDX-Licenses tag:
246 SPDX-License-Identifier: <SPDX-License> WITH eCos-exception-2.0
250 3. Stand-alone licenses:
252 These licenses should only be used for stand-alone applications that are
253 distributed with OpenOCD but are not included in the OpenOCD binary.
254 These licenses are available from the directory:
256 LICENSES/stand-alone/
258 in the OpenOCD source tree.
262 SPDX-License-Identifier: GPL-3.0
264 The format and requirements of the license files in the other sub-directories
269 have to follow the same format and requirements of the `Preferred licenses`.
271 All SPDX license identifiers and exceptions must have a corresponding file
272 in the LICENSES subdirectories. This is required to allow tool
273 verification (e.g. checkpatch.pl) and to have the licenses ready to read
274 and extract right from the source, which is recommended by various FOSS
275 organizations, e.g. the `FSFE REUSE initiative <https://reuse.software/>`.