Page 1 of 1

menuconfig for hobby kernel

Posted: Sat Oct 24, 2015 5:23 pm
by arseniuss
Hi, everyone!

I stepped into a problem when I wanted to test different configurations of my toy kernel. I got too much configuration definitions. And script which now have some hundred lines wouldn't handle that in a long time.

Linux kernel allows to use different kinds of configuration programs as menuconfig, gconfig etc.

I want to ask do you know any good configuration tool which would be easy to port assuming that I'm not implementing Unix-like terminals, ncurses and unneeded staff like that. menuconfig could be good but I wanted to ask about any more interesting options.

I consider writing my own and sharing with you if available options is not enough portable and depends too much on existing staff.

Re: menuconfig for hobby kernel

Posted: Sun Oct 25, 2015 6:38 am
by jnc100
The way the graphical configurators for Linux work is that they generate a human-readable (and editable) configuration file based upon your settings. This is then used by the build tools to set defines and build the appropriate parts of the kernel.

As you noted, the graphical bits tend to require significant UI library support to produce. As such, you may want to first consider defining the configuration file format and having your build system parse it properly. Then, at the very least, you can say to the user "edit config.txt to suit your needs", or provide multiple pre-made scripts for different configurations, and then, at your leisure, produce the graphical tools later depending upon whatever UI library you eventually port to your OS (I'm presuming here you're aiming to be self hosting). It should not, for example, be too difficult to write a command line utility which takes as input a file containing questions and outputs a configuration file based upon the answers.

I use a similar system using my own customised build system: if certain variables are not defined before the build script is run, then they are asked in the script, otherwise the pre-defined values are used. This allows me to do something like 'tymake menuconfig.tmk config_script.tmk build.tmk', where the build system first runs menuconfig.tmk which is a (as yet undesigned) graphical interface which produces config_script.tmk, which is then simply a set of variable definitions (e.g. TARGET="x86_64"; CC="x86_64-elf-gcc";). This is then executed. Finally build.tmk is run, which checks the existence of the various variables and if not present either prompts for them or uses defaults (depending on the particular option).

Regards,
John.