Site Overlay

Kconfig depends on

The configuration database is a collection of configuration options organized in a tree structure:. Every entry has its own dependencies. These dependencies are used to determine the visibility of an entry. Any child entry is only visible if its parent entry is also visible. Most entries define a config option; all other entries help to organize them.

A single configuration option is defined like this:. Every line starts with a key word and can be followed by multiple arguments. The following lines define attributes for this config option. Attributes can be the type of the config option, input prompt, dependencies, help text and default values. A config option can be defined multiple times with the same name, but every definition can have only a single input prompt and the type must not conflict.

A menu entry can have a number of attributes. Not all of them are applicable everywhere see syntax. Every config option must have a type. There are only two basic types: tristate and string; the other types are based on these two.

The type definition optionally accepts an input prompt, so these two examples are equivalent:. Every menu entry can have at most one prompt, which is used to display to the user. A config option can have any number of default values. If multiple default values are visible, only the first defined one is active. Default values are not limited to the menu entry where they are defined. This means the default can be defined somewhere else or be overridden by an earlier definition.

The default value is only assigned to the config symbol if no other value was set by the user via the input prompt above. If an input prompt is visible the default value is presented to the user and can be overridden by him. With few exceptions, new config options should not change this. This is a shorthand notation for a type definition plus a value. This defines a dependency for this menu entry. While normal dependencies reduce the upper limit of a symbol see belowreverse dependencies can be used to force a lower limit of another symbol.

Reverse dependencies can only be used with boolean or tristate symbols. In general use select only for non-visible symbols no prompts anywhere and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.

This is useful e. This attribute is only applicable to menu blocks, if the condition is false, the menu block is not displayed to the user the symbols contained there can still be selected by other symbols, though.

This allows to limit the range of possible input values for int and hex symbols. The user can only input a value which is larger than or equal to the first symbol and smaller than or equal to the second symbol.Jump to navigation. As supporting infrastructure, however, it is seldom in the spotlight; even kernel developers who use it in their daily work never really think about it.

The first step in building a kernel is always configuration.

Teorico de manejo caba

Kconfig helps make the Linux kernel highly modular and customizable. Kconfig offers the user many config targets:. I think menuconfig is the most popular of these targets. The targets are processed by different host programs, which are provided by the kernel and built during kernel building.

Some targets have a GUI for the user's convenience while most don't. Except for confeach of them is responsible for one of the GUI-based config targets, so, conf deals with most of them. Logically, Kconfig's infrastructure has two parts: one implements a new language to define the configuration items see the Kconfig files under the kernel sourceand the other parses the Kconfig language and deals with configuration actions.

The Linux Terminal Top 7 terminal emulators for Linux 10 command-line tools for data analysis in Linux Download Now: SSH cheat sheet Advanced Linux commands cheat sheet Linux command line tutorials Note that all configuration items have a default value. The first step reads the Kconfig file under source root to construct an initial configuration database; then it updates the initial database by reading an existing configuration file according to this priority:.

If you are doing GUI-based configuration via menuconfig or command-line-based configuration via oldconfigthe database is updated according to your customization. Finally, the configuration database is dumped into the. But the. Also, because it is for internal use not for usersit was dropped from the list. Component-wise building, called recursive makeis a common way for GNU make to manage a large project.

Kbuild is a good example of recursive make. When you start building, a top makefile invokes each component's makefile in the proper order, builds the components, and collects them into the final executive. The top makefile includes the arch makefile, reads the.It only takes a minute to sign up. What are the differences in dependencies between select and depends on in the kernels Kconfig files? For example. A successful build of AppB depends on a statically linked LibB to be built first.

Setting select LibB will. For things like make menuconfigthis determines whether or not an option will be presented. This fulfills a potential dependency of some other config option s. Since there is only one possible dependency, select just selects that option automatically, and saves you the work of explicitly picking the dependency manually first. This automation is what you gain from the subset restriction of having only one possible dependency. Sometimes I wish I could say: "if none of the dependencies is met, select this one by default" though, that would allow to further automate stuff.

