public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* Minimal kernel config generator based on Kconfig language
@ 2011-03-01  0:49 Filip Honckiewicz
  2011-03-02  9:28 ` Christian Dietrich
  2011-03-09 21:56 ` Michal Marek
  0 siblings, 2 replies; 4+ messages in thread
From: Filip Honckiewicz @ 2011-03-01  0:49 UTC (permalink / raw)
  To: linux-kbuild

Hi!

I am working on automatic kernel configurator (which is part of my
thesis) written in python, that will provide config as minimal as
possible. First stage of the project is to take loaded module names of
running kernel and add theirs config options to some created
previously config file (I use for testing make allnoconfig).

I created some parser that builds entries tree - holding all entries
with their attributes like dependencies and references to parents,
etc. - but in future it could be replaced by Kconfiglib (patched to
kernel some time ago), because it looks nicer. I also wrote
lekser/parser which builds expression tree to resolve dependencies.

I know that streamline_config.pl exists but I wanted to create tool
that is more flexible. My approach is to resolve dependencies “from
behind”. Tools like make menuconfig forces to enable some lower level
options before enabling this appropriate - higher level options
otherwise high level option will not be visible. I want to do this
opposite way what should help to automatize process of creating
configuration. For example system has loaded “radeon” module. We can
automatically get corresponding config option (DRM_RADEON), enable it
and enable all options which it depends on, going upper and upper
through DRM, PCI, HAS_IOMEM, etc.

