[PATCH 01/18] bootm: netbds: Drop passing of arguments

Simon Glass sjg at chromium.org
Wed Dec 6 04:53:58 CET 2023


Hi,

I am replying to this email since it still has the context below.

On Mon, 4 Dec 2023 at 03:48, Mark Kettenis <mark.kettenis at xs4all.nl> wrote:
>
> > From: Simon Glass <sjg at chromium.org>
> > Date: Sun,  3 Dec 2023 17:26:17 -0700
>
> Hi Simon,
>
> There is a typo in first line of the commit message: s/netbds/netbsd/.
>
> > It isn't clear how useful it is to pass the arguments of bootm to the
> > OS. For example, if "bootm 1000 2000 3000" is used, the three arguments
> > at the end are passed to the OS. This seems like a strange approach,
> > since the argument have already been parsed by U-Boot and processed.
> >
> > Rely instead on the "bootargs" mechanism, which is the standard
> > approach.
>
> It is a very Linuxy approach though.
>
> I suspect this feature was added to pass kernel arguments for
> "one-off" boots.  For example
>
>     bootm -s

Martin says that this is used with NetBSD. So do we rely on U-Boot
parsing the '-s' as 0 and then using loadaddr as the default?

I wonder if we could come up with another mechanism? Perhaps 'bootm --
args go here' ? Or define that if the first arg starts with '-' then
the args are not parsed?

Martin, would it be possible to send a patch to doc/ describing how to
boot NetBSD?


>
> could be used to boot NetBSD in single-user mode and is quite a bit
> more convenient than:
>
>     setenv bootargs -s
>     bootm
>
> That said, I'm not sure to what extent the bootm command is used to
> boot NetBSD these days.  So this may not really matter.
>
> Cheers,
>
> Mark
>
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> >  boot/bootm_os.c | 16 +++-------------
> >  1 file changed, 3 insertions(+), 13 deletions(-)
> >
> > diff --git a/boot/bootm_os.c b/boot/bootm_os.c
> > index b92422171a84..b5055d78706c 100644
> > --- a/boot/bootm_os.c
> > +++ b/boot/bootm_os.c
> > @@ -102,19 +102,9 @@ static int do_bootm_netbsd(int flag, int argc, char *const argv[],
> >                       os_hdr = hdr;
> >       }
> >
> > -     if (argc > 0) {
> > -             ulong len;
> > -             int   i;
> > -
> > -             for (i = 0, len = 0; i < argc; i += 1)
> > -                     len += strlen(argv[i]) + 1;
> > -             cmdline = malloc(len);
> > -             copy_args(cmdline, argc, argv, ' ');
> > -     } else {
> > -             cmdline = env_get("bootargs");
> > -             if (cmdline == NULL)
> > -                     cmdline = "";
> > -     }
> > +     cmdline = env_get("bootargs");
> > +     if (!cmdline)
> > +             cmdline = "";
> >
> >       loader = (void (*)(struct bd_info *, struct legacy_img_hdr *, char *, char *))images->ep;
> >
> > --
> > 2.43.0.rc2.451.g8631bc7472-goog
> >
> >


More information about the U-Boot mailing list