There are also "something hides another option on menuconfig" effects, but these are just fluff Sign up to join this community. The best answers are voted up and rise to the top. Ask Question. Asked 6 years, 11 months ago. Active 2 years, 10 months ago.

Movil para cuna el corte ingles

Viewed 18k times. Update I've noticed that depend on doesn't really do much in terms of compilation order. Improve this question. TheMeaningfulEngineer TheMeaningfulEngineer 4, 10 10 gold badges 57 57 silver badges 95 95 bronze badges. Add a comment. Active Oldest Votes.

Improve this answer. I like to think about is as: select is a "subset" of dependsfor when there is only one possible dependency for a feature. For example, on 4. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown.This page covers some Kconfig best practices and explains some Kconfig behaviors and features that might be cryptic or that are easily overlooked.

The official Kconfig documentation is kconfig-language. If a symbol has a prompt e. Therefore, only put a prompt on a symbol if it makes sense for the user to change its value. In Zephyr, Kconfig configuration is done after selecting a machine, so in general, it does not make sense to put a prompt on a symbol that corresponds to a fixed machine-specific setting. Usually, such settings should be handled via device tree. If some derived setting is easier to calculate in Kconfig than e. See the optional prompts section for a way to deal with settings that are fixed on some machines and configurable on other machines.

The select statement is used to force one symbol to y whenever another symbol is y. This section covers some pitfalls and good uses for select.

Subscribe to RSS

More insidious cases with dependencies inherited from if and menu statements are common. An alternative attempt to solve the issue might be to turn the depends on into another select :. In general, whenever the dependencies of a symbol are updated, the dependencies of all symbols that directly or indirectly select it have to be updated as well.

This is very often overlooked in practice, even for the simplest case above. Chains of symbols selecting each other should be avoided in particular, except for simple helper symbols, as covered below in Using select for helper symbols.

Liberal use of select also tends to make Kconfig files harder to read, both due to the extra dependencies and due to the non-local nature of selectwhich hides ways in which a symbol might get enabled. For the example in the previous section, a better solution is usually to turn the select into a depends on :. This makes it impossible to generate an invalid configuration, and means that dependencies only ever have to be updated in a single spot.

Such helper symbols should preferably have no prompt or dependencies. This makes it possible for other symbols to check for FPU support in a generic way, without having to look for particular architectures:. The alternative would be to have dependencies like the following, possibly duplicated in several spots:. Invisible helper symbols can also be useful without select. In summary, here are some recommended practices for select :. Avoid selecting symbols with prompts or dependencies.

Prefer depends on. If depends on causes annoying bloat in configuration files, consider adding a Kconfig default for the most common value. Common sense applies, but be aware that select often causes issues in practice. Select simple helper symbols without prompts and dependencies however much you like.

A common misunderstanding related to if is to think that the following code conditionally includes the file Kconfig. In reality, there are no conditional includes in Kconfig. Say that Kconfig. In this case, FOO will end up with this definition:. In general, try to avoid adding redundant dependencies.This page covers some Kconfig best practices and explains some Kconfig behaviors and features that might be cryptic or that are easily overlooked.

The official Kconfig documentation is kconfig-language. If a symbol has a prompt e. Therefore, only put a prompt on a symbol if it makes sense for the user to change its value.

Hack weather station

In Zephyr, Kconfig configuration is done after selecting a machine, so in general, it does not make sense to put a prompt on a symbol that corresponds to a fixed machine-specific setting.

Usually, such settings should be handled via device tree. If some derived setting is easier to calculate in Kconfig than e. See the optional prompts section for a way to deal with settings that are fixed on some machines and configurable on other machines. The select statement is used to force one symbol to y whenever another symbol is y.

kconfig depends on

This section covers some pitfalls and good uses for select. More insidious cases with dependencies inherited from if and menu statements are common. An alternative attempt to solve the issue might be to turn the depends on into another select :. In general, whenever the dependencies of a symbol are updated, the dependencies of all symbols that directly or indirectly select it have to be updated as well. This is very often overlooked in practice, even for the simplest case above. Chains of symbols selecting each other should be avoided in particular, except for simple helper symbols, as covered below in Using select for helper symbols.

