2020-12-08 15:34:22

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 0/2] Documentation/kbuild: Document COMPILE_TEST and platform dependencies

Hi all,

This patch series documents best practices for COMPILE_TEST and
architecture/platform dependencies, like already in use in most
subsystems, to serve as a point of reference.

Thanks for your comments!

Geert Uytterhoeven (2):
Documentation/kbuild: Document COMPILE_TEST dependencies
Documentation/kbuild: Document platform dependency practises

Documentation/kbuild/kconfig-language.rst | 35 +++++++++++++++++++++++
1 file changed, 35 insertions(+)

--
2.25.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2020-12-08 20:26:11

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 2/2] Documentation/kbuild: Document platform dependency practises

Document best practises for using architecture and platform dependencies.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
Documentation/kbuild/kconfig-language.rst | 24 +++++++++++++++++++++++
1 file changed, 24 insertions(+)

diff --git a/Documentation/kbuild/kconfig-language.rst b/Documentation/kbuild/kconfig-language.rst
index 2b746332d8aa6bce..87e9bbe14a21ce83 100644
--- a/Documentation/kbuild/kconfig-language.rst
+++ b/Documentation/kbuild/kconfig-language.rst
@@ -564,6 +564,30 @@ common system, and detect bugs that way.
Note that compile-tested code should avoid crashing when run on a system where
the dependency is not met.

+Architecture and platform dependencies
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Due to the presence of stubs, most drivers can now be compiled on most
+architectures. However, this does not mean it makes sense to have all drivers
+available everywhere, as the actual hardware may only exist on specific
+architectures and platforms. This is especially true for on-SoC IP cores,
+which may be limited to a specific vendor or SoC family.
+
+To prevent asking the user about drivers that cannot be used on the system(s)
+the user is compiling a kernel for, and if it makes sense, config symbols
+controlling the compilation of a driver should contain proper dependencies,
+limiting the visibility of the symbol to (a superset of) the platform(s) the
+driver can be used on. The dependency can be an architecture (e.g. ARM) or
+platform (e.g. ARCH_OMAP4) dependency. This makes life simpler not only for
+distro config owners, but also for every single developer or user who
+configures a kernel.
+
+Such a dependency can be relaxed by combining it with the compile-testing rule
+above, leading to:
+
+ config FOO
+ bool "Support for foo hardware"
+ depends on ARCH_FOO_VENDOR || COMPILE_TEST
+
Kconfig recursive dependency limitations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

--
2.25.1