mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [ptxdist] [PATCH] doc: add section about kconfig diffs
Date: Mon, 26 Apr 2021 23:59:49 +0200	[thread overview]
Message-ID: <20210426215949.4236-1-rhi@pengutronix.de> (raw)

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 doc/dev_kconfig_diffs.rst     | 79 +++++++++++++++++++++++++++++++++++
 doc/dev_layers_in_ptxdist.rst |  3 +-
 doc/dev_manual.rst            |  1 +
 3 files changed, 82 insertions(+), 1 deletion(-)
 create mode 100644 doc/dev_kconfig_diffs.rst

diff --git a/doc/dev_kconfig_diffs.rst b/doc/dev_kconfig_diffs.rst
new file mode 100644
index 000000000000..5673bd2d2dd6
--- /dev/null
+++ b/doc/dev_kconfig_diffs.rst
@@ -0,0 +1,79 @@
+.. _kconfig-diffs:
+
+Kconfig Diffs
+-------------
+
+For packages using Kconfig as their configuration system, PTXdist can generate
+their config file from another *reference config file* and a *Kconfig diff* on
+the fly.
+This mechanism can be used to build configuration variants of a kernel or
+barebox package.
+For example, a "debug" kernel package can refer to the config file of the
+"production" kernel as its reference config file, and its Kconfig diff then
+only contains the Kconfig symbols that were changed in the "debug" variant:
+
++-----------------------------------+-------------------------------------+-----------------------------------+
+| release config symbol             | debug kconfig diff                  | resulting debug config symbol     |
++===================================+=====================================+===================================+
+| CONFIG_LOCALVERSION="release"     | CONFIG_LOCALVERSION="debug"         | CONFIG_LOCALVERSION="debug"       |
++-----------------------------------+-------------------------------------+-----------------------------------+
+| # CONFIG_ARCH_MULTI_V6 is not set |                                     | # CONFIG_ARCH_MULTI_V6 is not set |
++-----------------------------------+-------------------------------------+-----------------------------------+
+| CONFIG_ARCH_MULTI_V7=y            |                                     | CONFIG_ARCH_MULTI_V7=y            |
++-----------------------------------+-------------------------------------+-----------------------------------+
+| # CONFIG_CGROUP_DEBUG is not set  | CONFIG_CGROUP_DEBUG=y               | CONFIG_CGROUP_DEBUG=y             |
++-----------------------------------+-------------------------------------+-----------------------------------+
+| # CONFIG_DEBUG_PREEMPT is not set | CONFIG_DEBUG_PREEMPT=y              | CONFIG_DEBUG_PREEMPT=y            |
++-----------------------------------+-------------------------------------+-----------------------------------+
+| CONFIG_WATCHDOG=y                 | # CONFIG_WATCHDOG is not set        | # CONFIG_WATCHDOG is not set      |
++-----------------------------------+-------------------------------------+-----------------------------------+
+| CONFIG_WATCHDOG_CORE=y            | # CONFIG_WATCHDOG_CORE is undefined |                                   |
++-----------------------------------+-------------------------------------+-----------------------------------+
+| CONFIG_BCM2835_WDT=y              | # CONFIG_BCM2835_WDT is undefined   |                                   |
++-----------------------------------+-------------------------------------+-----------------------------------+
+
+Kconfig does not write symbols to the config file that have unfulfilled dependencies (e.g., in the
+above example ``CONFIG_WATCHDOG_CORE`` and ``CONFIG_BCM2835_WDT`` depend on ``CONFIG_WATCHDOG``).
+Those symbols that are not present in the resulting debug config file are represented as ``… is
+undefined`` in the diff.
+
+The first line of the Kconfig diff file contains the MD5 sum of the reference config file.
+PTXdist uses this checksum to detect when the reference config has changed,
+in which case the diff needs to be regenerated from the package's config file,
+and to make sure that the diff is applicable to the reference config.
+
+Using Kconfig diffs
+~~~~~~~~~~~~~~~~~~~
+
+The main part is setting the ``<PKG>_REF_CONFIG`` variable of a package to the reference config
+file, for example::
+
+   # rules/kernel.make:
+   KERNEL_CONFIG		:= $(call ptx/in-platformconfigdir, kernelconfig-release)
+
+::
+
+   # rules/kernel-debug.make:
+   KERNEL_DEBUG_CONFIG		:= $(call ptx/in-platformconfigdir, kernelconfig-debug)
+   KERNEL_DEBUG_REF_CONFIG	:= $(call ptx/in-platformconfigdir, kernelconfig-release)
+
+PTXdist will now automatically generate ``kernelconfig-debug`` from ``kernelconfig-release`` and
+``kernelconfig-debug.diff`` whenever doing and *oldconfig* or *menuconfig* on the *kernel-debug*
+package.
+If any symbols were changed by that operation, both the ``kernelconfig-debug.diff`` and the
+``kernelconfig-debug`` are updated afterwards.
+
+Kconfig diffs and layers
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+PTXdist uses the same diff mechanism whenever the config file of a Kconfig-style package is changed
+in an inherited layer (see :ref:`layers-in-ptxdist`).
+In that case, the diff is calculated between the package's config file in the base layer and the
+package's (adapted) config file in the current layer.
+
+.. note::
+   When using both ``<PKG>_REF_CONFIG`` and inter-layer Kconfig diffs, the inter-layer diff takes
+   precedence, and the reference config file in the inherited layer is ignored.
+   In the following example, arrows represent the config diff relation:
+
+   .. image:: dev_kconfig_diffs_layer_precedence.svg
diff --git a/doc/dev_layers_in_ptxdist.rst b/doc/dev_layers_in_ptxdist.rst
index ec92c8c8a86c..a1066396ca28 100644
--- a/doc/dev_layers_in_ptxdist.rst
+++ b/doc/dev_layers_in_ptxdist.rst
@@ -98,7 +98,8 @@ Packages with kconfig Based Config Files
 
 For packages such as the Linux kernel that have kconfig based config files,
 a lot of the infrastructure to handle config files and deltas across
-multiple layers can be reused. Consistency validation is done implicitly
+multiple layers can be reused (see :ref:`kconfig-diffs`).
+Consistency validation is done implicitly
 and ``menuconfig`` and other kconfig commands will use config files and
 deltas as expected.
 
diff --git a/doc/dev_manual.rst b/doc/dev_manual.rst
index 03a05a661a97..c232cc91428a 100644
--- a/doc/dev_manual.rst
+++ b/doc/dev_manual.rst
@@ -14,4 +14,5 @@ This chapter shows all (or most) of the details of how PTXdist works.
    dev_add_bin_only_files
    dev_create_new_pkg_templates
    dev_layers_in_ptxdist
+   dev_kconfig_diffs
    dev_code_signing
-- 
2.29.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

             reply	other threads:[~2021-04-26 22:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 21:59 Roland Hieber [this message]
2021-04-27  8:30 ` [ptxdist] [PATCH v2] " Roland Hieber
2021-04-27 11:49   ` Roland Hieber
2021-05-07  6:42     ` [ptxdist] [PATCH] ptxd_make_world_package_info: improve rev config handling when layers are involved Michael Olbrich
2021-05-07  6:07   ` [ptxdist] [APPLIED] doc: add section about kconfig diffs Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210426215949.4236-1-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox