Why CONFIG_SHELL
Hi experts.
I think all the macros with CONFIG_ prefix are supposed to be defined in Kconfig.
But I've been long wondering why there exists one exception:CONFIG_SHELL.
Is there any historical, or special reason?
Is it good to rename it to KBUILD_SHELL or something else?
Best Regards
Masahiro Yamada
Quoted 8 lines · Masahiro Yamada
Hi experts.
I think all the macros with
CONFIG_prefix are supposed to be defined inKconfig.
But I've been long wondering why there exists one exception:CONFIG_SHELL.Is there any historical, or special reason?
It has been like this as far back as I remmeber.
I assume that one has planned to set the shell in Kconfig back then.
Quoted 1 line
Is it good to rename it to
KBUILD_SHELLor something else?
Please do so, to free up the CONFIG_ namespace.
I the end Michal will decide if he want this cleanup. On the top of my head I see no problems in doing this, but maybe there are some out-of-tree modules or similar we need to consider...
Sam
Hi Sam,
Quoted 12 lines · On Mon, 9 Jun 2014 09:49:35 +0200 Sam Ravnborg <[email protected]> wrote:
Quoted 8 lines · Masahiro Yamada
Hi experts.
I think all the macros with
CONFIG_prefix are supposed to be defined inKconfig.
But I've been long wondering why there exists one exception:CONFIG_SHELL.Is there any historical, or special reason?
It has been like this as far back as I remmeber.
I assume that one has planned to set the shell inKconfigback then.
Quoted 7 lines
Quoted 1 line
Is it good to rename it to
KBUILD_SHELLor something else?Please do so, to free up the
CONFIG_namespace.I the end Michal will decide if he want this cleanup. On the top of my head I see no problems in doing this, but maybe there are some out-of-tree modules or similar we need to consider...
Thanks for your commet.
Another question popped up.
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
If bash is not found on the system, CONFIG_SHELL falls back to "sh".
Does it mean, all shell scripts are written as sh-compatible ?
I guess bash is installed on the almost all system.
It is difficult to detect the problem even if some scripts don't work on sh.
If we allow bash-specific syntax in shell scripts, we should stop the build immedately if bash is missing, like this?
KBUILD_SHELL := /bin/bash
if [ ! -x "$$BASH" ]; then
$(error $KBUILD_SHELL not found)
fi
Best Regards
Masahiro Yamada
Quoted 31 lines · Masahiro Yamada
Hi Sam,
Quoted 12 lines · On Mon, 9 Jun 2014 09:49:35 +0200 Sam Ravnborg <[email protected]> wrote:
Quoted 8 lines · Masahiro Yamada
Hi experts.
I think all the macros with
CONFIG_prefix are supposed to be defined inKconfig.
But I've been long wondering why there exists one exception:CONFIG_SHELL.Is there any historical, or special reason?
It has been like this as far back as I remmeber.
I assume that one has planned to set the shell inKconfigback then.Quoted 7 lines
Quoted 1 line
Is it good to rename it to
KBUILD_SHELLor something else?Please do so, to free up the
CONFIG_namespace.I the end Michal will decide if he want this cleanup. On the top of my head I see no problems in doing this, but maybe there are some out-of-tree modules or similar we need to consider...
Thanks for your commet.
Another question popped up.
Quoted 8 lines
CONFIG_SHELL:= $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x/bin/bash]; then echo/bin/bash; \
else echo sh; fi ; fi)If bash is not found on the system,
CONFIG_SHELLfalls back to "sh".Does it mean, all shell scripts are written as sh-compatible ?
Not all - but most.
All shell scripts that are invoked with $(CONFIG_SHELL) must be sh-compatible, or in practice dash compatible as well as bash compatible.
The preference is bash as expressed with the above code.
Sam