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: Thu, 17 Jun 2010 01:31:13 +0200	[thread overview]
Message-ID: <4C195EC1.5030709@gmail.com> (raw)
In-Reply-To: <20100616130058.GB21862@riva.ucam.org>

Hi,

I made several tests, and the patch works fine with standard boot.  When
multibooting core.img, the command-line is taken into account correctly.
However, if no multiboot command-line is given, the prefix is set as
before (old partition naming style).

This comes from the fact that the modifications to the prefix done in
grub-setup only apply to the embedded image, and not to the core.img
file.  The grub-mkimage command used by grub-install is:

grub-mkimage -O i386-pc --output=/path/to/core.img --prefix=/boot/grub

Would it make sense to put the full prefix here?


>> - 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).
>
> My investigations suggest that this is very difficult.  Relocating the
> GRUB kernel, which is almost the first thing multiboot_entry does, is
> liable to overwrite the MBI, and you can't get at C code until you've
> done that.  That's why multiboot_entry has to copy out the boot device
> field even before it relocates the kernel.

What I meant is: the assembly part could be restricted to the copy of
the relevant MBI information, i.e. flags, boot_device and cmdline.  And
leave the actual decisions regarding the contents of those fields to
grub_machine_init().  This would mean that the part dealing with
grub_install_dos/bsd_part (multiboot_trampoline) would be part of the C
code (probably in make_install_device()).


>   grub_machine_set_prefix (void)
>   {
>     /* Initialize the prefix.  */
> -  grub_env_set ("prefix", make_install_device ());
> +  if (!found_multiboot_prefix)
> +    grub_env_set ("prefix", make_install_device ());

You could avoid the variable found_multiboot_prefix and use
grub_env_find("prefix").  The intention would be that if someone
(multiboot or someone else) has already set the prefix in grub_env,
then we shouldn't override this choice here.  This would simplify
a bit grub_parse_multiboot_cmdline(), which would become purely
generic.  But this is essentially cosmetic...


  === modified file 'kern/i386/pc/startup.S'
> --- kern/i386/pc/startup.S	2010-04-05 13:59:32 +0000
> +++ kern/i386/pc/startup.S	2010-06-16 12:55:05 +0000
> @@ -145,6 +145,32 @@ multiboot_entry:
>   	/* obtain the boot device */
>   	movl	12(%ebx), %edx

The boot_device field should be used only if the MULTIBOOT_INFO_BOOTDEV
flag is set.  This problem is already present in trunk.

> +	/* if so, copy it to a safe place; do this before relocating code to
> +	   make sure that we don't lose it */
> +	movl	16(%ebx), %edi
> +	pushl	%edi

Is it safe to push?  Maybe we should start by setting %esp as is done a
few lines below.

I honestly do not understand all the details regarding the assembly code
or the memory management, so I can't provide useful feedback on that.
I just noticed that GRUB_MEMORY_MACHINE_MULTIBOOT_FLAGS is copied into a
``regular'' variable, but GRUB_MEMORY_MACHINE_MULTIBOOT_CMDLINE is not.

Grégoire


  reply	other threads:[~2010-06-16 23:31 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
2010-06-16 13:01                           ` Colin Watson
2010-06-16 23:31                             ` Grégoire Sutre [this message]
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=4C195EC1.5030709@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.