mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v1] defaultenv-2: make abort key to stop autoboot configurable
@ 2018-06-05  6:12 Oleksij Rempel
  2018-06-05 13:07 ` Sam Ravnborg
  0 siblings, 1 reply; 3+ messages in thread
From: Oleksij Rempel @ 2018-06-05  6:12 UTC (permalink / raw)
  To: barebox; +Cc: Oleksij Rempel

currently supported only two options: any key and ctrl-c
"any kay" is default option.
To configure it, use:
nv autoboot_abort_key=any
or
nv autoboot_abort_key=ctrl-c

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 Documentation/user/defaultenv-2.rst   |  3 +++
 defaultenv/defaultenv-2-base/bin/init | 17 ++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/Documentation/user/defaultenv-2.rst b/Documentation/user/defaultenv-2.rst
index db74176b0..7502d3de1 100644
--- a/Documentation/user/defaultenv-2.rst
+++ b/Documentation/user/defaultenv-2.rst
@@ -93,6 +93,9 @@ the :ref:`command_edit` command. Typical content:
   # timeout in seconds before the default boot entry is started
   #global.autoboot_timeout=3
 
+  # key to abort autoboot. Supported options are: "any" and "ctrl-c"
+  #global.autoboot_abort_key=any
+
   # list of boot entries. These are executed in order until one
   # succeeds. An entry can be:
   # - a filename in /env/boot/
diff --git a/defaultenv/defaultenv-2-base/bin/init b/defaultenv/defaultenv-2-base/bin/init
index 6f3a34dba..d75f8e08a 100644
--- a/defaultenv/defaultenv-2-base/bin/init
+++ b/defaultenv/defaultenv-2-base/bin/init
@@ -5,6 +5,7 @@ export PATH=/env/bin
 global hostname
 global user
 global autoboot_timeout
+global autoboot_abort_key
 global boot.default
 global linux.bootargs.base
 global linux.bootargs.console
@@ -18,6 +19,8 @@ global editcmd
 magicvar -a global.user "username (used in network filenames)"
 [ -z "${global.autoboot_timeout}" ] && global.autoboot_timeout=3
 magicvar -a global.autoboot_timeout "timeout in seconds before automatic booting"
+[ -z "${global.autoboot_abort_key}" ] && global.autoboot_abort_key=any
+magicvar -a global.autoboot_abort_key "key to abort automatic booting"
 [ -z "${global.boot.default}" ] && global.boot.default=net
 [ -z "${global.editcmd}" ] && global.editcmd=sedit
 
@@ -38,14 +41,22 @@ for i in /env/init/*; do
 	. $i
 done
 
+if [ "${global.autoboot_abort_key}" = "ctrl-c" ]; then
+	abort_string="ctrl-c"
+	abort_args="-c"
+else
+	abort_string="any key"
+	abort_args="-a"
+fi
+
 if [ -e /env/menu ]; then
-	echo -e -n "\nHit m for menu or any other key to stop autoboot: "
+	echo -e -n "\nHit m for menu or $abort_string to stop autoboot: "
 else
-	echo -e -n "\nHit any key to stop autoboot: "
+	echo -e -n "\nHit $abort_string to stop autoboot: "
 fi
 
 if [ "$autoboot" = 0 ]; then
-	timeout -a $global.autoboot_timeout -v key
+	timeout $abort_args $global.autoboot_timeout -v key
 	autoboot="$?"
 fi
 
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] defaultenv-2: make abort key to stop autoboot configurable
  2018-06-05  6:12 [PATCH v1] defaultenv-2: make abort key to stop autoboot configurable Oleksij Rempel
@ 2018-06-05 13:07 ` Sam Ravnborg
  2018-06-06  5:34   ` Oleksij Rempel
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Ravnborg @ 2018-06-05 13:07 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: barebox

Hi Oleksij

On Tue, Jun 05, 2018 at 08:12:48AM +0200, Oleksij Rempel wrote:
> currently supported only two options: any key and ctrl-c
> "any kay" is default option.

Is Kay happy with that? (note: spelling error)

> To configure it, use:
> nv autoboot_abort_key=any
> or
> nv autoboot_abort_key=ctrl-c
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  Documentation/user/defaultenv-2.rst   |  3 +++
>  defaultenv/defaultenv-2-base/bin/init | 17 ++++++++++++++---
>  2 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/user/defaultenv-2.rst b/Documentation/user/defaultenv-2.rst
> index db74176b0..7502d3de1 100644
> --- a/Documentation/user/defaultenv-2.rst
> +++ b/Documentation/user/defaultenv-2.rst
> @@ -93,6 +93,9 @@ the :ref:`command_edit` command. Typical content:
>    # timeout in seconds before the default boot entry is started
>    #global.autoboot_timeout=3
>  
> +  # key to abort autoboot. Supported options are: "any" and "ctrl-c"
> +  #global.autoboot_abort_key=any
> +
>    # list of boot entries. These are executed in order until one
>    # succeeds. An entry can be:
>    # - a filename in /env/boot/

When touching this file - could you then also add a short
explanation that:

	arch/$ARCH/boards/<board>/env

Requires that CONFIG_DEFAULT_ENVIRONMENT_PATH are set to the above path.

Otherwise I will cook up a small patch.
(I was hit by this yesterday and missed it)


> diff --git a/defaultenv/defaultenv-2-base/bin/init b/defaultenv/defaultenv-2-base/bin/init
> index 6f3a34dba..d75f8e08a 100644
> --- a/defaultenv/defaultenv-2-base/bin/init
> +++ b/defaultenv/defaultenv-2-base/bin/init
> @@ -5,6 +5,7 @@ export PATH=/env/bin
>  global hostname
>  global user
>  global autoboot_timeout
> +global autoboot_abort_key
>  global boot.default
>  global linux.bootargs.base
>  global linux.bootargs.console
> @@ -18,6 +19,8 @@ global editcmd
>  magicvar -a global.user "username (used in network filenames)"
>  [ -z "${global.autoboot_timeout}" ] && global.autoboot_timeout=3
>  magicvar -a global.autoboot_timeout "timeout in seconds before automatic booting"
> +[ -z "${global.autoboot_abort_key}" ] && global.autoboot_abort_key=any
> +magicvar -a global.autoboot_abort_key "key to abort automatic booting"
Could you include in the description the available options?

>  [ -z "${global.boot.default}" ] && global.boot.default=net
>  [ -z "${global.editcmd}" ] && global.editcmd=sedit
>  
> @@ -38,14 +41,22 @@ for i in /env/init/*; do
>  	. $i
>  done
>  
> +if [ "${global.autoboot_abort_key}" = "ctrl-c" ]; then
> +	abort_string="ctrl-c"
> +	abort_args="-c"
> +else
> +	abort_string="any key"
> +	abort_args="-a"
> +fi
> +
>  if [ -e /env/menu ]; then
> -	echo -e -n "\nHit m for menu or any other key to stop autoboot: "
> +	echo -e -n "\nHit m for menu or $abort_string to stop autoboot: "

This will read:

	"Hit m for menu or any to stop autoboot: "

Add a "key" to make it more explicit:

	"Hit m for menu or any key to stop autoboot: "

>  else
> -	echo -e -n "\nHit any key to stop autoboot: "
> +	echo -e -n "\nHit $abort_string to stop autoboot: "
>  fi
>  
>  if [ "$autoboot" = 0 ]; then
> -	timeout -a $global.autoboot_timeout -v key
> +	timeout $abort_args $global.autoboot_timeout -v key
>  	autoboot="$?"
>  fi

	Sam

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] defaultenv-2: make abort key to stop autoboot configurable
  2018-06-05 13:07 ` Sam Ravnborg
