summaryrefslogtreecommitdiffstats
path: root/documentation/kernel-dev/kernel-dev-maint-appx.rst
diff options
context:
space:
mode:
authorNicolas Dechesne <nicolas.dechesne@linaro.org>2020-06-26 19:10:51 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-17 10:09:33 +0100
commit9bd69b1f1d71a9692189beeac75af9dfbad816cc (patch)
tree305347fca899074aed5610e0e82eaec180bf630c /documentation/kernel-dev/kernel-dev-maint-appx.rst
parentc40a8d5904c29046f1cbbeb998e6cd7c24f9b206 (diff)
downloadpoky-9bd69b1f1d71a9692189beeac75af9dfbad816cc.tar.gz
sphinx: initial sphinx support
This commit is autogenerated pandoc to generate an inital set of reST files based on DocBook XML files. A .rst file is generated for each .xml files in all manuals with this command: cd <manual> for i in *.xml; do \ pandoc -f docbook -t rst --shift-heading-level-by=-1 \ $i -o $(basename $i .xml).rst \ done The conversion was done with: pandoc 2.9.2.1-91 (Arch Linux). Also created an initial top level index file for each document, and added all 'books' to the top leve index.rst file. The YP manuals layout is organized as: Book Chapter Section Section Section Sphinx uses section headers to create the document structure. ReStructuredText defines sections headers like that: To break longer text up into sections, you use section headers. These are a single line of text (one or more words) with adornment: an underline alone, or an underline and an overline together, in dashes "-----", equals "======", tildes "~~~~~~" or any of the non-alphanumeric characters = - ` : ' " ~ ^ _ * + # < > that you feel comfortable with. An underline-only adornment is distinct from an overline-and-underline adornment using the same character. The underline/overline must be at least as long as the title text. Be consistent, since all sections marked with the same adornment style are deemed to be at the same level: Let's define the following convention when converting from Docbook: Book => overline === (Title) Chapter => overline *** (1.) Section => ==== (1.1) Section => ---- (1.1.1) Section => ~~~~ (1.1.1.1) Section => ^^^^ (1.1.1.1.1) During the conversion with pandoc, we used --shift-heading-level=-1 to convert most of DocBook headings automatically. However with this setting, the Chapter header was removed, so I added it back manually. Without this setting all headings were off by one, which was more difficult to manually fix. At least with this change, we now have the same TOC with Sphinx and DocBook. (From yocto-docs rev: 3c73d64a476d4423ee4c6808c685fa94d88d7df8) Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/kernel-dev/kernel-dev-maint-appx.rst')
-rw-r--r--documentation/kernel-dev/kernel-dev-maint-appx.rst226
1 files changed, 226 insertions, 0 deletions
diff --git a/documentation/kernel-dev/kernel-dev-maint-appx.rst b/documentation/kernel-dev/kernel-dev-maint-appx.rst
new file mode 100644
index 0000000000..4653e51eba
--- /dev/null
+++ b/documentation/kernel-dev/kernel-dev-maint-appx.rst
@@ -0,0 +1,226 @@
1******************
2Kernel Maintenance
3******************
4
5Tree Construction
6=================
7
8This section describes construction of the Yocto Project kernel source
9repositories as accomplished by the Yocto Project team to create Yocto
10Linux kernel repositories. These kernel repositories are found under the
11heading "Yocto Linux Kernel" at `YOCTO_GIT_URL <&YOCTO_GIT_URL;>`__ and
12are shipped as part of a Yocto Project release. The team creates these
13repositories by compiling and executing the set of feature descriptions
14for every BSP and feature in the product. Those feature descriptions
15list all necessary patches, configurations, branches, tags, and feature
16divisions found in a Yocto Linux kernel. Thus, the Yocto Project Linux
17kernel repository (or tree) and accompanying Metadata in the
18``yocto-kernel-cache`` are built.
19
20The existence of these repositories allow you to access and clone a
21particular Yocto Project Linux kernel repository and use it to build
22images based on their configurations and features.
23
24You can find the files used to describe all the valid features and BSPs
25in the Yocto Project Linux kernel in any clone of the Yocto Project
26Linux kernel source repository and ``yocto-kernel-cache`` Git trees. For
27example, the following commands clone the Yocto Project baseline Linux
28kernel that branches off ``linux.org`` version 4.12 and the
29``yocto-kernel-cache``, which contains stores of kernel Metadata: $ git
30clone git://git.yoctoproject.org/linux-yocto-4.12 $ git clone
31git://git.yoctoproject.org/linux-kernel-cache For more information on
32how to set up a local Git repository of the Yocto Project Linux kernel
33files, see the "`Preparing the Build Host to Work on the
34Kernel <#preparing-the-build-host-to-work-on-the-kernel>`__" section.
35
36Once you have cloned the kernel Git repository and the cache of Metadata
37on your local machine, you can discover the branches that are available
38in the repository using the following Git command: $ git branch -a
39Checking out a branch allows you to work with a particular Yocto Linux
40kernel. For example, the following commands check out the
41"standard/beagleboard" branch of the Yocto Linux kernel repository and
42the "yocto-4.12" branch of the ``yocto-kernel-cache`` repository: $ cd
43~/linux-yocto-4.12 $ git checkout -b my-kernel-4.12
44remotes/origin/standard/beagleboard $ cd ~/linux-kernel-cache $ git
45checkout -b my-4.12-metadata remotes/origin/yocto-4.12
46
47.. note::
48
49 Branches in the
50 yocto-kernel-cache
51 repository correspond to Yocto Linux kernel versions (e.g.
52 "yocto-4.12", "yocto-4.10", "yocto-4.9", and so forth).
53
54Once you have checked out and switched to appropriate branches, you can
55see a snapshot of all the kernel source files used to used to build that
56particular Yocto Linux kernel for a particular board.
57
58To see the features and configurations for a particular Yocto Linux
59kernel, you need to examine the ``yocto-kernel-cache`` Git repository.
60As mentioned, branches in the ``yocto-kernel-cache`` repository
61correspond to Yocto Linux kernel versions (e.g. ``yocto-4.12``).
62Branches contain descriptions in the form of ``.scc`` and ``.cfg``
63files.
64
65You should realize, however, that browsing your local
66``yocto-kernel-cache`` repository for feature descriptions and patches
67is not an effective way to determine what is in a particular kernel
68branch. Instead, you should use Git directly to discover the changes in
69a branch. Using Git is an efficient and flexible way to inspect changes
70to the kernel.
71
72.. note::
73
74 Ground up reconstruction of the complete kernel tree is an action
75 only taken by the Yocto Project team during an active development
76 cycle. When you create a clone of the kernel Git repository, you are
77 simply making it efficiently available for building and development.
78
79The following steps describe what happens when the Yocto Project Team
80constructs the Yocto Project kernel source Git repository (or tree)
81found at ` <&YOCTO_GIT_URL;>`__ given the introduction of a new
82top-level kernel feature or BSP. The following actions effectively
83provide the Metadata and create the tree that includes the new feature,
84patch, or BSP:
85
861. *Pass Feature to the OpenEmbedded Build System:* A top-level kernel
87 feature is passed to the kernel build subsystem. Normally, this
88 feature is a BSP for a particular kernel type.
89
902. *Locate Feature:* The file that describes the top-level feature is
91 located by searching these system directories:
92
93 - The in-tree kernel-cache directories, which are located in the
94 ```yocto-kernel-cache`` <&YOCTO_GIT_URL;/cgit/cgit.cgi/yocto-kernel-cache/tree/bsp>`__
95 repository organized under the "Yocto Linux Kernel" heading in the
96 `Yocto Project Source
97 Repositories <http://git.yoctoproject.org/cgit/cgit.cgi>`__.
98
99 - Areas pointed to by ``SRC_URI`` statements found in kernel recipes
100
101 For a typical build, the target of the search is a feature
102 description in an ``.scc`` file whose name follows this format (e.g.
103 ``beaglebone-standard.scc`` and ``beaglebone-preempt-rt.scc``):
104 bsp_root_name-kernel_type.scc
105
1063. *Expand Feature:* Once located, the feature description is either
107 expanded into a simple script of actions, or into an existing
108 equivalent script that is already part of the shipped kernel.
109
1104. *Append Extra Features:* Extra features are appended to the top-level
111 feature description. These features can come from the
112 ```KERNEL_FEATURES`` <&YOCTO_DOCS_REF_URL;#var-KERNEL_FEATURES>`__
113 variable in recipes.
114
1155. *Locate, Expand, and Append Each Feature:* Each extra feature is
116 located, expanded and appended to the script as described in step
117 three.
118
1196. *Execute the Script:* The script is executed to produce files
120 ``.scc`` and ``.cfg`` files in appropriate directories of the
121 ``yocto-kernel-cache`` repository. These files are descriptions of
122 all the branches, tags, patches and configurations that need to be
123 applied to the base Git repository to completely create the source
124 (build) branch for the new BSP or feature.
125
1267. *Clone Base Repository:* The base repository is cloned, and the
127 actions listed in the ``yocto-kernel-cache`` directories are applied
128 to the tree.
129
1308. *Perform Cleanup:* The Git repositories are left with the desired
131 branches checked out and any required branching, patching and tagging
132 has been performed.
133
134The kernel tree and cache are ready for developer consumption to be
135locally cloned, configured, and built into a Yocto Project kernel
136specific to some target hardware.
137
138.. note::
139
140 - The generated ``yocto-kernel-cache`` repository adds to the kernel
141 as shipped with the Yocto Project release. Any add-ons and
142 configuration data are applied to the end of an existing branch.
143 The full repository generation that is found in the official Yocto
144 Project kernel repositories at
145 `http://git.yoctoproject.org <&YOCTO_GIT_URL;>`__ is the
146 combination of all supported boards and configurations.
147
148 - The technique the Yocto Project team uses is flexible and allows
149 for seamless blending of an immutable history with additional
150 patches specific to a deployment. Any additions to the kernel
151 become an integrated part of the branches.
152
153 - The full kernel tree that you see on ` <&YOCTO_GIT_URL;>`__ is
154 generated through repeating the above steps for all valid BSPs.
155 The end result is a branched, clean history tree that makes up the
156 kernel for a given release. You can see the script (``kgit-scc``)
157 responsible for this in the
158 ```yocto-kernel-tools`` <&YOCTO_GIT_URL;/cgit.cgi/yocto-kernel-tools/tree/tools>`__
159 repository.
160
161 - The steps used to construct the full kernel tree are the same
162 steps that BitBake uses when it builds a kernel image.
163
164Build Strategy
165==============
166
167Once you have cloned a Yocto Linux kernel repository and the cache
168repository (``yocto-kernel-cache``) onto your development system, you
169can consider the compilation phase of kernel development, which is
170building a kernel image. Some prerequisites exist that are validated by
171the build process before compilation starts:
172
173- The ```SRC_URI`` <&YOCTO_DOCS_REF_URL;#var-SRC_URI>`__ points to the
174 kernel Git repository.
175
176- A BSP build branch with Metadata exists in the ``yocto-kernel-cache``
177 repository. The branch is based on the Yocto Linux kernel version and
178 has configurations and features grouped under the
179 ``yocto-kernel-cache/bsp`` directory. For example, features and
180 configurations for the BeagleBone Board assuming a
181 ``linux-yocto_4.12`` kernel reside in the following area of the
182 ``yocto-kernel-cache`` repository: yocto-kernel-cache/bsp/beaglebone
183
184 .. note::
185
186 In the previous example, the "yocto-4.12" branch is checked out in
187 the
188 yocto-kernel-cache
189 repository.
190
191The OpenEmbedded build system makes sure these conditions exist before
192attempting compilation. Other means, however, do exist, such as as
193bootstrapping a BSP.
194
195Before building a kernel, the build process verifies the tree and
196configures the kernel by processing all of the configuration "fragments"
197specified by feature descriptions in the ``.scc`` files. As the features
198are compiled, associated kernel configuration fragments are noted and
199recorded in the series of directories in their compilation order. The
200fragments are migrated, pre-processed and passed to the Linux Kernel
201Configuration subsystem (``lkc``) as raw input in the form of a
202``.config`` file. The ``lkc`` uses its own internal dependency
203constraints to do the final processing of that information and generates
204the final ``.config`` file that is used during compilation.
205
206Using the board's architecture and other relevant values from the
207board's template, kernel compilation is started and a kernel image is
208produced.
209
210The other thing that you notice once you configure a kernel is that the
211build process generates a build tree that is separate from your kernel's
212local Git source repository tree. This build tree has a name that uses
213the following form, where ``${MACHINE}`` is the metadata name of the
214machine (BSP) and "kernel_type" is one of the Yocto Project supported
215kernel types (e.g. "standard"): linux-${MACHINE}-kernel_type-build
216
217The existing support in the ``kernel.org`` tree achieves this default
218functionality.
219
220This behavior means that all the generated files for a particular
221machine or BSP are now in the build tree directory. The files include
222the final ``.config`` file, all the ``.o`` files, the ``.a`` files, and
223so forth. Since each machine or BSP has its own separate `Build
224Directory <&YOCTO_DOCS_REF_URL;#build-directory>`__ in its own separate
225branch of the Git repository, you can easily switch between different
226builds.