[Toybox] kconfig replacement

Rob Landley rob at landley.net
Sat Feb 18 21:37:17 PST 2012


On 02/17/2012 03:52 PM, Kai Trukenmueller wrote:
> attached is scripts/mkconfig.awk which could replace kconfig/*.

Hmmm.  Interesting.

I'm by no means an awk expert, but then I didn't know anything about sed
before I had to turn busybox's half implementation into a real one that
autoconf could use.  I'll need to write an awk eventually...

> It could be used from the makefile for the targets:
> 
> config:
>     awk -f scripts/mkconfig.awk Config.in toys/*.c
> 
> allyesconfig:
>     yes | awk -f script/mkconfig.awk Config.in toys/*.c
> 
> allnoconfig:
>     yes n | awk -f scripts/mkconfig.awk Config.in toys/*.c
> 
> defaultconfig:
>     yes "" | awk -f scripts/mkconfig.awk Config.in toys/*.c
> 
> 
> it is not a replacement for menuconfig.

Which worries me a bit.

The plan for the new menuconfig was to just emit ANSI sequences rather
than using ncurses, but it still needs to interactively respond to
cursor keys (which are themselves multi-character sequences), maintain
internal state (what you've selected and what you haven't, plus
dependency resolution), and then write out the result.

I have no idea how to do this in awk.  But then, I don't know awk.

Awk is a SUSv4 command I plan to add to toybox, if this _can_ be
implemented in awk by all means let's do it. The alternative is to write
it in C.

We could also do just menuconfig in C, and do the others in awk, but
then they can't share infrastructure.  Running menuconfig and then
exiting immediately is pretty much either "defconfig" or "oldconfig"
depending on context...

> It still needs some more work, which I would do, if you consider this
> for inclusion:
> - the output order in ".config" is undefined

I don't particularly care about that one.  As long as the symbols are
right...

> - it does not support oldconfig

A) defconfig is more or less oldconfig on an empty .config file, I think?

B) Are you familiar with my miniconfig trick?

  http://lwn.net/Articles/161086/
  http://landley.net/aboriginal/FAQ.html#dev_miniconfig

That basically acts like oldconfig except it defaults unknown
binary/tristate symbols to "n" (unless forced to another state by
dependencies on existing set symbols) instead of defaulting them to the
specified default value.

It's more of an issue for the kernel than it is for toybox, because I'm
not currently using most of the features of kconfig, but the other
projects using kconfig (busybox, uClibc, buildroot, etc) have wound up
needing this stuff, so presumably as the project scales it might come up.

> - it currently ignores depends

I'm starting to use dependency stuff, such as:

  http://landley.net/hg/toybox/rev/426

And the options to "cp" and such...

What you have so far is very interesting, and I need to learn more awk
to understand it...

Rob



More information about the Toybox mailing list