All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 2/4] Accept environment variables on the command line for Xen.
Date: Thu, 12 Dec 2013 17:13:13 +0100	[thread overview]
Message-ID: <CAEaD8JMdjAkxSfU4vCu=aQ2KL7iS5iRLv67KumQAqdN_npemwQ__41032.1236392066$1386864899$gmane$org@mail.gmail.com> (raw)
In-Reply-To: <20131212194805.5d81a2e7@opensuse.site>


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

I was about to post similar remarks. I'm on phone so will tell just the key
points.
- Most of GRUB platforms have command lines. I.a xen, efi, loongson,
ieee1275, arc.
- Many platforms add their own command line arguments even if user didn't
ask for it. Those shouldn't interfere. In your patch root=sda1 from xen
will either be lost or will clobber GRUB root.
- IEEE1275 code already looks into command line. If it does sth sane it
could be used as base, otherwise it should be replaced with sth common.
- Perhaps we should use some prefix to avoid unintended clobbering.
- There should be a way to emulate pvgrub1 behaviour which took config name
from commandline. Perhaps pvgrub2 should even do it by default (by using
legacy_configfile)
On Dec 12, 2013 4:48 PM, "Andrey Borzenkov" <arvidjaar@gmail.com> wrote:

> В Thu, 12 Dec 2013 15:37:22 +0000
> Colin Watson <cjwatson@ubuntu.com> пишет:
>
> > * grub-core/kern/xen/init.c (fetch_command_line_word): New function.
> > (parse_command_line): Likewise.
> > (grub_machine_init): Call parse_command_line.
> > ---
> >  ChangeLog                 |  8 ++++++++
> >  grub-core/kern/xen/init.c | 44
> ++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 52 insertions(+)
> >
> > diff --git a/ChangeLog b/ChangeLog
> > index 766fe4b..fc86601 100644
> > --- a/ChangeLog
> > +++ b/ChangeLog
> > @@ -1,5 +1,13 @@
> >  2013-12-12  Colin Watson  <cjwatson@ubuntu.com>
> >
> > +     Accept environment variables on the command line for Xen.
> > +
>
> Thank you!
>
> It may make sense to generalize it to other archs. At least EFI
> definitely comes in mind. In this case platform specific part is only
> to fetch parameter string(s). What about
>
> - move fetch_command_line_word and parse_command_line to separate file
>   that is included for specific platforms only
> - make each platform that can accept fetch parameters in platform
>   specific way and call common code (parse_command_line)
>
> Does it make sense?
>
> I will add EFI part then later.
>
> > +     * grub-core/kern/xen/init.c (fetch_command_line_word): New
> function.
> > +     (parse_command_line): Likewise.
> > +     (grub_machine_init): Call parse_command_line.
> > +
> > +2013-12-12  Colin Watson  <cjwatson@ubuntu.com>
> > +
> >       Add an option to exclude devices from search results.
> >
> >       * grub-core/commands/search.c (struct search_ctx): Add excludes and
> > diff --git a/grub-core/kern/xen/init.c b/grub-core/kern/xen/init.c
> > index 1d8eaec..eb9b8b3 100644
> > --- a/grub-core/kern/xen/init.c
> > +++ b/grub-core/kern/xen/init.c
> > @@ -525,6 +525,48 @@ map_all_pages (void)
> >    grub_mm_init_region ((void *) heap_start, heap_end - heap_start);
> >  }
> >
> > +static char *
> > + (char *pos, char **word)
> > +{
> > +  while (grub_isspace (*pos))
> > +    pos++;
> > +
> > +  if (!*pos)
> > +    return NULL;
> > +
> > +  *word = pos;
> > +  while (*pos && !grub_isspace (*pos))
> > +    pos++;
> > +  if (*pos)
> > +    *pos++ = '\0';
> > +  return pos;
> > +}
> > +
> > +static void
> > +parse_command_line (void)
> > +{
> > +  char *cmd_line;
> > +  char *pos, *word;
> > +
> > +  cmd_line = grub_malloc (MAX_GUEST_CMDLINE + 1);
> > +  grub_memcpy (cmd_line, grub_xen_start_page_addr->cmd_line,
> > +            MAX_GUEST_CMDLINE);
> > +  cmd_line[MAX_GUEST_CMDLINE] = '\0';
> > +  pos = cmd_line;
> > +  while ((pos = fetch_command_line_word (pos, &word)) != NULL)
> > +    {
> > +      char *equals;
> > +
> > +      equals = grub_strchr (word, '=');
> > +      if (!equals)
> > +     continue;
> > +
> > +      *equals = '\0';
> > +      grub_env_set (word, equals + 1);
> > +    }
> > +  grub_free (cmd_line);
> > +}
> > +
> >  extern char _end[];
> >
> >  void
> > @@ -547,6 +589,8 @@ grub_machine_init (void)
> >    grub_xendisk_init ();
> >
> >    grub_boot_init ();
> > +
> > +  parse_command_line ();
> >  }
> >
> >  void
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #1.2: Type: text/html, Size: 5329 bytes --]

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

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2013-12-12 16:13 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-12 15:36 [PATCH 0/4] Turn-key PV-GRUB2 installation Colin Watson
2013-12-12 15:37 ` [PATCH 1/4] Add an option to exclude devices from search results Colin Watson
2013-12-13 12:27   ` [Xen-devel] " Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-13 13:18     ` Colin Watson
2013-12-13 15:40       ` [PATCH] add --boot-directory option to grub-mkstandalone Andrey Borzenkov
2013-12-20 12:16         ` Colin Watson
2013-12-21 10:29           ` Andrey Borzenkov
2013-12-21 10:37             ` Andrey Borzenkov
2013-12-22 17:20     ` [Xen-devel] [PATCH 1/4] Add an option to exclude devices from search results Jordan Uggla
2013-12-12 15:37 ` [PATCH 2/4] Accept environment variables on the command line for Xen Colin Watson
2013-12-12 15:37 ` Colin Watson
2013-12-12 15:48   ` Andrey Borzenkov
2013-12-12 16:11     ` Colin Watson
2013-12-12 16:15       ` Vladimir 'phcoder' Serbinenko
2013-12-12 16:13     ` Vladimir 'phcoder' Serbinenko
2013-12-12 17:12       ` Andrey Borzenkov
2013-12-12 17:58         ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-12 19:12           ` Colin Watson
2013-12-12 19:50             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-12 16:13     ` Vladimir 'phcoder' Serbinenko [this message]
2013-12-12 15:37 ` [PATCH 3/4] Build grub.xen Colin Watson
2013-12-12 16:24   ` Vladimir 'phcoder' Serbinenko
2013-12-12 16:39     ` Colin Watson
2013-12-12 16:45       ` Vladimir 'phcoder' Serbinenko
2013-12-12 16:49         ` Fwd: " Vladimir 'phcoder' Serbinenko
2013-12-12 16:49         ` Vladimir 'phcoder' Serbinenko
2013-12-12 17:36         ` Colin Watson
2013-12-12 17:41           ` Andrey Borzenkov
2013-12-12 18:08             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-12 18:08             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-13 11:56   ` Colin Watson
2013-12-13 12:19     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-13 12:19     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-13 11:56   ` Colin Watson
2013-12-12 15:37 ` Colin Watson
2013-12-12 15:37 ` [PATCH 4/4] Improve installation on Xen Colin Watson
2013-12-12 16:23   ` Vladimir 'phcoder' Serbinenko
2013-12-12 16:23   ` [Xen-devel] " Vladimir 'phcoder' Serbinenko
2013-12-13 11:58     ` Colin Watson
2013-12-16 11:42 ` [Xen-devel] [PATCH 0/4] Turn-key PV-GRUB2 installation Ian Campbell
2013-12-16 12:05   ` Samuel Thibault
2013-12-16 12:05   ` Samuel Thibault
2013-12-16 11:42 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEaD8JMdjAkxSfU4vCu=aQ2KL7iS5iRLv67KumQAqdN_npemwQ__41032.1236392066$1386864899$gmane$org@mail.gmail.com' \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.