diff mbox series

[RFC,v8,09/23] cli: Add menu for hush parser

Message ID 20230512200331.51457-10-francis.laniel@amarulasolutions.com
State RFC
Delegated to: Tom Rini
Headers show
Series Modernize U-Boot shell | expand

Commit Message

Francis Laniel May 12, 2023, 8:03 p.m. UTC
For the moment, the menu contains only entry: HUSH_OLD_PARSER which is the
default.
The goal is to prepare the field to add a new hush parser which guarantees
actual behavior is still correct.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
---
 cmd/Kconfig     | 13 +++++++++++++
 common/Makefile |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

Comments

Heinrich Schuchardt May 13, 2023, 1:03 a.m. UTC | #1
On 5/12/23 22:03, Francis Laniel wrote:
> For the moment, the menu contains only entry: HUSH_OLD_PARSER which is the
> default.
> The goal is to prepare the field to add a new hush parser which guarantees
> actual behavior is still correct.
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
> ---
>   cmd/Kconfig     | 13 +++++++++++++
>   common/Makefile |  2 +-
>   2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 87291e2d84..2c50c9f7b5 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -23,6 +23,19 @@ config HUSH_PARSER
>   	  If disabled, you get the old, much simpler behaviour with a somewhat
>   	  smaller memory footprint.
>
> +menu "Hush flavor to use"
> +	depends on HUSH_PARSER
> +
> +	config HUSH_OLD_PARSER

If there will be alternative parsers in future, you should use
choice/endchoice even if there is only one option today.

Best regards

Heinrich

> +		bool "Use hush old parser"
> +		default y
> +		help
> +		  This option enables the old flavor of hush based on hush Busybox from
> +		  2005.
> +
> +		  It is actually the default U-Boot shell when decided to use hush as shell.
> +endmenu
> +
>   config CMDLINE_EDITING
>   	bool "Enable command line editing"
>   	depends on CMDLINE
> diff --git a/common/Makefile b/common/Makefile
> index c87bb2e78b..93d0a5a309 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -8,7 +8,7 @@ ifndef CONFIG_SPL_BUILD
>   obj-y += init/
>   obj-y += main.o
>   obj-y += exports.o
> -obj-$(CONFIG_HUSH_PARSER) += cli_hush.o
> +obj-$(CONFIG_HUSH_OLD_PARSER) += cli_hush.o
>   obj-$(CONFIG_AUTOBOOT) += autoboot.o
>
>   # # boards
Francis Laniel May 13, 2023, 8:32 p.m. UTC | #2
Le samedi 13 mai 2023, 02:03:11 WEST Heinrich Schuchardt a écrit :
> On 5/12/23 22:03, Francis Laniel wrote:
> > For the moment, the menu contains only entry: HUSH_OLD_PARSER which is the
> > default.
> > The goal is to prepare the field to add a new hush parser which guarantees
> > actual behavior is still correct.
> > 
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> > Signed-off-by: Francis Laniel <francis.laniel@amarulasolutions.com>
> > ---
> > 
> >   cmd/Kconfig     | 13 +++++++++++++
> >   common/Makefile |  2 +-
> >   2 files changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/cmd/Kconfig b/cmd/Kconfig
> > index 87291e2d84..2c50c9f7b5 100644
> > --- a/cmd/Kconfig
> > +++ b/cmd/Kconfig
> > @@ -23,6 +23,19 @@ config HUSH_PARSER
> > 
> >   	  If disabled, you get the old, much simpler behaviour with a 
somewhat
> >   	  smaller memory footprint.
> > 
> > +menu "Hush flavor to use"
> > +	depends on HUSH_PARSER
> > +
> > +	config HUSH_OLD_PARSER
> 
> If there will be alternative parsers in future, you should use
> choice/endchoice even if there is only one option today.

In a previous version of this contribution, I used choice.
But we then decided to use different Kconfig to permit having several parser 
living at the same time.
For the reasoning behind this, please take a look at my other mail.

> Best regards
> 
> Heinrich
> 
> > +		bool "Use hush old parser"
> > +		default y
> > +		help
> > +		  This option enables the old flavor of hush based on hush 
Busybox from
> > +		  2005.
> > +
> > +		  It is actually the default U-Boot shell when decided to use 
hush as
> > shell. +endmenu
> > +
> > 
> >   config CMDLINE_EDITING
> >   
> >   	bool "Enable command line editing"
> >   	depends on CMDLINE
> > 
> > diff --git a/common/Makefile b/common/Makefile
> > index c87bb2e78b..93d0a5a309 100644
> > --- a/common/Makefile
> > +++ b/common/Makefile
> > @@ -8,7 +8,7 @@ ifndef CONFIG_SPL_BUILD
> > 
> >   obj-y += init/
> >   obj-y += main.o
> >   obj-y += exports.o
> > 
> > -obj-$(CONFIG_HUSH_PARSER) += cli_hush.o
> > +obj-$(CONFIG_HUSH_OLD_PARSER) += cli_hush.o
> > 
> >   obj-$(CONFIG_AUTOBOOT) += autoboot.o
> >   
> >   # # boards
diff mbox series

Patch

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 87291e2d84..2c50c9f7b5 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -23,6 +23,19 @@  config HUSH_PARSER
 	  If disabled, you get the old, much simpler behaviour with a somewhat
 	  smaller memory footprint.
 
+menu "Hush flavor to use"
+	depends on HUSH_PARSER
+
+	config HUSH_OLD_PARSER
+		bool "Use hush old parser"
+		default y
+		help
+		  This option enables the old flavor of hush based on hush Busybox from
+		  2005.
+
+		  It is actually the default U-Boot shell when decided to use hush as shell.
+endmenu
+
 config CMDLINE_EDITING
 	bool "Enable command line editing"
 	depends on CMDLINE
diff --git a/common/Makefile b/common/Makefile
index c87bb2e78b..93d0a5a309 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -8,7 +8,7 @@  ifndef CONFIG_SPL_BUILD
 obj-y += init/
 obj-y += main.o
 obj-y += exports.o
-obj-$(CONFIG_HUSH_PARSER) += cli_hush.o
+obj-$(CONFIG_HUSH_OLD_PARSER) += cli_hush.o
 obj-$(CONFIG_AUTOBOOT) += autoboot.o
 
 # # boards