All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Grégoire Sutre" <gregoire.sutre@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: Which partitioning schemes should be supported by GRUB?
Date: Tue, 15 Jun 2010 23:07:42 +0200	[thread overview]
Message-ID: <4C17EB9E.9050309@gmail.com> (raw)
In-Reply-To: <20100615112111.GW21862@riva.ucam.org>

On 06/15/2010 01:21 PM, Colin Watson wrote:

>> A possible solution would be to use the multiboot-command line.  AFAIK,
>> the boot_device field of the multiboot information structure is supposed
>> to pass this kind of partition information, but you cannot specify the
>> partmaps in this field, hence its interpretation is ambiguous.
>
> That would potentially allow a user to override things, but doesn't help
> with users who don't change their configuration.  Unless the user
> explicitly configures things, boot_device is all we've got.

Ok.

> Thus, I guess we end up with a two-part fix:
>
>    1) Honour key=value pairs in the multiboot command line when booting
>       GRUB itself as a multiboot image.  These would simply become
>       environment variables.

This would be nice.

>    2) If multiboot_trampoline needs to change install_dos_part or
>       install_bsd_part based on the value of boot_device in the MBI, then
>       we know that the drive/partition part of prefix (which was
>       calculated in the same way as install_dos_part and install_bsd_part
>       when grub-setup was run) is now invalid and should be ignored.
>       This fact needs to be passed on to make_install_device.

Since the command-line processing of the MBI is done after startup.S (in 
grub_machine_init()),

- the MBI (only the relevant portions for simplicity) needs to be copied
   to a safe place.  The patch does it at the end of grub_machine_init(),
   but I'm afraid this might be too late: the MBI may have been
   overwritten before we reach that point.  Or is the code (startup.S and
   grub_machine_init()) designed to guarantee that all memory writes are
   in safe locations, outside of the whole MBI?

- couldn't the complete processing of the MBI be performed in the same
   place, i.e. grub_machine_init()?  The assembly multiboot part would
   only check whether GRUB was booted by multiboot, and set (or copy)
   the MBI in that case.  Then the procedure to set grub_prefix would be
   coded in one place.  This would require though, for multiboot, to get
   grub_boot_drive from the boot_device field (the current assembly code
   takes care of this).

>   void
>   grub_machine_init (void)
>   {
> @@ -214,6 +279,15 @@ grub_machine_init (void)
>     if (! grub_os_area_addr)
>       grub_fatal ("no upper memory");
>
> +  if (startup_multiboot_info)
> +    {
> +      /* Move MBI to a safe place.  */
> +      grub_memmove (&kern_multiboot_info, startup_multiboot_info,
> +		    sizeof (struct multiboot_info));

Moving the MBI is more complex, since the structure contains pointers
to other structures (themselves containing pointers etc.).  But in our
case it's not too painful since we only need to copy the struct
multiboot_info and the string pointed to by its cmdline field (and set
the field to the new address).

Grégoire


  reply	other threads:[~2010-06-15 21:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-06 18:02 Which partitioning schemes should be supported by GRUB? Grégoire Sutre
2010-06-07 20:46 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-09 22:45   ` Grégoire Sutre
2010-06-09 23:03     ` C. P. Ghost
2010-06-12 16:32   ` Grégoire Sutre
2010-06-12 17:26     ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-13 16:16       ` Grégoire Sutre
2010-06-14 11:37         ` Colin Watson
2010-06-14 13:07           ` richardvoigt
2010-06-14 13:25             ` Colin Watson
2010-06-14 15:02               ` Colin Watson
2010-06-14 15:58                 ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-14 16:43                   ` Colin Watson
2010-06-14 16:55                     ` Seth Goldberg
2010-06-14 17:33                       ` Colin Watson
2010-06-14 17:12                     ` Grégoire Sutre
2010-06-15 11:21                       ` Colin Watson
2010-06-15 21:07                         ` Grégoire Sutre [this message]
2010-06-16 13:01                           ` Colin Watson
2010-06-16 23:31                             ` Grégoire Sutre
2010-06-17  0:47                         ` Vladimir 'φ-coder/phcoder' Serbinenko
2010-06-17 11:29                           ` Colin Watson

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=4C17EB9E.9050309@gmail.com \
    --to=gregoire.sutre@gmail.com \
    --cc=grub-devel@gnu.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.