Skip to content

Commit 70d4925

Browse files
committed
deploy: ba18f1e #3054 (opened)
1 parent dc7ad6f commit 70d4925

Some content is hidden

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

72 files changed

+12917
-0
lines changed

pull/3054/_sources/ci.rst.txt

Lines changed: 635 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
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_chec 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+
IIO Subsytem
179+
~~~~~~~~~~~~
180+
181+
The :external+upstream:doc:`Industrial I/O subsystem <driver-api/iio/intro>` is
182+
intended to provide support for devices that in some senses are analog to
183+
digital or digital to analog converters (ADCs, DACs). Devices that fall into
184+
this category are: ADCs, accelerometers, gyros, IMUs, capacitance to digital
185+
converters, pressure sensors, light and proximity sensors, temperature sensors,
186+
magnetometers, DACs, DDS (Direct Digital Synthesis), variable/programmable gain
187+
amplifiers (VGA, PGA). These devices typically would be connected via SPI or
188+
I2C.
189+
190+
The overall aim is to fill the gap between the somewhat similar hwmon and input
191+
subsystems. Hwmon is very much directed at low sample rate sensors used in
192+
applications such as fan speed control and temperature measurement.
193+
194+
To continuous capture data based on a trigger source,
195+
:external+upstream:doc:`iio/iio_devbuf` are used.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
.. _getting_started:
2+
3+
Description
4+
===========
5+
6+
The Linux kernel in this repository is the `Linux kernel from Xilinx
7+
<https://github.com/Xilinx/linux-xlnx>`__ together with drivers & patches
8+
applied from Analog Devices.
9+
10+
Details about the drivers that are of interest and supported by this repository
11+
can be found on the :dokuwiki:`Analog Devices wiki
12+
<resources/tools-software/linux-drivers-all>`. This readme focuses on details
13+
specific to how this code is structured/organized, how it was derived, etc.
14+
15+
The current main is based on `xilinx v2024.1
16+
<https://github.com/Xilinx/linux-xlnx/tree/xilinx-v2024.1>`__. For details
17+
about the merge see commit :git-linux:`d31fa3135dbef8bf186a7c42fd87b3eedd8446e9
18+
<commit/d31fa3135dbef8bf186a7c42fd87b3eedd8446e9>` (Merge tag ``xilinx-v2024.1``
19+
of https://github.com/Xilinx/linux-xlnx.git). In this Xilinx release, the
20+
current version of upstream Linux is `Linux 6.6
21+
<https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tag/?h=v6.6>`__.
22+
23+
For legacy reasons, the :git-linux:`xcomm_zynq <tree/xcomm_zynq>` branch is
24+
still available and should be in-sync with current master. That branch used to
25+
be the old master branch.
26+
27+
How to build
28+
============
29+
30+
For build instructions :dokuwiki:`check the wiki
31+
<resources/tools-software/linux-drivers-all#building_the_adi_linux_kernel>`.
32+
33+
Release branches
34+
================
35+
36+
All release branches have the ``[YEAR]_R[NUM]`` format. There are some special
37+
release branches sometimes (like ``2014_R2_altera``, because it wasn't always
38+
possible to match the Linux repo between Xilinx & Intel/Altera.
39+
40+
Each release is matched with a release from the :git-hdl:`HDL repo <>`. The
41+
branching name/model for the HDL repo differs a bit from the one in this repo,
42+
but the matching should be obvious. Therefore, each kernel in the release
43+
branches is be built using the toolchains from a specific version of Vivado &
44+
Quartus. A matching of these can be found :dokuwiki:`on the wiki
45+
<resources/fpga/docs/releases>`. Release branches can be built using other GCC
46+
toolchains, but in the official SD-card images provided, they will use the
47+
toolchains from Vivado/Quartus.
48+
49+
Rebased branches
50+
================
51+
52+
Starting with branch :git-linux:`adi-4.9.0 <tree/adi-4.9.0>` there are rebased
53+
branches. They're typically rebased branches from Xilinx with the ADI patches
54+
on top so that it's easier to identify patches that are not yet upstreamed.
55+
56+
For :git-linux:`adi-4.9.0 <tree/adi-4.9.0>` the base was branch
57+
`xlnx_rebase_v4.9 <https://github.com/Xilinx/linux-xlnx/tree/xlnx_rebase_v4.9>`__
58+
at commit :git-linux:`d45e196f59364e9f5eafe46027a7d2af349083974
59+
<commit/d45e196f59364e9f5eafe46027a7d2af349083974>`
60+
in the ADI repo and commit `45e196f59364e9f5eafe46027a7d2af349083974
61+
<https://github.com/Xilinx/linux-xlnx/commit/45e196f59364e9f5eafe46027a7d2af349083974>`__
62+
in the Xilinx repo. All ADI patches & drivers up to a specific point in time
63+
were cherry-picked to that branch from master. Note that since the
64+
``adi-4.9.0`` branch is the first rebased branch, it's not particularly the
65+
best rebase that could have been done, but it should provide some patches that
66+
are somewhat reasonable to take and apply on top of an upstream 4.9 kernel
67+
after some polishing.
68+
69+
The latest rebased branch depends on the current linux version supported in
70+
master. At the time of writing it is 5.10 so that :git-linux:`adi-5.10.0
71+
<tree/adi-5.10.0>` is the latest. Also note that a diff between the latest
72+
rebased branch and master (``git diff master adi-5.10.0``) must be NULL.
73+
74+
Raspberry Pi branches
75+
=====================
76+
77+
These provide a kernel that is good to run on a Raspberry Pi board. All the
78+
drivers present in the master branch should be automatically cherry-picked into
79+
the latest rpi branch.
80+
81+
As in the rebased branches, the latest rpi branch should be in accordance with
82+
the current kernel version supported in master. At the time of writing, the
83+
kernel version in master is 5.10 so that the correspondent latest rpi branch is
84+
:git-linux:`rpi-5.10.y <tree/rpi-5.10.y>`.
85+
86+
Intel/Altera branches
87+
=====================
88+
89+
Because the kernel versions that Intel/Altera were usually not in sync with
90+
Xilinx's, ``altera-*`` branches were created:
91+
92+
- :git-linux:`altera_4.0 <tree/altera_4.0>`
93+
- :git-linux:`altera_4.4 <tree/altera_4.4>`
94+
- :git-linux:`altera_4.6 <tree/altera_4.6>`
95+
- :git-linux:`altera_4.9 <tree/altera_4.9>`
96+
97+
These branches are derived from the `Intel/Altera linux kernel repo
98+
<https://github.com/altera-opensource/linux-socfpga>`__, together with some
99+
merged versions of old master branches.
100+
101+
The hope is that with the upcoming Linux 4.19, these branches would stop
102+
existing, since Intel/Altera seems to keep in sync their kernel version with
103+
more recent non-LTS kernels. Typically the releases/references that are
104+
provided for these boards should already be in the mainline kernel, so these
105+
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)