1 # Simple Kconfig recursive issue 1 # Simple Kconfig recursive issue 2 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3 # 3 # 4 # Test with: 4 # Test with: 5 # 5 # 6 # make KBUILD_KCONFIG=Documentation/kbuild/Kco 6 # make KBUILD_KCONFIG=Documentation/kbuild/Kconfig.recursion-issue-01 allnoconfig 7 # 7 # 8 # This Kconfig file has a simple recursive dep 8 # This Kconfig file has a simple recursive dependency issue. In order to 9 # understand why this recursive dependency iss 9 # understand why this recursive dependency issue occurs lets consider what 10 # Kconfig needs to address. We iterate over wh 10 # Kconfig needs to address. We iterate over what Kconfig needs to address 11 # by stepping through the questions it needs t 11 # by stepping through the questions it needs to address sequentially. 12 # 12 # 13 # * What values are possible for CORE? 13 # * What values are possible for CORE? 14 # 14 # 15 # CORE_BELL_A_ADVANCED selects CORE, which mea 15 # CORE_BELL_A_ADVANCED selects CORE, which means that it influences the values 16 # that are possible for CORE. So for example i 16 # that are possible for CORE. So for example if CORE_BELL_A_ADVANCED is 'y', 17 # CORE must be 'y' too. 17 # CORE must be 'y' too. 18 # 18 # 19 # * What influences CORE_BELL_A_ADVANCED? 19 # * What influences CORE_BELL_A_ADVANCED? 20 # 20 # 21 # As the name implies CORE_BELL_A_ADVANCED is 21 # As the name implies CORE_BELL_A_ADVANCED is an advanced feature of 22 # CORE_BELL_A so naturally it depends on CORE_ 22 # CORE_BELL_A so naturally it depends on CORE_BELL_A. So if CORE_BELL_A is 'y' 23 # we know CORE_BELL_A_ADVANCED can be 'y' too. 23 # we know CORE_BELL_A_ADVANCED can be 'y' too. 24 # 24 # 25 # * What influences CORE_BELL_A? 25 # * What influences CORE_BELL_A? 26 # 26 # 27 # CORE_BELL_A depends on CORE, so CORE influen 27 # CORE_BELL_A depends on CORE, so CORE influences CORE_BELL_A. 28 # 28 # 29 # But that is a problem, because this means th 29 # But that is a problem, because this means that in order to determine 30 # what values are possible for CORE we ended u 30 # what values are possible for CORE we ended up needing to address questions 31 # regarding possible values of CORE itself aga 31 # regarding possible values of CORE itself again. Answering the original 32 # question of what are the possible values of 32 # question of what are the possible values of CORE would make the kconfig 33 # tools run in a loop. When this happens Kconf 33 # tools run in a loop. When this happens Kconfig exits and complains about 34 # the "recursive dependency detected" error. 34 # the "recursive dependency detected" error. 35 # 35 # 36 # Reading the Documentation/kbuild/Kconfig.rec 36 # Reading the Documentation/kbuild/Kconfig.recursion-issue-01 file it may be 37 # obvious that an easy solution to this proble 37 # obvious that an easy solution to this problem should just be the removal 38 # of the "select CORE" from CORE_BELL_A_ADVANC 38 # of the "select CORE" from CORE_BELL_A_ADVANCED as that is implicit already 39 # since CORE_BELL_A depends on CORE. Recursive 39 # since CORE_BELL_A depends on CORE. Recursive dependency issues are not always 40 # so trivial to resolve, we provide another ex 40 # so trivial to resolve, we provide another example below of practical 41 # implications of this recursive issue where t 41 # implications of this recursive issue where the solution is perhaps not so 42 # easy to understand. Note that matching seman 42 # easy to understand. Note that matching semantics on the dependency on 43 # CORE also consist of a solution to this recu 43 # CORE also consist of a solution to this recursive problem. 44 44 45 mainmenu "Simple example to demo kconfig recur 45 mainmenu "Simple example to demo kconfig recursive dependency issue" 46 46 47 config CORE 47 config CORE 48 tristate 48 tristate 49 49 50 config CORE_BELL_A 50 config CORE_BELL_A 51 tristate 51 tristate 52 depends on CORE 52 depends on CORE 53 53 54 config CORE_BELL_A_ADVANCED 54 config CORE_BELL_A_ADVANCED 55 tristate 55 tristate 56 depends on CORE_BELL_A 56 depends on CORE_BELL_A 57 select CORE 57 select CORE
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.