Liberal use of select also tends to make Kconfig files harder to read, both due to the extra dependencies and due to the non-local nature of selectwhich hides ways in which a symbol might get enabled. For the example in the previous section, a better solution is usually to turn the select into a depends on :.

This makes it impossible to generate an invalid configuration, and means that dependencies only ever have to be updated in a single spot. Such helper symbols should preferably have no prompt or dependencies. This makes it possible for other symbols to check for FPU support in a generic way, without having to look for particular architectures:.

The alternative would be to have dependencies like the following, possibly duplicated in several spots:. Invisible helper symbols can also be useful without select. In summary, here are some recommended practices for select :. Avoid selecting symbols with prompts or dependencies.

Prefer depends on. If depends on causes annoying bloat in configuration files, consider adding a Kconfig default for the most common value. Common sense applies, but be aware that select often causes issues in practice. Select simple helper symbols without prompts and dependencies however much you like. A common misunderstanding related to if is to think that the following code conditionally includes the file Kconfig.It only takes a minute to sign up.

kconfig depends on

I'm using the Linux kernel's configuration tool Kconfig to manage the configuration of my own project. Please could someone with sufficient rep add "Kconfig" tag or whatever tag would be more appropriate. I didn't tag as "linux" or as "kernel" since my actual project is not the Linux kernel. Selecting items in a menuconfig works as expected. But setting the value of the choice does not work. I can understand a potential problem conflict here - what if multiple options from the choice were selected implicitly by other configuration variables?

But in the sane case of only one choice option being implicitly selected by others, the value of the choice does not change. Is there some other way of ensuring that only one option from a set is selected, but also forcing it to a certain value if other configuration variables are set a particular way?

However this question is actually about booleans, so in that light, should be possible. Sadly, I found this question as I was looking for the answer as well. Sign up to join this community.

Exploring the Linux kernel: The secrets of Kconfig/kbuild

The best answers are voted up and rise to the top. Asked 3 years, 3 months ago. Active 2 years ago. Viewed 5k times. Improve this question. Related to set string values: stackoverflow. Add a comment. Active Oldest Votes. As I can't reply, Ciro Santilli is not exactly right.

How to non-interactively configure the Linux kernel build? (3 Solutions!!)

Improve this answer.The configuration database is a collection of configuration options organized in a tree structure:. Every entry has its own dependencies. These dependencies are used to determine the visibility of an entry.

Any child entry is only visible if its parent entry is also visible. Most entries define a config option; all other entries help to organize them. A single configuration option is defined like this:. Every line starts with a key word and can be followed by multiple arguments. The following lines define attributes for this config option. Attributes can be the type of the config option, input prompt, dependencies, help text and default values.

A config option can be defined multiple times with the same name, but every definition can have only a single input prompt and the type must not conflict. A menu entry can have a number of attributes. Not all of them are applicable everywhere see syntax. Every config option must have a type.

There are only two basic types: tristate and string; the other types are based on these two. The type definition optionally accepts an input prompt, so these two examples are equivalent:. Every menu entry can have at most one prompt, which is used to display to the user. Optionally dependencies only for this prompt can be added with "if". A config option can have any number of default values.

kconfig depends on

If multiple default values are visible, only the first defined one is active. Default values are not limited to the menu entry where they are defined. This means the default can be defined somewhere else or be overridden by an earlier definition.

Strap lock para guitarra

The default value is only assigned to the config symbol if no other value was set by the user via the input prompt above.

If an input prompt is visible the default value is presented to the user and can be overridden by him. Optionally, dependencies only for this default value can be added with "if". The default value deliberately defaults to 'n' in order to avoid bloating the build. With few exceptions, new config options should not change this.


thoughts on “Kconfig depends on

Leave a Reply

Your email address will not be published. Required fields are marked *