mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] boot: show all boot sources
@ 2014-06-30 12:21 Rolf Evers-Fischer
  2014-07-01  6:54 ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Rolf Evers-Fischer @ 2014-06-30 12:21 UTC (permalink / raw)
  To: barebox

This patch fixes the presentation of all bootsources with 'boot -m' and
'boot -l' command.

Signed-off-by: Rolf Evers-Fischer <embedded24@evers-fischer.de>
---
 commands/boot.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/boot.c b/commands/boot.c
index c8eae10..1a1856d 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -433,12 +433,12 @@ static int do_boot(int argc, char *argv[])
        }

        if (do_list) {
-               bootsources_list(sources, num_sources);
+               bootsources_list(&argv[optind], argc - optind);
                goto out;
        }

        if (do_menu) {
-               bootsources_menu(sources, num_sources);
+               bootsources_menu(&argv[optind], argc - optind);
                goto out;
        }

--
1.7.4.4

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

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

* Re: [PATCH] boot: show all boot sources
  2014-06-30 12:21 [PATCH] boot: show all boot sources Rolf Evers-Fischer
@ 2014-07-01  6:54 ` Sascha Hauer
  2014-07-01 12:10   ` Rolf Evers-Fischer
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2014-07-01  6:54 UTC (permalink / raw)
  To: Rolf Evers-Fischer; +Cc: barebox

On Mon, Jun 30, 2014 at 02:21:39PM +0200, Rolf Evers-Fischer wrote:
> This patch fixes the presentation of all bootsources with 'boot -m' and
> 'boot -l' command.
> 
> Signed-off-by: Rolf Evers-Fischer <embedded24@evers-fischer.de>
> ---
>  commands/boot.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/commands/boot.c b/commands/boot.c
> index c8eae10..1a1856d 100644
> --- a/commands/boot.c
> +++ b/commands/boot.c
> @@ -433,12 +433,12 @@ static int do_boot(int argc, char *argv[])
>         }
> 
>         if (do_list) {
> -               bootsources_list(sources, num_sources);
> +               bootsources_list(&argv[optind], argc - optind);
>                 goto out;
>         }
> 
>         if (do_menu) {
> -               bootsources_menu(sources, num_sources);
> +               bootsources_menu(&argv[optind], argc - optind);
>                 goto out;
>         }

What exactly fixes this? Looking at the code we have:

	if (optind < argc) {
		num_sources = argc - optind;
		sources = xmemdup(&argv[optind], sizeof(char *) *num_sources);
	} else {
		...
	}

Which should do what you want. On which barebox version are you?

Sascha

-- 
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 |

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

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

* Re: [PATCH] boot: show all boot sources
  2014-07-01  6:54 ` Sascha Hauer
@ 2014-07-01 12:10   ` Rolf Evers-Fischer
  2014-07-02  6:30     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Rolf Evers-Fischer @ 2014-07-01 12:10 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Rolf Evers-Fischer

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2114 bytes --]



On Tue, 1 Jul 2014, Sascha Hauer wrote:

> On Mon, Jun 30, 2014 at 02:21:39PM +0200, Rolf Evers-Fischer wrote:
>> This patch fixes the presentation of all bootsources with 'boot -m' and
>> 'boot -l' command.
>>
>> Signed-off-by: Rolf Evers-Fischer <embedded24@evers-fischer.de>
>> ---
>>  commands/boot.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/commands/boot.c b/commands/boot.c
>> index c8eae10..1a1856d 100644
>> --- a/commands/boot.c
>> +++ b/commands/boot.c
>> @@ -433,12 +433,12 @@ static int do_boot(int argc, char *argv[])
>>         }
>>
>>         if (do_list) {
>> -               bootsources_list(sources, num_sources);
>> +               bootsources_list(&argv[optind], argc - optind);
>>                 goto out;
>>         }
>>
>>         if (do_menu) {
>> -               bootsources_menu(sources, num_sources);
>> +               bootsources_menu(&argv[optind], argc - optind);
>>                 goto out;
>>         }
>
> What exactly fixes this? Looking at the code we have:
>
> 	if (optind < argc) {
> 		num_sources = argc - optind;
> 		sources = xmemdup(&argv[optind], sizeof(char *) *num_sources);
> 	} else {
> 		...
> 	}
>
> Which should do what you want.

Unfortunately it doesn't do what I want. If I invoke "boot -l" on the bb
shell, I get optind=argc=2. Therefore barebox executes the "else" clause,
which lists only the default bootsource.

But now I understand that replacing the "<" with "<=" might be a better
fix for this problem:

diff --git a/commands/boot.c b/commands/boot.c
index ba26cac..9823538 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -395,7 +395,7 @@ static int do_boot(int argc, char *argv[])
                 }
         }

-       if (optind < argc) {
+       if (optind <= argc) {
                 num_sources = argc - optind;
                 sources = xmemdup(&argv[optind], sizeof(char *) *
num_sources);
         } else {

What is your opinion?


> On which barebox version are you?
I'm using barebox-2014.06.0.

Best regards,
  Rolf

[-- 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] 5+ messages in thread

* Re: [PATCH] boot: show all boot sources
  2014-07-01 12:10   ` Rolf Evers-Fischer
@ 2014-07-02  6:30     ` Sascha Hauer
  2014-07-02 10:01       ` Rolf Evers-Fischer
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2014-07-02  6:30 UTC (permalink / raw)
  To: Rolf Evers-Fischer; +Cc: barebox

On Tue, Jul 01, 2014 at 02:10:07PM +0200, Rolf Evers-Fischer wrote:
> 
> 
> On Tue, 1 Jul 2014, Sascha Hauer wrote:
> 
> >What exactly fixes this? Looking at the code we have:
> >
> >	if (optind < argc) {
> >		num_sources = argc - optind;
> >		sources = xmemdup(&argv[optind], sizeof(char *) *num_sources);
> >	} else {
> >		...
> >	}
> >
> >Which should do what you want.
> 
> Unfortunately it doesn't do what I want. If I invoke "boot -l" on the bb
> shell, I get optind=argc=2. Therefore barebox executes the "else" clause,
> which lists only the default bootsource.

Right, but what else should the command list if you do not give
additional arguments?

I mean the intention is that

boot -l <source1> <source2>

lists all sources specified, whereas

boot -l

lists everything from $global.boot.default

Sascha

-- 
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 |

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

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

* Re: [PATCH] boot: show all boot sources
  2014-07-02  6:30     ` Sascha Hauer
@ 2014-07-02 10:01       ` Rolf Evers-Fischer
  0 siblings, 0 replies; 5+ messages in thread
From: Rolf Evers-Fischer @ 2014-07-02 10:01 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Rolf Evers-Fischer



On Wed, 2 Jul 2014, Sascha Hauer wrote:

> I mean the intention is that
> 
> boot -l <source1> <source2>
> 
> lists all sources specified, whereas
> 
> boot -l
> 
> lists everything from $global.boot.default
> 

Thank you for this clarification. Now I know, how I can list more than one 
bootsource in bootmenu: I simply have to change my $global.boot.default 
entry from e.g.

global.boot.default=sd

to

global.boot.default="sd usb net"

I have just confirmed that it works! And it doesn't need any sourcecode 
patch.


Best regards,
 Rolf

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

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

end of thread, other threads:[~2014-07-02 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-30 12:21 [PATCH] boot: show all boot sources Rolf Evers-Fischer
2014-07-01  6:54 ` Sascha Hauer
2014-07-01 12:10   ` Rolf Evers-Fischer
2014-07-02  6:30     ` Sascha Hauer
2014-07-02 10:01       ` Rolf Evers-Fischer

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