[U-Boot] [PATCH 09/10] kconfig: move CONFIG_OF_* to Kconfig

Masahiro Yamada yamada.m at jp.panasonic.com
Tue Sep 9 04:45:20 CEST 2014


Hi Daniel,


On Mon, 08 Sep 2014 21:23:05 +0200
Daniel Schwierzeck <daniel.schwierzeck at gmail.com> wrote:

> 
> > diff --git a/dts/Kconfig b/dts/Kconfig
> > new file mode 100644
> > index 0000000..98b2357
> > --- /dev/null
> > +++ b/dts/Kconfig
> > @@ -0,0 +1,46 @@
> > +#
> > +# Device Tree Control
> > +#
> > +# TODO:
> > +#   This feature is not currently supported for SPL,
> > +#    but this restriction should be removed in the future.
> > +
> > +menu "Device Tree Control"
> > +	depends on !SPL_BUILD
> > +	depends on ARM || MICROBLAZE || SANDBOX || X86
> 
> I suggest to use boolean symbols HAS_* or SUPPORTS_* like the kernel
> does. For example:
> 
> config SUPPORTS_OF_CONTROL
>         bool
> 
> menu "Device Tree Control"
>         depends on !SPL_BUILD
>         depends on SUPPORTS_OF_CONTROL
> 
> 
> arch/Kconfig:
> config ARM
>         bool "ARM architecture"
>         select SUPPORTS_OF_CONTROL
> 

Good idea,
altough HAVE_* seems more common:

In Linux 3.17-rc4,

$ find . -name 'Kconfig*' | xargs grep HAVE_ | wc
   1332    4394   71649
$ find . -name 'Kconfig*' | xargs grep HAS_ | wc
    760    2744   40496
$ find . -name 'Kconfig*' | xargs grep SUPPORTS_ | wc
    487    1571   26996


Besides, Documentation/kbuild/kconfig-language.txt
suggests to do so.

---------------------------8<---------------------------

Adding common features and make the usage configurable
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is a common idiom to implement a feature/functionality that are
relevant for some architectures but not all.
The recommended way to do so is to use a config variable named HAVE_*
that is defined in a common Kconfig file and selected by the relevant
architectures.
An example is the generic IOMAP functionality.

We would in lib/Kconfig see:

# Generic IOMAP is used to ...
config HAVE_GENERIC_IOMAP

config GENERIC_IOMAP
        depends on HAVE_GENERIC_IOMAP && FOO

And in lib/Makefile we would see:
obj-$(CONFIG_GENERIC_IOMAP) += iomap.o

For each architecture using the generic IOMAP functionality we would see:

config X86
        select ...
        select HAVE_GENERIC_IOMAP
        select ...

Note: we use the existing config option and avoid creating a new
config variable to select HAVE_GENERIC_IOMAP.

Note: the use of the internal config variable HAVE_GENERIC_IOMAP, it is
introduced to overcome the limitation of select which will force a
config option to 'y' no matter the dependencies.
The dependencies are moved to the symbol GENERIC_IOMAP and we avoid the
situation where select forces a symbol equals to 'y'.

---------------------------->8----------------------------



I was also thinking to add  HAVE_SPL_SUPPORT.


config SPL
        bool "Enable SPL"
        depends on HAVE_SPL_SUPPORT




Best Regards
Masahiro Yamada



More information about the U-Boot mailing list