blob: e79134cc3d7583f0ef3c0600534164f984499a8b [file] [log] [blame]
Mario Six78a88f72018-07-10 08:40:17 +02001# -*- coding: utf-8 -*-
2#
3# The U-Boot documentation build configuration file, created by
4# sphinx-quickstart on Fri Feb 12 13:51:46 2016.
5#
6# This file is execfile()d with the current directory set to its
7# containing dir.
8#
9# Note that not all possible configuration values are present in this
10# autogenerated file.
11#
12# All configuration values have a default; values that are commented out
13# serve to show the default.
14
15import sys
16import os
17import sphinx
18
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +010019from subprocess import check_output
20
Mario Six78a88f72018-07-10 08:40:17 +020021# Get Sphinx version
22major, minor, patch = sphinx.version_info[:3]
23
Heinrich Schuchardtdf867962024-07-16 21:04:23 +020024# Set canonical URL from the Read the Docs Domain
25html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
26
27# Tell Jinja2 templates the build is running on Read the Docs
28if os.environ.get("READTHEDOCS", "") == "True":
29 html_context["READTHEDOCS"] = True
Mario Six78a88f72018-07-10 08:40:17 +020030
31# If extensions (or modules to document with autodoc) are in another directory,
32# add these directories to sys.path here. If the directory is relative to the
33# documentation root, use os.path.abspath to make it absolute, like shown here.
34sys.path.insert(0, os.path.abspath('sphinx'))
35from load_config import loadConfig
36
37# -- General configuration ------------------------------------------------
38
39# If your documentation needs a minimal Sphinx version, state it here.
Heinrich Schuchardtb2a1d6b2021-08-05 20:13:41 +020040needs_sphinx = '2.4.4'
Mario Six78a88f72018-07-10 08:40:17 +020041
42# Add any Sphinx extension module names here, as strings. They can be
43# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
44# ones.
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +010045extensions = ['kerneldoc', 'rstFlatTable', 'kernel_include',
46 'kfigure', 'sphinx.ext.ifconfig', # 'automarkup',
47 'maintainers_include', 'sphinx.ext.autosectionlabel',
Nishanth Menon1cfcc222023-08-24 10:40:35 -050048 'kernel_abi', 'kernel_feat', 'sphinx-prompt']
Heinrich Schuchardtae2b48e2020-11-30 09:52:57 +010049
50#
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +010051# cdomain is badly broken in Sphinx 3+. Leaving it out generates *most*
52# of the docs correctly, but not all. Scream bloody murder but allow
53# the process to proceed; hopefully somebody will fix this properly soon.
Heinrich Schuchardtae2b48e2020-11-30 09:52:57 +010054#
55if major >= 3:
56 if (major > 3) or (minor > 0 or patch >= 2):
Heinrich Schuchardtae2b48e2020-11-30 09:52:57 +010057 # Sphinx c function parser is more pedantic with regards to type
58 # checking. Due to that, having macros at c:function cause problems.
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +010059 # Those needed to be scaped by using c_id_attributes[] array
Heinrich Schuchardtae2b48e2020-11-30 09:52:57 +010060 c_id_attributes = [
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +010061 # GCC Compiler types not parsed by Sphinx:
62 "__restrict__",
Heinrich Schuchardtae2b48e2020-11-30 09:52:57 +010063
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +010064 # include/linux/compiler_types.h:
65 "__iomem",
66 "__kernel",
67 "noinstr",
68 "notrace",
69 "__percpu",
70 "__rcu",
71 "__user",
72
73 # include/linux/compiler_attributes.h:
74 "__alias",
75 "__aligned",
76 "__aligned_largest",
77 "__always_inline",
78 "__assume_aligned",
79 "__cold",
80 "__attribute_const__",
81 "__copy",
82 "__pure",
83 "__designated_init",
84 "__visible",
85 "__printf",
86 "__scanf",
87 "__gnu_inline",
88 "__malloc",
89 "__mode",
90 "__no_caller_saved_registers",
91 "__noclone",
92 "__nonstring",
93 "__noreturn",
94 "__packed",
95 "__pure",
96 "__section",
97 "__always_unused",
Heinrich Schuchardtae2b48e2020-11-30 09:52:57 +010098 "__maybe_unused",
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +010099 "__used",
100 "__weak",
101 "noinline",
Heinrich Schuchardtae2b48e2020-11-30 09:52:57 +0100102
103 # include/efi.h
104 "EFIAPI",
105
106 # include/efi_loader.h
107 "__efi_runtime",
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +0100108
109 # include/linux/memblock.h:
110 "__init_memblock",
111 "__meminit",
112
113 # include/linux/init.h:
114 "__init",
115 "__ref",
116
117 # include/linux/linkage.h:
118 "asmlinkage",
Heinrich Schuchardtae2b48e2020-11-30 09:52:57 +0100119 ]
120
121else:
122 extensions.append('cdomain')
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +0100123
124# Ensure that autosectionlabel will produce unique names
125autosectionlabel_prefix_document = True
126autosectionlabel_maxdepth = 2
Mario Six78a88f72018-07-10 08:40:17 +0200127
Heinrich Schuchardtb2a1d6b2021-08-05 20:13:41 +0200128extensions.append("sphinx.ext.imgmath")
Mario Six78a88f72018-07-10 08:40:17 +0200129
130# Add any paths that contain templates here, relative to this directory.
131templates_path = ['_templates']
132
133# The suffix(es) of source filenames.
134# You can specify multiple suffix as a list of string:
135# source_suffix = ['.rst', '.md']
136source_suffix = '.rst'
137
138# The encoding of source files.
139#source_encoding = 'utf-8-sig'
140
141# The master toctree document.
142master_doc = 'index'
143
144# General information about the project.
Heinrich Schuchardt611e7f82021-02-16 18:20:54 +0100145project = 'Das U-Boot'
146copyright = 'The U-Boot development community'
147author = 'The U-Boot development community'
Mario Six78a88f72018-07-10 08:40:17 +0200148
149# The version info for the project you're documenting, acts as replacement for
150# |version| and |release|, also used in various other places throughout the
151# built documents.
152#
153# In a normal build, version and release are are set to KERNELVERSION and
154# KERNELRELEASE, respectively, from the Makefile via Sphinx command line
155# arguments.
156#
157# The following code tries to extract the information by reading the Makefile,
158# when Sphinx is run directly (e.g. by Read the Docs).
159try:
160 makefile_version = None
161 makefile_patchlevel = None
162 for line in open('../Makefile'):
163 key, val = [x.strip() for x in line.split('=', 2)]
164 if key == 'VERSION':
165 makefile_version = val
166 elif key == 'PATCHLEVEL':
167 makefile_patchlevel = val
168 if makefile_version and makefile_patchlevel:
169 break
170except:
171 pass
172finally:
173 if makefile_version and makefile_patchlevel:
174 version = release = makefile_version + '.' + makefile_patchlevel
175 else:
176 version = release = "unknown version"
177
178# The language for content autogenerated by Sphinx. Refer to documentation
179# for a list of supported languages.
180#
181# This is also used if you do content translation via gettext catalogs.
182# Usually you set "language" from the command line for these cases.
Quentin Schulz2b943592022-11-07 14:49:31 +0100183language = 'en'
Mario Six78a88f72018-07-10 08:40:17 +0200184
185# There are two options for replacing |today|: either, you set today to some
186# non-false value, then it is used:
187#today = ''
188# Else, today_fmt is used as the format for a strftime call.
189#today_fmt = '%B %d, %Y'
190
191# List of patterns, relative to source directory, that match files and
192# directories to ignore when looking for source files.
193exclude_patterns = ['output']
194
195# The reST default role (used for this markup: `text`) to use for all
196# documents.
197#default_role = None
198
199# If true, '()' will be appended to :func: etc. cross-reference text.
200#add_function_parentheses = True
201
202# If true, the current module name will be prepended to all description
203# unit titles (such as .. function::).
204#add_module_names = True
205
206# If true, sectionauthor and moduleauthor directives will be shown in the
207# output. They are ignored by default.
208#show_authors = False
209
210# The name of the Pygments (syntax highlighting) style to use.
211pygments_style = 'sphinx'
212
213# A list of ignored prefixes for module index sorting.
214#modindex_common_prefix = []
215
216# If true, keep warnings as "system message" paragraphs in the built documents.
217#keep_warnings = False
218
219# If true, `todo` and `todoList` produce output, else they produce nothing.
220todo_include_todos = False
221
222primary_domain = 'c'
223highlight_language = 'none'
224
225# -- Options for HTML output ----------------------------------------------
226
227# The theme to use for HTML and HTML Help pages. See the documentation for
228# a list of builtin themes.
229
230# The Read the Docs theme is available from
231# - https://github.com/snide/sphinx_rtd_theme
232# - https://pypi.python.org/pypi/sphinx_rtd_theme
233# - python-sphinx-rtd-theme package (on Debian)
234try:
235 import sphinx_rtd_theme
236 html_theme = 'sphinx_rtd_theme'
Heinrich Schuchardt31a221d2024-01-14 14:18:20 +0100237 extensions.append('sphinx_rtd_theme')
Mario Six78a88f72018-07-10 08:40:17 +0200238except ImportError:
239 sys.stderr.write('Warning: The Sphinx \'sphinx_rtd_theme\' HTML theme was not found. Make sure you have the theme installed to produce pretty HTML output. Falling back to the default theme.\n')
240
241# Theme options are theme-specific and customize the look and feel of a theme
242# further. For a list of options available for each theme, see the
243# documentation.
244#html_theme_options = {}
245
246# Add any paths that contain custom themes here, relative to this directory.
247#html_theme_path = []
248
249# The name for this set of Sphinx documents. If None, it defaults to
250# "<project> v<release> documentation".
251#html_title = None
252
253# A shorter title for the navigation bar. Default is the same as html_title.
254#html_short_title = None
255
256# The name of an image file (relative to this directory) to place at the top
257# of the sidebar.
Heinrich Schuchardt611e7f82021-02-16 18:20:54 +0100258html_logo = '../tools/logos/u-boot_logo.svg'
Mario Six78a88f72018-07-10 08:40:17 +0200259
260# The name of an image file (within the static path) to use as favicon of the
261# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
262# pixels large.
263#html_favicon = None
264
265# Add any paths that contain custom static files (such as style sheets) here,
266# relative to this directory. They are copied after the builtin static files,
267# so a file named "default.css" will overwrite the builtin "default.css".
268
269html_static_path = ['sphinx-static']
270
271html_context = {
272 'css_files': [
273 '_static/theme_overrides.css',
274 ],
275}
276
277# Add any extra paths that contain custom files (such as robots.txt or
278# .htaccess) here, relative to this directory. These files are copied
279# directly to the root of the documentation.
280#html_extra_path = []
281
282# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
283# using the given strftime format.
284#html_last_updated_fmt = '%b %d, %Y'
285
286# If true, SmartyPants will be used to convert quotes and dashes to
287# typographically correct entities.
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +0100288html_use_smartypants = False
Mario Six78a88f72018-07-10 08:40:17 +0200289
290# Custom sidebar templates, maps document names to template names.
291#html_sidebars = {}
292
293# Additional templates that should be rendered to pages, maps page names to
294# template names.
295#html_additional_pages = {}
296
297# If false, no module index is generated.
298#html_domain_indices = True
299
300# If false, no index is generated.
301#html_use_index = True
302
303# If true, the index is split into individual pages for each letter.
304#html_split_index = False
305
306# If true, links to the reST sources are added to the pages.
307#html_show_sourcelink = True
308
309# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
310#html_show_sphinx = True
311
312# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
313#html_show_copyright = True
314
315# If true, an OpenSearch description file will be output, and all pages will
316# contain a <link> tag referring to it. The value of this option must be the
317# base URL from which the finished HTML is served.
318#html_use_opensearch = ''
319
320# This is the file name suffix for HTML files (e.g. ".xhtml").
321#html_file_suffix = None
322
323# Language to be used for generating the HTML full-text search index.
324# Sphinx supports the following languages:
325# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
326# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr'
327#html_search_language = 'en'
328
329# A dictionary with options for the search language support, empty by default.
330# Now only 'ja' uses this config value
331#html_search_options = {'type': 'default'}
332
333# The name of a javascript file (relative to the configuration directory) that
334# implements a search results scorer. If empty, the default will be used.
335#html_search_scorer = 'scorer.js'
336
337# Output file base name for HTML help builder.
Heinrich Schuchardt611e7f82021-02-16 18:20:54 +0100338htmlhelp_basename = 'TheUBootdoc'
Mario Six78a88f72018-07-10 08:40:17 +0200339
340# -- Options for LaTeX output ---------------------------------------------
341
342latex_elements = {
Heinrich Schuchardt00e80da2021-08-05 20:18:06 +0200343 # The paper size ('letterpaper' or 'a4paper').
344 'papersize': 'a4paper',
Mario Six78a88f72018-07-10 08:40:17 +0200345
Heinrich Schuchardt00e80da2021-08-05 20:18:06 +0200346 # The font size ('10pt', '11pt' or '12pt').
347 'pointsize': '11pt',
Mario Six78a88f72018-07-10 08:40:17 +0200348
Heinrich Schuchardt00e80da2021-08-05 20:18:06 +0200349 # Latex figure (float) alignment
350 #'figure_align': 'htbp',
Mario Six78a88f72018-07-10 08:40:17 +0200351
Heinrich Schuchardt00e80da2021-08-05 20:18:06 +0200352 # Don't mangle with UTF-8 chars
353 'inputenc': '',
354 'utf8extra': '',
Mario Six78a88f72018-07-10 08:40:17 +0200355
Heinrich Schuchardt00e80da2021-08-05 20:18:06 +0200356 # Set document margins
357 'sphinxsetup': '''
358 hmargin=0.5in, vmargin=1in,
359 parsedliteralwraps=true,
360 verbatimhintsturnover=false,
361 ''',
362
363 # Additional stuff for the LaTeX preamble.
Mario Six78a88f72018-07-10 08:40:17 +0200364 'preamble': '''
Heinrich Schuchardt00e80da2021-08-05 20:18:06 +0200365 % Use some font with UTF-8 support with XeLaTeX
Mario Six78a88f72018-07-10 08:40:17 +0200366 \\usepackage{fontspec}
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +0100367 \\setsansfont{DejaVu Sans}
368 \\setromanfont{DejaVu Serif}
Mario Six78a88f72018-07-10 08:40:17 +0200369 \\setmonofont{DejaVu Sans Mono}
Heinrich Schuchardt00e80da2021-08-05 20:18:06 +0200370 ''',
Mario Six78a88f72018-07-10 08:40:17 +0200371}
372
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +0100373# At least one book (translations) may have Asian characters
374# with are only displayed if xeCJK is used
375
376cjk_cmd = check_output(['fc-list', '--format="%{family[0]}\n"']).decode('utf-8', 'ignore')
377if cjk_cmd.find("Noto Sans CJK SC") >= 0:
378 print ("enabling CJK for LaTeX builder")
379 latex_elements['preamble'] += '''
380 % This is needed for translations
381 \\usepackage{xeCJK}
382 \\setCJKmainfont{Noto Sans CJK SC}
383 '''
384
Mario Six78a88f72018-07-10 08:40:17 +0200385# With Sphinx 1.6, it is possible to change the Bg color directly
386# by using:
387# \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
388# \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
389# \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
390# \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
391#
392# However, it require to use sphinx heavy box with:
393#
394# \renewenvironment{sphinxlightbox} {%
395# \\begin{sphinxheavybox}
396# }
397# \\end{sphinxheavybox}
398# }
399#
400# Unfortunately, the implementation is buggy: if a note is inside a
401# table, it isn't displayed well. So, for now, let's use boring
402# black and white notes.
403
404# Grouping the document tree into LaTeX files. List of tuples
405# (source start file, target name, title,
406# author, documentclass [howto, manual, or own class]).
407# Sorted in alphabetical order
408latex_documents = [
Heinrich Schuchardt611e7f82021-02-16 18:20:54 +0100409 ('index', 'u-boot-hacker-manual.tex', 'U-Boot Hacker Manual',
410 'The U-Boot development community', 'manual'),
Mario Six78a88f72018-07-10 08:40:17 +0200411]
412
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +0100413# Add all other index files from Documentation/ subdirectories
414for fn in os.listdir('.'):
415 doc = os.path.join(fn, "index")
416 if os.path.exists(doc + ".rst"):
417 has = False
418 for l in latex_documents:
419 if l[0] == doc:
420 has = True
421 break
422 if not has:
423 latex_documents.append((doc, fn + '.tex',
Heinrich Schuchardt611e7f82021-02-16 18:20:54 +0100424 'U-Boot %s Documentation' % fn.capitalize(),
425 'The U-Boot development community',
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +0100426 'manual'))
427
Mario Six78a88f72018-07-10 08:40:17 +0200428# The name of an image file (relative to this directory) to place at the top of
429# the title page.
430#latex_logo = None
431
432# For "manual" documents, if this is true, then toplevel headings are parts,
433# not chapters.
434#latex_use_parts = False
435
436# If true, show page references after internal links.
437#latex_show_pagerefs = False
438
439# If true, show URL addresses after external links.
440#latex_show_urls = False
441
442# Documents to append as an appendix to all manuals.
443#latex_appendices = []
444
445# If false, no module index is generated.
446#latex_domain_indices = True
447
448
449# -- Options for manual page output ---------------------------------------
450
451# One entry per manual page. List of tuples
452# (source start file, name, description, authors, manual section).
453man_pages = [
Maxim Cournoyer7fa4c272022-12-18 21:48:08 -0500454 (master_doc, 'u-boot', 'The U-Boot Documentation',
Mario Six78a88f72018-07-10 08:40:17 +0200455 [author], 1)
456]
457
458# If true, show URL addresses after external links.
459#man_show_urls = False
460
461
462# -- Options for Texinfo output -------------------------------------------
463
464# Grouping the document tree into Texinfo files. List of tuples
465# (source start file, target name, title, author,
466# dir menu entry, description, category)
467texinfo_documents = [
Maxim Cournoyer7fa4c272022-12-18 21:48:08 -0500468 (master_doc, 'u-boot', 'The U-Boot Documentation',
469 author, 'U-Boot', 'Boot loader for embedded systems',
Mario Six78a88f72018-07-10 08:40:17 +0200470 'Miscellaneous'),
471]
472
473# Documents to append as an appendix to all manuals.
474#texinfo_appendices = []
475
476# If false, no module index is generated.
477#texinfo_domain_indices = True
478
479# How to display URL addresses: 'footnote', 'no', or 'inline'.
480#texinfo_show_urls = 'footnote'
481
482# If true, do not generate a @detailmenu in the "Top" node's menu.
483#texinfo_no_detailmenu = False
484
485
486# -- Options for Epub output ----------------------------------------------
487
488# Bibliographic Dublin Core info.
489epub_title = project
490epub_author = author
491epub_publisher = author
492epub_copyright = copyright
493
494# The basename for the epub file. It defaults to the project name.
495#epub_basename = project
496
497# The HTML theme for the epub output. Since the default themes are not
498# optimized for small screen space, using the same theme for HTML and epub
499# output is usually not wise. This defaults to 'epub', a theme designed to save
500# visual space.
501#epub_theme = 'epub'
502
503# The language of the text. It defaults to the language option
504# or 'en' if the language is not set.
505#epub_language = ''
506
507# The scheme of the identifier. Typical schemes are ISBN or URL.
508#epub_scheme = ''
509
510# The unique identifier of the text. This can be a ISBN number
511# or the project homepage.
512#epub_identifier = ''
513
514# A unique identification for the text.
515#epub_uid = ''
516
517# A tuple containing the cover image and cover page html template filenames.
518#epub_cover = ()
519
520# A sequence of (type, uri, title) tuples for the guide element of content.opf.
521#epub_guide = ()
522
523# HTML files that should be inserted before the pages created by sphinx.
524# The format is a list of tuples containing the path and title.
525#epub_pre_files = []
526
527# HTML files that should be inserted after the pages created by sphinx.
528# The format is a list of tuples containing the path and title.
529#epub_post_files = []
530
531# A list of files that should not be packed into the epub file.
532epub_exclude_files = ['search.html']
533
534# The depth of the table of contents in toc.ncx.
535#epub_tocdepth = 3
536
537# Allow duplicate toc entries.
538#epub_tocdup = True
539
540# Choose between 'default' and 'includehidden'.
541#epub_tocscope = 'default'
542
543# Fix unsupported image types using the Pillow.
544#epub_fix_images = False
545
546# Scale large images.
547#epub_max_image_width = 0
548
549# How to display URL addresses: 'footnote', 'no', or 'inline'.
550#epub_show_urls = 'inline'
551
552# If false, no index is generated.
553#epub_use_index = True
554
555#=======
556# rst2pdf
557#
558# Grouping the document tree into PDF files. List of tuples
559# (source start file, target name, title, author, options).
560#
Heinrich Schuchardt98f01cf2020-12-31 23:16:46 +0100561# See the Sphinx chapter of https://ralsina.me/static/manual.pdf
Mario Six78a88f72018-07-10 08:40:17 +0200562#
563# FIXME: Do not add the index file here; the result will be too big. Adding
564# multiple PDF files here actually tries to get the cross-referencing right
565# *between* PDF files.
566pdf_documents = [
Heinrich Schuchardt611e7f82021-02-16 18:20:54 +0100567 ('uboot-documentation', u'U-Boot', u'U-Boot', u'J. Random Bozo'),
Mario Six78a88f72018-07-10 08:40:17 +0200568]
569
570# kernel-doc extension configuration for running Sphinx directly (e.g. by Read
571# the Docs). In a normal build, these are supplied from the Makefile via command
572# line arguments.
573kerneldoc_bin = '../scripts/kernel-doc'
574kerneldoc_srctree = '..'
575
576# ------------------------------------------------------------------------------
577# Since loadConfig overwrites settings from the global namespace, it has to be
578# the last statement in the conf.py file
579# ------------------------------------------------------------------------------
580loadConfig(globals())