Kconfig - “select” a choice












2















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.



Given the following configuration:



mainmenu "Select/choice interaction test"

# Selectable menu granting access to multiple potentially independent config vars
menuconfig MULTICHOICE
bool "Multichoice"

config MULTICHOICE_A
bool "A"
depends on MULTICHOICE

config MULTICHOICE_B
bool "B"
depends on MULTICHOICE

config MULTICHOICE_C
bool "C"
depends on MULTICHOICE

# Choose exactly one item
choice CHOICE
prompt "Choice"

config CHOICE_A
bool "A"

config CHOICE_B
bool "B"

config CHOICE_C
bool "C"


endchoice

# Booleans which restrict/select other options from the previous sections

config SET_A
bool "Select A"
select CHOICE_A
select MULTICHOICE
select MULTICHOICE_A

config SET_B
bool "Select B"
select CHOICE_B
select MULTICHOICE
select MULTICHOICE_B

config SET_C
bool "Select C"
select CHOICE_C
select MULTICHOICE
select MULTICHOICE_C


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.



For example, open that configuration file above with nconfig/menuconfig/gconfig/xconfig then select exactly one of SET_A/SET_B/SET_C. The value of CHOICE does not change at all.



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?










share|improve this question


















  • 1





    Related to set string values: stackoverflow.com/questions/40309054/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Mar 4 '18 at 14:44
















2















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.



Given the following configuration:



mainmenu "Select/choice interaction test"

# Selectable menu granting access to multiple potentially independent config vars
menuconfig MULTICHOICE
bool "Multichoice"

config MULTICHOICE_A
bool "A"
depends on MULTICHOICE

config MULTICHOICE_B
bool "B"
depends on MULTICHOICE

config MULTICHOICE_C
bool "C"
depends on MULTICHOICE

# Choose exactly one item
choice CHOICE
prompt "Choice"

config CHOICE_A
bool "A"

config CHOICE_B
bool "B"

config CHOICE_C
bool "C"


endchoice

# Booleans which restrict/select other options from the previous sections

config SET_A
bool "Select A"
select CHOICE_A
select MULTICHOICE
select MULTICHOICE_A

config SET_B
bool "Select B"
select CHOICE_B
select MULTICHOICE
select MULTICHOICE_B

config SET_C
bool "Select C"
select CHOICE_C
select MULTICHOICE
select MULTICHOICE_C


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.



For example, open that configuration file above with nconfig/menuconfig/gconfig/xconfig then select exactly one of SET_A/SET_B/SET_C. The value of CHOICE does not change at all.



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?










share|improve this question


















  • 1





    Related to set string values: stackoverflow.com/questions/40309054/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Mar 4 '18 at 14:44














2












2








2








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.



Given the following configuration:



mainmenu "Select/choice interaction test"

# Selectable menu granting access to multiple potentially independent config vars
menuconfig MULTICHOICE
bool "Multichoice"

config MULTICHOICE_A
bool "A"
depends on MULTICHOICE

config MULTICHOICE_B
bool "B"
depends on MULTICHOICE

config MULTICHOICE_C
bool "C"
depends on MULTICHOICE

# Choose exactly one item
choice CHOICE
prompt "Choice"

config CHOICE_A
bool "A"

config CHOICE_B
bool "B"

config CHOICE_C
bool "C"


endchoice

# Booleans which restrict/select other options from the previous sections

config SET_A
bool "Select A"
select CHOICE_A
select MULTICHOICE
select MULTICHOICE_A

config SET_B
bool "Select B"
select CHOICE_B
select MULTICHOICE
select MULTICHOICE_B

config SET_C
bool "Select C"
select CHOICE_C
select MULTICHOICE
select MULTICHOICE_C


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.



For example, open that configuration file above with nconfig/menuconfig/gconfig/xconfig then select exactly one of SET_A/SET_B/SET_C. The value of CHOICE does not change at all.



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?










share|improve this question














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.



Given the following configuration:



mainmenu "Select/choice interaction test"

# Selectable menu granting access to multiple potentially independent config vars
menuconfig MULTICHOICE
bool "Multichoice"

config MULTICHOICE_A
bool "A"
depends on MULTICHOICE

config MULTICHOICE_B
bool "B"
depends on MULTICHOICE

config MULTICHOICE_C
bool "C"
depends on MULTICHOICE

