linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux kernel conf 1.1
@ 2002-10-20 19:45 Roman Zippel
  0 siblings, 0 replies; only message in thread
From: Roman Zippel @ 2002-10-20 19:45 UTC (permalink / raw)
  To: linux-kernel, kbuild-devel

Hi,

At http://www.xs4all.nl/~zippel/lc/ you can find the latest version of
the new config system.
Smaller changes:
- update to 2.5.44
- new qconf option, which enables some debug output in the help window

The only big change this time is that I added a SWIG interface, which
allows to generate a extension library for your favourite script
language. I did this already for ruby, 'make ruby' builds the library
kconfig.so in the .ruby subdir.
I also included some examples, since they are short and fun, I included
them below.
The first example shows a working (but not very comfortable) miniconf:

-----
require "kconfig"
include Kconfig

conf_parse("arch/i386/Kconfig")
conf_read(nil)

def conf(menu)
        return unless menu.isVisible?
        prompt = menu.prompt
        if prompt.type == P_COMMENT || prompt.type == P_MENU
                print "* #{prompt.text}\n"
        end
        sym = menu.sym
        if sym
                begin
                        print "#{prompt.text} (#{sym.get_string})? "
                        unless sym.isChangable?
                                print "\n"
                                break
                        end
                        val = gets.strip
                end until val.empty? || sym.set_string(val)
        end
        menu.each do |child|
                conf(child)
        end
end

conf(Kconfig.rootmenu)

conf_write(nil)
-----

This is all you need to configure your kernel. :)
The second example prints information about a config option:

-----
require "kconfig"
include Kconfig

conf_parse("arch/i386/Kconfig")
conf_read(nil)

sym = Kconfig::Symbol.find(ARGV[0])
if !sym
        print "Symbol #{ARGV[0]} not found!\n"
        exit
end

sym.calc_value
print "symbol: #{sym.name}\n"
print "  type: #{Kconfig::Symbol.type_name(sym.type)}\n"
print "  value: #{sym.get_string}\n"
print "  choice\n" if sym.isChoice?
print "  choice value\n" if sym.isChoiceValue?
print "  properties:\n" if sym.prop
sym.each do |prop|
        case prop.type
        when P_PROMPT
                print "    prompt: #{prop.text}\n"
        when P_DEFAULT
                prop.def.calc_value
                print "    default: #{prop.def.get_string}\n"
        when P_CHOICE
                print "    choice reference\n"
        else
                print "    unknown property:
#{Property.type_name(prop.type)}\n"
        end
        print "      dep: #{prop.visible.expr}\n" if prop.visible.expr
end
-----

This gives you a basic idea about the internal structures of lkc.

bye, Roman

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-10-20 19:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-20 19:45 linux kernel conf 1.1 Roman Zippel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).