Skip to content

Commit 8048834

Browse files
committed
1 parent b181478 commit 8048834

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+12548
-0
lines changed

pull/3203/_sources/ci.rst.txt

Lines changed: 528 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
Contribution guidelines
2+
=======================
3+
4+
This page serves the purpose of providing pointers and a brief introduction to
5+
contributing to the Linux Kernel, using the tools available as well as wrappers
6+
maintained by Analog Devices Inc.
7+
8+
.. tip::
9+
10+
When using :git-linux:`/`, the :doc:`ci` system automates most checks inside
11+
a container (:git-linux:`ci:container`). See :ref:`interactive-run` for
12+
interactive usage.
13+
14+
Code checkers
15+
-------------
16+
17+
There are many checkers to catch issues before submitting changes to the Kernel
18+
mailing lists. :git-linux:`ci:ci/build.sh` combines all of the checkers so that
19+
they can be run with one command using a standard configuration. The checkers
20+
supported by build.sh are as follows.
21+
22+
Checkpatch
23+
~~~~~~~~~~
24+
25+
:external+upstream:doc:`dev-tools/checkpatch`
26+
(:git-linux:`scripts/checkpatch.pl`) is a perl script which checks for trivial
27+
style violations in patches and optionally corrects them. Checkpatch can also
28+
be run on file contexts and without the kernel tree.
29+
30+
It is the bare-minimum tool before submitting any patch series.
31+
32+
Usage:
33+
34+
.. code:: bash
35+
36+
./scripts/checkpatch.pl [OPTION]... [FILE]...
37+
38+
.. important::
39+
40+
You must always adjust the style to match the guidelines of the
41+
:ref:`subsystem` you are collaborating to.
42+
43+
To run it as a low-budget `lsp server <https://en.wikipedia.org/wiki/Language_Server_Protocol>`__, do:
44+
45+
.. code:: bash
46+
47+
while true; do \
48+
scripts/checkpatch.pl --color=always drivers/power/supply/max77928_charger.c \
49+
--strict \
50+
--ignore FILE_PATH_CHANGES \
51+
--ignore LONG_LINE \
52+
--ignore LONG_LINE_STRING \
53+
--ignore LONG_LINE_COMMENT \
54+
--ignore PARENTHESIS_ALIGNMENT \
55+
--ignore CAMELCASE \
56+
--ignore UNDOCUMENTED_DT_STRING \
57+
--strict \ > /tmp/output ; clear ; cat /tmp/output ; \
58+
done
59+
60+
Sparse and smatch
61+
~~~~~~~~~~~~~~~~~
62+
63+
:external+upstream:doc:`dev-tools/sparse` is a semantic checker for C programs;
64+
it can be used to find a number of potential problems with kernel code.
65+
Usage:
66+
67+
.. shell::
68+
69+
~/linux
70+
$make C=1
71+
72+
And `Smatch <https://smatch.sourceforge.net/>`__ is a static analysis tool for
73+
C mostly for the linux kernel.
74+
Usage:
75+
76+
.. shell::
77+
78+
~/linux
79+
$make C=1 CHECK="smatch -p=kernel"
80+
81+
Further reading: `Finding locking bugs with Smatch <https://lwn.net/Articles/1023646/>`__
82+
83+
GCC fanalyzer
84+
~~~~~~~~~~~~~
85+
86+
GCC's
87+
`-fanalyzer <https://gcc.gnu.org/onlinedocs/gcc/Static-Analyzer-Options.html#index-analyzer>`__
88+
enables an static analysis of program flow which looks for "interesting"
89+
interprocedural paths through the code, and issues warnings for problems found
90+
on them.
91+
92+
Since it is a flag, it must be appended to the compile command, either to the
93+
`KCFLAGS`:
94+
95+
.. shell::
96+
97+
~/linux
98+
$make KCFLAGS=" -fanalyzer"
99+
100+
To analyze a single file, generate compile commands with
101+
`./scripts/clang-tools/gen_compile_commands.py`, extract the compile command
102+
for the ``.c`` file and append ``-fanalyzer``.
103+
104+
Clang static analyzer
105+
~~~~~~~~~~~~~~~~~~~~~
106+
107+
`Clang static analyzer <https://clang-analyzer.llvm.org/>`__ is a source code
108+
analysis tool that finds bugs in C, C++, and Objective-C programs.
109+
110+
Since it is a flag, it must be appended to the compile command, either to the
111+
`KCFLAGS`:
112+
113+
.. shell::
114+
115+
~/linux
116+
$make LLVM=1 KCFLAGS=" --analyze -Xanalyzer"
117+
118+
To analyze a single file, generate compile commands with
119+
`./scripts/clang-tools/gen_compile_commands.py`, extract the compile command
120+
for the ``.c`` file and append ``--analyze -Xanalyzer``.
121+
122+
Devicetree
123+
----------
124+
125+
The "Open Firmware Device Tree", or simply
126+
:external+upstream:doc:`Devicetree <devicetree/usage-model>` (DT), is a data
127+
structure and language for describing hardware. More specifically, it is a
128+
description of hardware that is readable by an operating system so that the
129+
operating system doesn’t need to hard code details of the machine.
130+
131+
Even though some devicetrees are provided with the Linux Kernel, in general,
132+
a custom devicetree will need to be written to describe a specific board or
133+
device, using the protopytes provided by the
134+
:git-linux:`Documentation/devicetree/bindings/**/*.yaml <Documentation/devicetree/bindings>` files.
135+
136+
When submitting dt-bindings, you must check:
137+
138+
.. shell::
139+
140+
~/linux
141+
$make dt_binding_check CONFIG_DTC=y DT_CHECKER_FLAGS=-m DT_SCHEMA_FILES="./path/to/.yaml"
142+
143+
For warnings and erros and resolve accordingly.
144+
145+
.. _b4:
146+
147+
B4
148+
--
149+
150+
:external+b4:doc:`B4 <index>` is a tool created to make it easier for project
151+
developers and maintainers to use a distributed development workflow that
152+
relies on patches and distribution lists for code contributions and review.
153+
154+
Take some time to try it out, and understand how it simplies many tasks.
155+
B4 tools is not currently leveraged by continuous integration, and you
156+
must run it locally.
157+
158+
The section that you will most interested in is the
159+
:external+b4:doc:`contributor/overview`, where the contributor workflow is
160+
extensively detailed, as well as the tools to ease it, such as
161+
:external+b4:doc:`b4 prep <contributor/prep>`,
162+
:external+b4:doc:`b4 send <contributor/send>`, and
163+
:external+b4:doc:`b4 trailers <contributor/trailers>`.
164+
165+
.. _subsystem:
166+
167+
Subsytems
168+
---------
169+
170+
The Linux kernel is organized into subsystems—logical divisions around
171+
functionality such as core APIs (memory, scheduling, locking, timers), driver
172+
interfaces (networking, storage, input, etc.), and various device-oriented
173+
modules (IIO, USB, SPI, etc.). Each subsystem encapsulates its own APIs,
174+
conventions, and lifecycle, helping maintain modularity and clarity. For an
175+
up-to-date map of these subsystems and their interfaces, see
176+
:external+upstream:doc:`subsystem-apis`.
177+
178+
When developing for a particular subsystem, look for the appropriate git tree
179+
in the :git-linux:`MAINTAINERS` file to work on. Development branches may be
180+
force pushed. It is reasonable to base you work on top of the current latest
181+
tag, such as `v6.19-rc1
182+
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.19-rc1&id=8f0b4cce4481fb22653697cced8d0d04027cb1e8>`__
183+
or near it, this avoids unnecessary merge commits when pulling changes.
184+
185+
For some subsystems, CI/CD is automatically applied to developemnt branches as
186+
described at :ref:`ci`.
187+
188+
IIO Subsytem
189+
~~~~~~~~~~~~
190+
191+
The :external+upstream:doc:`Industrial I/O subsystem <driver-api/iio/intro>` is
192+
intended to provide support for devices that in some senses are analog to
193+
digital or digital to analog converters (ADCs, DACs). Devices that fall into
194+
this category are: ADCs, accelerometers, gyros, IMUs, capacitance to digital
195+
converters, pressure sensors, light and proximity sensors, temperature sensors,
196+
magnetometers, DACs, DDS (Direct Digital Synthesis), variable/programmable gain
197+
amplifiers (VGA, PGA). These devices typically would be connected via SPI or
198+
I2C.
199+
200+
The overall aim is to fill the gap between the somewhat similar hwmon and input
201+
subsystems. Hwmon is very much directed at low sample rate sensors used in
202+
applications such as fan speed control and temperature measurement.
203+
204+
To continuous capture data based on a trigger source,
205+
:external+upstream:doc:`iio/iio_devbuf` are used.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
.. _getting_started:
2+
3+
Getting Started
4+
===============
5+
6+
Description
7+
-----------
8+
9+
The Linux kernel in this repository is the
10+
`Linux kernel from Xilinx <https://github.com/Xilinx/linux-xlnx>`__
11+
together with drivers & patches applied from Analog Devices.
12+
13+
Details about the drivers that are of interest and supported by this repository
14+
can be found on the
15+
:dokuwiki:`Analog Devices wiki <resources/tools-software/linux-drivers-all>`.
16+
This readme focuses on details specific to how this code is
17+
structured/organized, how it was derived, etc.
18+
19+
The current main is based on `xilinx v2025.1 <https://github.com/Xilinx/linux-xlnx/tree/xilinx-v2025.1>`__.
20+
For details about the merge see commit
21+
:git-linux:`3b1f15dc5c4d <commit/3b1f15dc5c4de92663059705d6f1cb6fc87d4470+>`
22+
(Merge tag ``xilinx-v2025.1`` of https://github.com/Xilinx/linux-xlnx.git).
23+
In this Xilinx release, the current version of upstream Linux is
24+
`Linux 6.12 <https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tag/?h=v6.12>`__.
25+
26+
How to build
27+
------------
28+
29+
For build instructions
30+
:dokuwiki:`check the wiki <resources/tools-software/linux-drivers-all#building_the_adi_linux_kernel>`.
31+
32+
Release branches
33+
----------------
34+
35+
All release branches have the ``[YEAR]_R[NUM]`` format. There are some special
36+
release branches sometimes (like ``2014_R2_altera``, because it wasn't always
37+
possible to match the Linux repo between Xilinx & Intel/Altera.
38+
39+
Each release is matched with a release from the :git-hdl:`HDL repo </>`. The
40+
branching name/model for the HDL repo differs a bit from the one in this repo,
41+
but the matching should be obvious. Therefore, each kernel in the release
42+
branches is be built using the toolchains from a specific version of Vivado &
43+
Quartus. A matching of these can be found at :external+hdl:ref:`releases`.
44+
Release branches can be built using other GCC toolchains, but in the official
45+
SD-card images provided, they will use the toolchains from Vivado/Quartus.
46+
47+
Rebased branches
48+
----------------
49+
50+
Starting with :git-linux:`adi-4.9.0:` there are rebased branches. They're
51+
typically rebased branches from Xilinx with the ADI patches on top so that it's
52+
easier to identify patches that are not yet upstreamed.
53+
54+
For :git-linux:`adi-4.9.0:` the base was branch
55+
`xlnx_rebase_v4.9 <https://github.com/Xilinx/linux-xlnx/tree/xlnx_rebase_v4.9>`__
56+
at commit
57+
:git-linux:`e5c22c2179cf <commit/e5c22c2179cfbec584d2c540d40a0c3d7a20770c+>`
58+
in the ADI repo and commit
59+
`45e196f59364 <https://github.com/Xilinx/linux-xlnx/commit/45e196f59364e9f5eafe46027a7d2af349083974>`__
60+
in the Xilinx repo. All ADI patches & drivers up to a specific point in time
61+
were cherry-picked to that branch from master. Note that since the
62+
``adi-4.9.0`` branch is the first rebased branch, it's not particularly the
63+
best rebase that could have been done, but it should provide some patches that
64+
are somewhat reasonable to take and apply on top of an upstream 4.9 kernel
65+
after some polishing.
66+
67+
The latest rebased branch depends on the current linux version supported in
68+
master. Also note that a diff between the latest rebased branch and `xlnx-main`
69+
(e.g., ``git diff xlnx-main adi-6.12.0``) must be NULL.
70+
71+
Raspberry Pi branches
72+
---------------------
73+
74+
These provide a kernel that is good to run on a Raspberry Pi board. All the
75+
drivers present in the master branch should be automatically cherry-picked into
76+
the latest rpi branch.
77+
78+
As in the rebased branches, the latest rpi branch should be in accordance with
79+
the current kernel version supported in master.
80+
81+
Intel/Altera branches
82+
---------------------
83+
84+
Because the kernel versions that Intel/Altera were usually not in sync with
85+
Xilinx's, ``altera-*`` branches were created:
86+
87+
- :git-linux:`altera_4.0 <altera_4.0:>`
88+
- :git-linux:`altera_4.4 <altera_4.4:>`
89+
- :git-linux:`altera_4.6 <altera_4.6:>`
90+
- :git-linux:`altera_4.9 <altera_4.9:>`
91+
- :git-linux:`altera_4.14 <altera_4.14:>`
92+
93+
These branches are derived from the
94+
`Intel/Altera linux kernel repo <https://github.com/altera-opensource/linux-socfpga>`__,
95+
together with some merged versions of old master branches.
96+
97+
These branches would stop existing, since Intel/Altera seems to keep in sync
98+
their kernel version with more recent non-LTS kernels. Typically the
99+
releases/references that are provided for these boards should already be in the
100+
mainline kernel, so these branches should no longer be needed.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../Documentation/iio/ad3552r.rst
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../Documentation/iio/ad4000.rst
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../Documentation/iio/ad4695.rst
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../Documentation/iio/ad7191.rst
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../Documentation/iio/ad7380.rst
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../Documentation/iio/ad7625.rst
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.. include:: ../../Documentation/iio/ad7944.rst

0 commit comments

Comments
 (0)