# Choose exactly one item
choice CHOICE
prompt "Choice"

config CHOICE_A
bool "A"

config CHOICE_B
bool "B"

config CHOICE_C
bool "C"


endchoice

# Booleans which restrict/select other options from the previous sections

config SET_A
bool "Select A"
select CHOICE_A
select MULTICHOICE
select MULTICHOICE_A

config SET_B
bool "Select B"
select CHOICE_B
select MULTICHOICE
select MULTICHOICE_B

config SET_C
bool "Select C"
select CHOICE_C
select MULTICHOICE
select MULTICHOICE_C


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.



For example, open that configuration file above with nconfig/menuconfig/gconfig/xconfig then select exactly one of SET_A/SET_B/SET_C. The value of CHOICE does not change at all.



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?







configuration






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Oct 31 '17 at 15:40









Mark K CowanMark K Cowan

272111




272111








  • 1





    Related to set string values: stackoverflow.com/questions/40309054/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Mar 4 '18 at 14:44














  • 1





    Related to set string values: stackoverflow.com/questions/40309054/…

    – Ciro Santilli 新疆改造中心 六四事件 法轮功
    Mar 4 '18 at 14:44








1




1





Related to set string values: stackoverflow.com/questions/40309054/…

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Mar 4 '18 at 14:44





Related to set string values: stackoverflow.com/questions/40309054/…

– Ciro Santilli 新疆改造中心 六四事件 法轮功
Mar 4 '18 at 14:44










1 Answer
1






active

oldest

votes


















0














As I can't reply, Ciro Santilli is not exactly right.



To quote the answer from there:




It is not possible to use select for non booleans according to > kernel docs v4.15



https://github.com/torvalds/linux/blob/v4.15/Documentation/kbuild/kconfig-language.txt#L104 says:



- reverse dependencies: "select" <symbol> ["if" <expr>] 
[...]
Reverse dependencies can only be used with boolean or tristate symbols.



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.






share|improve this answer








New contributor




Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401665%2fkconfig-select-a-choice%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    As I can't reply, Ciro Santilli is not exactly right.



    To quote the answer from there:




    It is not possible to use select for non booleans according to > kernel docs v4.15



    https://github.com/torvalds/linux/blob/v4.15/Documentation/kbuild/kconfig-language.txt#L104 says:



    - reverse dependencies: "select" <symbol> ["if" <expr>] 
    [...]
    Reverse dependencies can only be used with boolean or tristate symbols.



    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.






    share|improve this answer








    New contributor




    Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.

























      0














      As I can't reply, Ciro Santilli is not exactly right.



      To quote the answer from there:




      It is not possible to use select for non booleans according to > kernel docs v4.15



      https://github.com/torvalds/linux/blob/v4.15/Documentation/kbuild/kconfig-language.txt#L104 says:



      - reverse dependencies: "select" <symbol> ["if" <expr>] 
      [...]
      Reverse dependencies can only be used with boolean or tristate symbols.



      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.






      share|improve this answer








      New contributor




      Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.























        0












        0








        0







        As I can't reply, Ciro Santilli is not exactly right.



        To quote the answer from there:




        It is not possible to use select for non booleans according to > kernel docs v4.15



        https://github.com/torvalds/linux/blob/v4.15/Documentation/kbuild/kconfig-language.txt#L104 says:



        - reverse dependencies: "select" <symbol> ["if" <expr>] 
        [...]
        Reverse dependencies can only be used with boolean or tristate symbols.



        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.






        share|improve this answer








        New contributor




        Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.










        As I can't reply, Ciro Santilli is not exactly right.



        To quote the answer from there:




        It is not possible to use select for non booleans according to > kernel docs v4.15



        https://github.com/torvalds/linux/blob/v4.15/Documentation/kbuild/kconfig-language.txt#L104 says:



        - reverse dependencies: "select" <symbol> ["if" <expr>] 
        [...]
        Reverse dependencies can only be used with boolean or tristate symbols.



        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.







        share|improve this answer








        New contributor




        Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered 13 mins ago









        Olliver SchinaglOlliver Schinagl

        11




        11




        New contributor




        Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Olliver Schinagl is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401665%2fkconfig-select-a-choice%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Histoire des bourses de valeurs

            Why is there Russian traffic in my log files?

            Rename multiple files to decrement number in file name?