But I have problems with Kconfig syntax and understanding all of
dependencies which are implemented in configuration tools like make
menuconfig, but described not enought in kconfig-language, so I am
asking you for help, because I will not jump over some things only by
myself:(

My questions:
1. How dependencies impacts on possible values of config? Can I set
“m” value for config option if dependency expression returns “y” or
can I set “y” if dependency expression returns “m”?
2. How config value impacts on value of selects? For example can I set
“y” for selects if config option has “m” value? What will change if we
add “if” clause in select?
3. Use case: I use make allnoconfig to generate initial config and my
“tool” to enable DRM_CONFIG what results enabling also some
dependencies and select options too what looks ok when I analyze it
using pen and sheet of paper. So why, when I use make allnoconfig and
then enable proper option using make menuconfig it also enables dozen
of another? Where is the connection?
4. Could anyone show me on DRM_CONFIG example looking on its
dependendencies and selects which options should be enabled, but doing
it from behind, I mean I know that I want to set DRM_CONFIG to “m”
value, so how should I set dependencies going upper and upper?

I would be very very very grateful for help and I thought this
explanation could be very helpful not only for me, but for anyone who
want to understand kconfig system.

Yours faithfully
Filip

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Minimal kernel config generator based on Kconfig language
  2011-03-01  0:49 Minimal kernel config generator based on Kconfig language Filip Honckiewicz
@ 2011-03-02  9:28 ` Christian Dietrich
  2011-03-07 23:36   ` Filip Honckiewicz
  2011-03-09 21:56 ` Michal Marek
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Dietrich @ 2011-03-02  9:28 UTC (permalink / raw)
  To: Filip Honckiewicz; +Cc: linux-kbuild, vamos-dev

Hi,

we[1] are working with Kconfig to do static code analysis. We have
created the undertaker[2] tool, which checks if a preprocessor block is
selectable or not. For this process we needed a formal model of Kconfig
in boolean expressions.

Filip Honckiewicz <f.honckiewicz@gmail.com> writes:

> I am working on automatic kernel configurator (which is part of my
> thesis) written in python, that will provide config as minimal as
> possible. First stage of the project is to take loaded module names of
> running kernel and add theirs config options to some created
> previously config file (I use for testing make allnoconfig).

I don't know if you have noticed the satconf project[3]. There they
expand a given subset configuration to a full blown .config, but i don't
know how minimal the resulting configuration really is.

> I created some parser that builds entries tree - holding all entries
> with their attributes like dependencies and references to parents,
> etc. - but in future it could be replaced by Kconfiglib (patched to
> kernel some time ago), because it looks nicer. I also wrote
> lekser/parser which builds expression tree to resolve dependencies.

Thats great. We use a modified menuconfig and dump out the informations
with debugging functions, which isn't that beautiful.

[...]

> But I have problems with Kconfig syntax and understanding all of
> dependencies which are implemented in configuration tools like make
> menuconfig, but described not enought in kconfig-language, so I am
> asking you for help, because I will not jump over some things only by
> myself:(

Perhaps our kconfig->boolean expression tool is interessting for you. It
produces presence conditions of the form, for every generated symbol in
autoconf.h

SYMBOL -> (EXPRESSION)

At the moment we only have support for choices and dependencies in
mainline, but the support for selects and defaults is on the way. We
have also created lots of testcases to make sure our tool is working
correctly, so perhaps it is interessting to you to have a look[4].

> My questions:
> 1. How dependencies impacts on possible values of config? Can I set
> “m” value for config option if dependency expression returns “y” or
> can I set “y” if dependency expression returns “m”?

The result of the dependency is an upper bound. If the dependency
expression evaluates to "m" you can't select the feature as "y". This
makes a lot of sense, when you think about that "y" means static
compiled into the kernel.

> 2. How config value impacts on value of selects? For example can I set
> “y” for selects if config option has “m” value? What will change if we
> add “if” clause in select?

config A
     select B

Here the value of A is the lower bound for values of B. If there is an
if-EXPR after the select EXPR & A is the lower bound.


[...] - For the other two questions I cannot give you an answer, sorry.

> I would be very very very grateful for help and I thought this
> explanation could be very helpful not only for me, but for anyone who
> want to understand kconfig system.

Yeah understanding all the semantics in Kconfig isn't that easy.

[1] http://www4.informatik.uni-erlangen.de/Research/VAMOS/
[2] http://vamos.informatik.uni-erlangen.de/trac/undertaker
[3] https://github.com/vegard/linux-2.6-kconfig-sat
[4] http://vamos.informatik.uni-erlangen.de/trac/undertaker/browser/rsf2model/validation
-- 
(λ x . x x) (λ x . x x) -- See how beautiful the lambda is
No documentation is better than bad documentation
-- Das Ausdrucken dieser Mail wird urheberrechtlich verfolgt.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Minimal kernel config generator based on Kconfig language
  2011-03-02  9:28 ` Christian Dietrich
@ 2011-03-07 23:36   ` Filip Honckiewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Filip Honckiewicz @ 2011-03-07 23:36 UTC (permalink / raw)
  To: Christian Dietrich; +Cc: linux-kbuild, vamos-dev

Hello,

I had no internet for few days and couldn't check the links you sent
(now I'll do it as soon as possible), but I would like to thank you
Christian for response and tips about upper bound, lower bound and how
to understand dependencies and selects. There are many other
attributes which I'm not sure of semantics, but I try to understand it
testing make menuconfig and watching differences in generated .config
or checking mconf code. I am very appreciate for your help.

It would be nice to have semantics explained in documentation btw

Filip

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Minimal kernel config generator based on Kconfig language
  2011-03-01  0:49 Minimal kernel config generator based on Kconfig language Filip Honckiewicz
  2011-03-02  9:28 ` Christian Dietrich
@ 2011-03-09 21:56 ` Michal Marek
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Marek @ 2011-03-09 21:56 UTC (permalink / raw)
  To: Filip Honckiewicz; +Cc: linux-kbuild

On 1.3.2011 01:49, Filip Honckiewicz wrote:
> Hi!
> 
> I am working on automatic kernel configurator (which is part of my
> thesis) written in python, that will provide config as minimal as
> possible. First stage of the project is to take loaded module names of
> running kernel and add theirs config options to some created
> previously config file (I use for testing make allnoconfig).

How does it compare to the perl-based make localmodconfig?


> My questions:
> 1. How dependencies impacts on possible values of config? Can I set
> “m” value for config option if dependency expression returns “y” or
> can I set “y” if dependency expression returns “m”?

"depends on m" sets the upper limit to m (and y is > m).


> 2. How config value impacts on value of selects? For example can I set
> “y” for selects if config option has “m” value?

No.


> What will change if we
> add “if” clause in select?

The select will only apply if the if expression evaluates to non-zero.


> 3. Use case: I use make allnoconfig to generate initial config and my
> “tool” to enable DRM_CONFIG what results enabling also some
> dependencies and select options too what looks ok when I analyze it
> using pen and sheet of paper. So why, when I use make allnoconfig and
> then enable proper option using make menuconfig it also enables dozen
> of another? Where is the connection?

Hard to tell with such vague problem description. What differences do
you see and why you think your tool is right and menuconfig is wrong at
selecting some options?

Michal

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-03-09 21:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01  0:49 Minimal kernel config generator based on Kconfig language Filip Honckiewicz
2011-03-02  9:28 ` Christian Dietrich
2011-03-07 23:36   ` Filip Honckiewicz
2011-03-09 21:56 ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox