grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Nicholas Vinson <nvinson234@gmail.com>
Subject: Re: [GRUB PARTUUID PATCH 2/2] Update grub script template files
Date: Wed, 27 Jul 2016 08:01:20 +0300	[thread overview]
Message-ID: <41dbc01b-c380-f7d6-fcf4-b421b1352b97@gmail.com> (raw)
In-Reply-To: <db158d26cd280c68e946072e80a14a54a4ed1eab.1466385925.git.nvinson234@gmail.com>

20.06.2016 04:37, Nicholas Vinson пишет:
> Update grub-mkconfig.in and 10_linux.in to support grub-probe's new
> partuuid target.
> 
> Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
> ---
>  util/grub-mkconfig.in   |  2 ++
>  util/grub.d/10_linux.in | 11 +++++++++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
> index f8496d2..fc42462 100644
> --- a/util/grub-mkconfig.in
> +++ b/util/grub-mkconfig.in
> @@ -134,6 +134,7 @@ fi
>  # Device containing our userland.  Typically used for root= parameter.
>  GRUB_DEVICE="`${grub_probe} --target=device /`"
>  GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
> +GRUB_DEVICE_PARTUUID="`${grub_probe} --device ${GRUB_DEVICE} --target=partuuid 2> /dev/null`" || true
>  
>  # Device containing our /boot partition.  Usually the same as GRUB_DEVICE.
>  GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
> @@ -182,6 +183,7 @@ if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub
>  # override them.
>  export GRUB_DEVICE \
>    GRUB_DEVICE_UUID \
> +  GRUB_DEVICE_PARTUUID \
>    GRUB_DEVICE_BOOT \
>    GRUB_DEVICE_BOOT_UUID \
>    GRUB_FS \
> diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
> index de9044c..8081fdb 100644
> --- a/util/grub.d/10_linux.in
> +++ b/util/grub.d/10_linux.in
> @@ -220,8 +220,15 @@ while [ "x$list" != "x" ] ; do
>      gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
>    elif test -z "${initramfs}" ; then
>      # "UUID=" and "ZFS=" magic is parsed by initrd or initramfs.  Since there's
> -    # no initrd or builtin initramfs, it can't work here.
> -    linux_root_device_thisversion=${GRUB_DEVICE}
> +    # no initrd or builtin initramfs, it can't work here.  However, if
> +    # GRUB_DEVICE_PARTUUID is not empty we can use that here if
> +    # GRUD_DISABLE_LINUX_UUID is not set to true.
> +    if [ "x${GRUB_DISABLE_LINUX_UUID}" != "xtrue" ]
> +        && [ "x${GRUB_DEVICE_PARTUUID}" != "x" ]; then
> +        linux_root_device_thisversion="PARTUUID=${GRUB_DEVICE_PARTUUID}"

Well, PARTUUID appeared first in 2.6.37 and MSDOS "UUID" in 3.10.
Unfortunately we have no way to check for it, even as fragile as stored
kernel config. So I am not sure we should do it by default. And if we
add some extra knob to turn it on, as you mentioned yourself, you can
simply add root=PARTUUID=xxx to stored kernel command line.

One more consideration is that reinstalling in existing partition will
invalidate FS UUID stored in grub.cfg which is arguably the right thing
because you now have something different there, but PARTUUID will most
likely remain the same.

> +    else
> +        linux_root_device_thisversion=${GRUB_DEVICE}
> +    fi
>    fi
>  
>    if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
> 



  parent reply	other threads:[~2016-07-27  5:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20  1:37 [GRUB PARTUUID PATCH 0/2] GRUB: Add PARTUUID Detection Support Nicholas Vinson
2016-06-20  1:37 ` [GRUB PARTUUID PATCH 1/2] Add PARTUUID detection support to grub-probe Nicholas Vinson
2016-07-27  4:43   ` Andrei Borzenkov
2016-06-20  1:37 ` [GRUB PARTUUID PATCH 2/2] Update grub script template files Nicholas Vinson
2016-07-19 14:07   ` Nicholas Vinson
2016-07-19 14:16     ` Nick Vinson
2016-07-27  5:01   ` Andrei Borzenkov [this message]
2016-07-27 14:36     ` Nick Vinson

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=41dbc01b-c380-f7d6-fcf4-b421b1352b97@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.org \
    --cc=nvinson234@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).