Skip to contentSkip to conversation

doc: Replace DocBook with sphinx-based docs

RFC PATCH New Mario Six 2 participants 4 messages Jun 14, 2018 – Jun 27, 2018

Subsystems (3)
lore
Share & tools
lore

Mario Six

author
#0 lore raw

RFC PATCH 1/1 doc: Replace DocBook with sphinx-based docs

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17-r6, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

---
 Documentation/.gitignore                          |    2 +
 Documentation/Makefile                            |  124 +
 Documentation/conf.py                             |  528 +++++
 Documentation/index.rst                           |  117 +
 Documentation/media/Makefile                      |   38 +
 Documentation/media/linker_lists.h.rst.exceptions |    0
 Documentation/sphinx-static/theme_overrides.css   |   89 +
 Documentation/sphinx/cdomain.py                   |  165 ++
 Documentation/sphinx/kernel_include.py            |  190 ++
 Documentation/sphinx/kerneldoc.py                 |  146 ++
 Documentation/sphinx/kfigure.py                   |  551 +++++
 Documentation/sphinx/load_config.py               |   32 +
 Documentation/sphinx/parse-headers.pl             |  401 ++++
 Documentation/sphinx/requirements.txt             |    3 +
 Documentation/sphinx/rstFlatTable.py              |  376 +++
 Makefile                                          |    8 +-
 doc/DocBook/.gitignore                            |   15 -
 doc/DocBook/Makefile                              |  222 --
 doc/DocBook/docbook.css                           |   16 -
 doc/DocBook/efi.tmpl                              |   17 -
 doc/DocBook/linker_lists.tmpl                     |   46 -
 doc/DocBook/stdio.tmpl                            |   46 -
 doc/DocBook/stylesheet.xsl                        |   10 -
 include/linker_lists.h                            |  164 +-
 lib/efi_loader/efi_boottime.c                     |  946 ++++----
 scripts/kernel-doc                                | 2527 +++++++++------------
 26 files changed, 4375 insertions(+), 2404 deletions(-)
 create mode 100644 Documentation/.gitignore
 create mode 100644 Documentation/Makefile
 create mode 100644 Documentation/conf.py
 create mode 100644 Documentation/index.rst
 create mode 100644 Documentation/media/Makefile
 create mode 100644 Documentation/media/linker_lists.h.rst.exceptions
 create mode 100644 Documentation/sphinx-static/theme_overrides.css
 create mode 100644 Documentation/sphinx/cdomain.py
 create mode 100755 Documentation/sphinx/kernel_include.py
 create mode 100644 Documentation/sphinx/kerneldoc.py
 create mode 100644 Documentation/sphinx/kfigure.py
 create mode 100644 Documentation/sphinx/load_config.py
 create mode 100755 Documentation/sphinx/parse-headers.pl
 create mode 100644 Documentation/sphinx/requirements.txt
 create mode 100755 Documentation/sphinx/rstFlatTable.py
 delete mode 100644 doc/DocBook/.gitignore
 delete mode 100644 doc/DocBook/Makefile
 delete mode 100644 doc/DocBook/docbook.css
 delete mode 100644 doc/DocBook/efi.tmpl
 delete mode 100644 doc/DocBook/linker_lists.tmpl
 delete mode 100644 doc/DocBook/stdio.tmpl
 delete mode 100644 doc/DocBook/stylesheet.xsl
Documentation/.gitignore new file +2 -0
new file mode 100644
index 0000000000..e74fec8693
@@ -0,0 +1,2 @@
+output
+*.pyc
Documentation/Makefile new file +124 -0

124 lines not on this page · raw message

Documentation/conf.py new file +528 -0

528 lines not on this page · raw message

Documentation/index.rst new file +117 -0

117 lines not on this page · raw message