@ 2018-06-06  5:34   ` Oleksij Rempel
  0 siblings, 0 replies; 3+ messages in thread
From: Oleksij Rempel @ 2018-06-06  5:34 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: barebox


[-- Attachment #1.1: Type: text/plain, Size: 4146 bytes --]

Hi Sam,

On Tue, Jun 05, 2018 at 03:07:38PM +0200, Sam Ravnborg wrote:
> Hi Oleksij
> 
> On Tue, Jun 05, 2018 at 08:12:48AM +0200, Oleksij Rempel wrote:
> > currently supported only two options: any key and ctrl-c
> > "any kay" is default option.
> 
> Is Kay happy with that? (note: spelling error)

:) thx.

> > To configure it, use:
> > nv autoboot_abort_key=any
> > or
> > nv autoboot_abort_key=ctrl-c
> > 
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
> >  Documentation/user/defaultenv-2.rst   |  3 +++
> >  defaultenv/defaultenv-2-base/bin/init | 17 ++++++++++++++---
> >  2 files changed, 17 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Documentation/user/defaultenv-2.rst b/Documentation/user/defaultenv-2.rst
> > index db74176b0..7502d3de1 100644
> > --- a/Documentation/user/defaultenv-2.rst
> > +++ b/Documentation/user/defaultenv-2.rst
> > @@ -93,6 +93,9 @@ the :ref:`command_edit` command. Typical content:
> >    # timeout in seconds before the default boot entry is started
> >    #global.autoboot_timeout=3
> >  
> > +  # key to abort autoboot. Supported options are: "any" and "ctrl-c"
> > +  #global.autoboot_abort_key=any
> > +
> >    # list of boot entries. These are executed in order until one
> >    # succeeds. An entry can be:
> >    # - a filename in /env/boot/
> 
> When touching this file - could you then also add a short
> explanation that:
> 
> 	arch/$ARCH/boards/<board>/env
> 
> Requires that CONFIG_DEFAULT_ENVIRONMENT_PATH are set to the above path.
> 
> Otherwise I will cook up a small patch.
> (I was hit by this yesterday and missed it)

This will need a separate patch. If you can do it, it will be great :)

> > diff --git a/defaultenv/defaultenv-2-base/bin/init b/defaultenv/defaultenv-2-base/bin/init
> > index 6f3a34dba..d75f8e08a 100644
> > --- a/defaultenv/defaultenv-2-base/bin/init
> > +++ b/defaultenv/defaultenv-2-base/bin/init
> > @@ -5,6 +5,7 @@ export PATH=/env/bin
> >  global hostname
> >  global user
> >  global autoboot_timeout
> > +global autoboot_abort_key
> >  global boot.default
> >  global linux.bootargs.base
> >  global linux.bootargs.console
> > @@ -18,6 +19,8 @@ global editcmd
> >  magicvar -a global.user "username (used in network filenames)"
> >  [ -z "${global.autoboot_timeout}" ] && global.autoboot_timeout=3
> >  magicvar -a global.autoboot_timeout "timeout in seconds before automatic booting"
> > +[ -z "${global.autoboot_abort_key}" ] && global.autoboot_abort_key=any
> > +magicvar -a global.autoboot_abort_key "key to abort automatic booting"
> Could you include in the description the available options?

ok

> >  [ -z "${global.boot.default}" ] && global.boot.default=net
> >  [ -z "${global.editcmd}" ] && global.editcmd=sedit
> >  
> > @@ -38,14 +41,22 @@ for i in /env/init/*; do
> >  	. $i
> >  done
> >  
> > +if [ "${global.autoboot_abort_key}" = "ctrl-c" ]; then
> > +	abort_string="ctrl-c"
> > +	abort_args="-c"
> > +else
> > +	abort_string="any key"
> > +	abort_args="-a"
> > +fi
> > +
> >  if [ -e /env/menu ]; then
> > -	echo -e -n "\nHit m for menu or any other key to stop autoboot: "
> > +	echo -e -n "\nHit m for menu or $abort_string to stop autoboot: "
> 
> This will read:
> 
> 	"Hit m for menu or any to stop autoboot: "
> 
> Add a "key" to make it more explicit:
> 
> 	"Hit m for menu or any key to stop autoboot: "

see: abort_string="any key" ^^^

> >  else
> > -	echo -e -n "\nHit any key to stop autoboot: "
> > +	echo -e -n "\nHit $abort_string to stop autoboot: "
> >  fi
> >  
> >  if [ "$autoboot" = 0 ]; then
> > -	timeout -a $global.autoboot_timeout -v key
> > +	timeout $abort_args $global.autoboot_timeout -v key
> >  	autoboot="$?"
> >  fi
> 
> 	Sam


Thank you for review.

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-06  5:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-05  6:12 [PATCH v1] defaultenv-2: make abort key to stop autoboot configurable Oleksij Rempel
2018-06-05 13:07 ` Sam Ravnborg
2018-06-06  5:34   ` Oleksij Rempel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox