Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) Kconfig macro language
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) ======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) Concept
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) The basic idea was inspired by Make. When we look at Make, we notice sort of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) two languages in one. One language describes dependency graphs consisting of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) targets and prerequisites. The other is a macro language for performing textual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) substitution.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) There is clear distinction between the two language stages. For example, you
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) can write a makefile like follows::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)     APP := foo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)     SRC := foo.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)     CC := gcc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)     $(APP): $(SRC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)             $(CC) -o $(APP) $(SRC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) The macro language replaces the variable references with their expanded form,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) and handles as if the source file were input like follows::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)     foo: foo.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)             gcc -o foo foo.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) Then, Make analyzes the dependency graph and determines the targets to be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) The idea is quite similar in Kconfig - it is possible to describe a Kconfig
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) file like this::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)     CC := gcc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)     config CC_HAS_FOO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)             def_bool $(shell, $(srctree)/scripts/gcc-check-foo.sh $(CC))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) The macro language in Kconfig processes the source file into the following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) intermediate::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)     config CC_HAS_FOO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)             def_bool y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) Then, Kconfig moves onto the evaluation stage to resolve inter-symbol
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) dependency as explained in kconfig-language.rst.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) Variables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) ---------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) Like in Make, a variable in Kconfig works as a macro variable.  A macro
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) variable is expanded "in place" to yield a text string that may then be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) expanded further. To get the value of a variable, enclose the variable name in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) $( ). The parentheses are required even for single-letter variable names; $X is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) a syntax error. The curly brace form as in ${CC} is not supported either.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) There are two types of variables: simply expanded variables and recursively
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) expanded variables.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) A simply expanded variable is defined using the := assignment operator. Its
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) righthand side is expanded immediately upon reading the line from the Kconfig
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) A recursively expanded variable is defined using the = assignment operator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) Its righthand side is simply stored as the value of the variable without
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) expanding it in any way. Instead, the expansion is performed when the variable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) There is another type of assignment operator; += is used to append text to a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) variable. The righthand side of += is expanded immediately if the lefthand
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) side was originally defined as a simple variable. Otherwise, its evaluation is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) deferred.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) The variable reference can take parameters, in the following form::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78)   $(name,arg1,arg2,arg3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) You can consider the parameterized reference as a function. (more precisely,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) "user-defined function" in contrast to "built-in function" listed below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) Useful functions must be expanded when they are used since the same function is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) expanded differently if different parameters are passed. Hence, a user-defined
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) function is defined using the = assignment operator. The parameters are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) referenced within the body definition with $(1), $(2), etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) In fact, recursively expanded variables and user-defined functions are the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) internally. (In other words, "variable" is "function with zero argument".)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) When we say "variable" in a broad sense, it includes "user-defined function".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) Built-in functions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) ------------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) Like Make, Kconfig provides several built-in functions. Every function takes a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) particular number of arguments.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) In Make, every built-in function takes at least one argument. Kconfig allows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) zero argument for built-in functions, such as $(fileno), $(lineno). You could
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) consider those as "built-in variable", but it is just a matter of how we call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) it after all. Let's say "built-in function" here to refer to natively supported
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) functionality.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) Kconfig currently supports the following built-in functions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  - $(shell,command)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)   The "shell" function accepts a single argument that is expanded and passed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)   to a subshell for execution. The standard output of the command is then read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)   and returned as the value of the function. Every newline in the output is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)   replaced with a space. Any trailing newlines are deleted. The standard error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)   is not returned, nor is any program exit status.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  - $(info,text)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)   The "info" function takes a single argument and prints it to stdout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)   It evaluates to an empty string.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)  - $(warning-if,condition,text)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)   The "warning-if" function takes two arguments. If the condition part is "y",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)   the text part is sent to stderr. The text is prefixed with the name of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)   current Kconfig file and the current line number.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  - $(error-if,condition,text)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)   The "error-if" function is similar to "warning-if", but it terminates the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)   parsing immediately if the condition part is "y".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)  - $(filename)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)   The 'filename' takes no argument, and $(filename) is expanded to the file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)   name being parsed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  - $(lineno)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)   The 'lineno' takes no argument, and $(lineno) is expanded to the line number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)   being parsed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) Make vs Kconfig
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) ---------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) Kconfig adopts Make-like macro language, but the function call syntax is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) slightly different.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) A function call in Make looks like this::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)   $(func-name arg1,arg2,arg3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) The function name and the first argument are separated by at least one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) whitespace. Then, leading whitespaces are trimmed from the first argument,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) while whitespaces in the other arguments are kept. You need to use a kind of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) trick to start the first parameter with spaces. For example, if you want
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) to make "info" function print "  hello", you can write like follows::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)   empty :=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)   space := $(empty) $(empty)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)   $(info $(space)$(space)hello)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) Kconfig uses only commas for delimiters, and keeps all whitespaces in the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) function call. Some people prefer putting a space after each comma delimiter::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)   $(func-name, arg1, arg2, arg3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) In this case, "func-name" will receive " arg1", " arg2", " arg3". The presence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) of leading spaces may matter depending on the function. The same applies to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) Make - for example, $(subst .c, .o, $(sources)) is a typical mistake; it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) replaces ".c" with " .o".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) In Make, a user-defined function is referenced by using a built-in function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 'call', like this::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)     $(call my-func,arg1,arg2,arg3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) Kconfig invokes user-defined functions and built-in functions in the same way.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) The omission of 'call' makes the syntax shorter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) In Make, some functions treat commas verbatim instead of argument separators.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) For example, $(shell echo hello, world) runs the command "echo hello, world".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) Likewise, $(info hello, world) prints "hello, world" to stdout. You could say
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) this is _useful_ inconsistency.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) In Kconfig, for simpler implementation and grammatical consistency, commas that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) appear in the $( ) context are always delimiters. It means::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)   $(shell, echo hello, world)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) is an error because it is passing two parameters where the 'shell' function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) accepts only one. To pass commas in arguments, you can use the following trick::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)   comma := ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)   $(shell, echo hello$(comma) world)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) Caveats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) A variable (or function) cannot be expanded across tokens. So, you cannot use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) a variable as a shorthand for an expression that consists of multiple tokens.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) The following works::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)     RANGE_MIN := 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)     RANGE_MAX := 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)     config FOO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)             int "foo"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)             range $(RANGE_MIN) $(RANGE_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) But, the following does not work::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)     RANGES := 1 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)     config FOO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)             int "foo"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)             range $(RANGES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) A variable cannot be expanded to any keyword in Kconfig.  The following does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) not work::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)     MY_TYPE := tristate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)     config FOO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)             $(MY_TYPE) "foo"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)             default y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) Obviously from the design, $(shell command) is expanded in the textual
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) substitution phase. You cannot pass symbols to the 'shell' function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) The following does not work as expected::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)     config ENDIAN_FLAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234)             string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)             default "-mbig-endian" if CPU_BIG_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)             default "-mlittle-endian" if CPU_LITTLE_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238)     config CC_HAS_ENDIAN_FLAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)             def_bool $(shell $(srctree)/scripts/gcc-check-flag ENDIAN_FLAG)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) Instead, you can do like follows so that any function call is statically
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) expanded::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)     config CC_HAS_ENDIAN_FLAG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)             bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)             default $(shell $(srctree)/scripts/gcc-check-flag -mbig-endian) if CPU_BIG_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)             default $(shell $(srctree)/scripts/gcc-check-flag -mlittle-endian) if CPU_LITTLE_ENDIAN