Documentation/media/Makefile new file +38 -0
new file mode 100644
index 0000000000..0efd18ab4d
@@ -0,0 +1,38 @@
+# Rules to convert a .h file to inline RST documentation
+
+SRC_DIR=$(srctree)/Documentation/media
+PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl
+API = $(srctree)/include
+
+FILES = linker_lists.h.rst
+
+TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
+
+gen_rst = \
+	echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
+	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+
+quiet_gen_rst = echo '  PARSE   $(patsubst $(srctree)/%,%,$<)'; \
+	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
+
+silent_gen_rst = ${gen_rst}
+
+$(BUILDDIR)/linker_lists.h.rst: ${API}/linker_lists.h ${PARSER} $(SRC_DIR)/linker_lists.h.rst.exceptions
+	@$($(quiet)gen_rst)
+
+# Media build rules
+
+.PHONY: all html epub xml latex
+
+all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
+html: all
+epub: all
+xml: all
+latex: $(IMGPDF) all
+linkcheck:
+
+clean:
+	-rm -f $(DOTTGT) $(IMGTGT) ${TARGETS} 2>/dev/null
+
+$(BUILDDIR):
+	$(Q)mkdir -p $@
Documentation/media/linker_lists.h.rst.exceptions new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
Documentation/sphinx-static/theme_overrides.css new file +89 -0

89 lines not on this page · raw message

Documentation/sphinx/cdomain.py new file +165 -0

165 lines not on this page · raw message

Documentation/sphinx/kernel_include.py new file +190 -0

190 lines not on this page · raw message

Documentation/sphinx/kerneldoc.py new file +146 -0

146 lines not on this page · raw message

Documentation/sphinx/kfigure.py new file +551 -0

551 lines not on this page · raw message

Documentation/sphinx/load_config.py new file +32 -0
new file mode 100644
index 0000000000..301a21aa4f
@@ -0,0 +1,32 @@
+# -*- coding: utf-8; mode: python -*-
+# pylint: disable=R0903, C0330, R0914, R0912, E0401
+
+import os
+import sys
+from sphinx.util.pycompat import execfile_
+
+# ------------------------------------------------------------------------------
+def loadConfig(namespace):
+# ------------------------------------------------------------------------------
+
+    u"""Load an additional configuration file into *namespace*.
+
+    The name of the configuration file is taken from the environment
+    ``SPHINX_CONF``. The external configuration file extends (or overwrites) the
+    configuration values from the origin ``conf.py``.  With this you are able to
+    maintain *build themes*.  """
+
+    config_file = os.environ.get("SPHINX_CONF", None)
+    if (config_file is not None
+        and os.path.normpath(namespace["__file__"]) != os.path.normpath(config_file) ):
+        config_file = os.path.abspath(config_file)
+
+        if os.path.isfile(config_file):
+            sys.stdout.write("load additional sphinx-config: %s\n" % config_file)
+            config = namespace.copy()
+            config['__file__'] = config_file
+            execfile_(config_file, config)
+            del config['__file__']
+            namespace.update(config)
+        else:
+            sys.stderr.write("WARNING: additional sphinx-config not found: %s\n" % config_file)
Documentation/sphinx/parse-headers.pl new file +401 -0

401 lines not on this page · raw message

Documentation/sphinx/requirements.txt new file +3 -0
new file mode 100644
index 0000000000..742be3e126
@@ -0,0 +1,3 @@
+docutils==0.12
+Sphinx==1.4.9
+sphinx_rtd_theme
Documentation/sphinx/rstFlatTable.py new file +376 -0

376 lines not on this page · raw message

Makefile +5 -3
index 6a190e7a89..b37acdd25c 100644
@@ -1712,9 +1712,11 @@ tests:
 
 # Documentation targets
 # ---------------------------------------------------------------------------
-%docs: scripts_basic FORCE
-	$(Q)$(MAKE) $(build)=scripts build_docproc
-	$(Q)$(MAKE) $(build)=doc/DocBook $@
+DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
+	       linkcheckdocs dochelp refcheckdocs
+PHONY += $(DOC_TARGETS)
+$(DOC_TARGETS): scripts_basic FORCE
+	$(Q)$(MAKE) $(build)=Documentation $@
 
 endif #ifeq ($(config-targets),1)
 endif #ifeq ($(mixed-targets),1)
doc/DocBook/.gitignore deleted +0 -15
deleted file mode 100644
index 7ebd5465d9..0000000000
@@ -1,15 +0,0 @@
-*.xml
-*.ps
-*.pdf
-*.html
-*.9.gz
-*.9
-*.aux
-*.dvi
-*.log
-*.out
-*.png
-*.gif
-*.svg
-media-indices.tmpl
-media-entities.tmpl
doc/DocBook/Makefile deleted +0 -222

209 lines not on this page · raw message

doc/DocBook/docbook.css deleted +0 -16
deleted file mode 100644
index 7a79ec54bd..0000000000

Lines of this file are not shown. View the raw message.

doc/DocBook/efi.tmpl deleted +0 -17
deleted file mode 100644
index 5daaae382b..0000000000

Lines of this file are not shown. View the raw message.

doc/DocBook/linker_lists.tmpl deleted +0 -46

46 lines not on this page · raw message

doc/DocBook/stdio.tmpl deleted +0 -46

46 lines not on this page · raw message

doc/DocBook/stylesheet.xsl deleted +0 -10
deleted file mode 100644
index 85b2527519..0000000000

Lines of this file are not shown. View the raw message.

include/linker_lists.h +53 -111

164 lines not on this page · raw message

lib/efi_loader/efi_boottime.c +490 -456

946 lines not on this page · raw message

scripts/kernel-doc +1065 -1462

2,527 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

--
2.16.4

Part of the diff is not shown here. View the raw message.

#1 lore raw

RFC PATCH 1/1 doc: Replace DocBook with sphinx-based docs

Quoted 8 lines · Mario Six

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17-r6, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

Quoted 7 lines

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

I like this idea, thanks for doing it. While I wish more stuff was done for DocBook, and rST isn't my favorite style, it's worth I think strongly considering the switch to as I expect some of my own usage issues to be better by now or be addressed sooner rather than later as more people pick up the tools, find problems, and fix them.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180618/8ed2b8f8/attachment.sig>
author
#2 lore raw

RFC PATCH 1/1 doc: Replace DocBook with sphinx-based docs

Hi Tom,

Quoted 18 lines · Tom Rini
Quoted 8 lines · Mario Six

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17-r6, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

Quoted 7 lines

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

Quoted 9 lines

I like this idea, thanks for doing it. While I wish more stuff was done for DocBook, and rST isn't my favorite style, it's worth I think strongly considering the switch to as I expect some of my own usage issues to be better by now or be addressed sooner rather than later as more people pick up the tools, find problems, and fix them.

--
Tom

First, thanks for the review! Should I send a proper patch, or are you going to pull it in as-is?

While we're on the subject of documentation: I was looking for a place to document the fact that sphinx-based docs are now available, and found myself unsure of where to put that information, so I took a look at all the available sources of documentation:

There's the wiki, the README, the docbook/sphinx documents (pretty much a proxy for the embedded documentation in the source files), and the documents located under doc/.

The wiki contains mostly "user documentation" (most of it in the manual), like documentation for the command-line commands, and environment variables, but it seems to be quite outdated in a lot of places. But there are also sections on development methods, code quality or design principles, most of which seem to be current.

The README contains "overview documentation" (for lack of a better term), is aimed at both "users" and "developers", and is current in some, but outdated in lots of other places (e.g. some of the mentioned boards don't even exist in the sources anymore).

The docbook/sphinx documents, seem to be more "developer-centric", since it's (for now) generated from the embedded API docs, which are, as far as I can tell, pretty up-to-date if they exist. Also, infering from the "Bootloader Hackers Manual" title from the docbook documents, there at least seemed to be the idea to make some kind of developer manual in the past.

The documents under doc/ are a aggregation of documentation on specific topics, like docs for special driver subsystems, or descriptions of the operation of subsystems (like the DM overview), as well as guides for specific technologies, and how-tos (like the DM-conversion guides). All with varying degrees of currentness.

Hence, my two questions are as follows:

Where should which kind of documentation (aside from the API documentation, obviously) go? Especially considerig the aspect that it's desireable that we keep the duplication to a minimum (there seems to be at least some duplication between the README and the manual from the wiki).

And: What kinds of documentation should exist? I think, e.g., a kind of developer's manual that explains concepts, teaches best practices, and also explains the rationales behind some decisions would be pretty useful (the sphinx-based documentation would be suitable for this, I think), as would be a manual that explains how to build, install and use U-Boot (which would be pretty much the manual from the wiki, just updated).

Best regards,
Mario

#3 lore raw

RFC PATCH 1/1 doc: Replace DocBook with sphinx-based docs

Quoted 27 lines · Mario Six

Hi Tom,

Quoted 24 lines · Tom Rini
Quoted 8 lines · Mario Six

The Linux kernel moved to sphinx-based documentation and got rid of the DocBook based documentation quite a while ago. Hence, the DocBook documentation for U-Boot should be converted as well.

To achieve this, import the necessary files from Linux v4.17-r6, and convert the current DocBook documentation (three files altogether) to sphinx/reStructuredText.

Quoted 7 lines

For now, all old DocBook documentation was merged into a single handbook, tentatively named "U-Boot Hacker Manual".

For some source files, the documentation style was changed to comply with kernel-doc; no functional changes were applied.

I like this idea, thanks for doing it. While I wish more stuff was done for DocBook, and rST isn't my favorite style, it's worth I think strongly considering the switch to as I expect some of my own usage issues to be better by now or be addressed sooner rather than later as more people pick up the tools, find problems, and fix them.

Quoted 6 lines
Quoted 3 lines

--
Tom

First, thanks for the review! Should I send a proper patch, or are you going to pull it in as-is?

A proper patch for just after 2018.07 please.

Quoted 39 lines

While we're on the subject of documentation: I was looking for a place to document the fact that sphinx-based docs are now available, and found myself unsure of where to put that information, so I took a look at all the available sources of documentation:

There's the wiki, the README, the docbook/sphinx documents (pretty much a proxy for the embedded documentation in the source files), and the documents located under doc/.

The wiki contains mostly "user documentation" (most of it in the manual), like documentation for the command-line commands, and environment variables, but it seems to be quite outdated in a lot of places. But there are also sections on development methods, code quality or design principles, most of which seem to be current.

The README contains "overview documentation" (for lack of a better term), is aimed at both "users" and "developers", and is current in some, but outdated in lots of other places (e.g. some of the mentioned boards don't even exist in the sources anymore).

The docbook/sphinx documents, seem to be more "developer-centric", since it's (for now) generated from the embedded API docs, which are, as far as I can tell, pretty up-to-date if they exist. Also, infering from the "Bootloader Hackers Manual" title from the docbook documents, there at least seemed to be the idea to make some kind of developer manual in the past.

The documents under doc/ are a aggregation of documentation on specific topics, like docs for special driver subsystems, or descriptions of the operation of subsystems (like the DM overview), as well as guides for specific technologies, and how-tos (like the DM-conversion guides). All with varying degrees of currentness.

Hence, my two questions are as follows:

Where should which kind of documentation (aside from the API documentation, obviously) go? Especially considerig the aspect that it's desireable that we keep the duplication to a minimum (there seems to be at least some duplication between the README and the manual from the wiki).

Quoted 6 lines

And: What kinds of documentation should exist? I think, e.g., a kind of developer's manual that explains concepts, teaches best practices, and also explains the rationales behind some decisions would be pretty useful (the sphinx-based documentation would be suitable for this, I think), as would be a manual that explains how to build, install and use U-Boot (which would be pretty much the manual from the wiki, just updated).

Honestly, I don't know. What I do see is that rST gives us easy HTML output too and in turn that could be more easily updated / kept up to date.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180627/d567f185/attachment.sig>