From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1cdqOV-0004j8-RZ for mharc-grub-devel@gnu.org; Tue, 14 Feb 2017 22:36:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdqOT-0004h8-8y for grub-devel@gnu.org; Tue, 14 Feb 2017 22:36:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdqOR-0001Kf-Vj for grub-devel@gnu.org; Tue, 14 Feb 2017 22:36:37 -0500 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:36586) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cdqOR-0001Iy-Nn for grub-devel@gnu.org; Tue, 14 Feb 2017 22:36:35 -0500 Received: by mail-pf0-x243.google.com with SMTP id 19so7645227pfo.3 for ; Tue, 14 Feb 2017 19:36:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=S514flX1l7HQ2zeyjjxF+i1QS9wOGzXjfM01RTGxaCw=; b=r+0IUphY4ZcuMT1V3ps/fdVYjb/hC7cFkGHV3sTyRf+hmdd+u48XLAXL02QR6aucB7 UgjEtRgaNQaos4dk6yvAWoSmxIT6nTPXv1y4CY+fcFqc3c06kdjN3QxgkPWmA3t5pOUc JtMchOPNrG4MR3EQ3Rrr94dx6oyQbfxx2ycD2Y6JWOrl2YbcAk+eAqipC11rdyMO+GjC LHinY+Pk9k6lpw2nrzopWiO31ZZFF/ybeMDk3Ig/8hVAi4CX1FSwwbzgO2ML7OOa7iNO 9UXaV6jynmQB5vSabmFzlxVHFot/EmFZVdk8BRK+VFQQQQadsjaIXxMMyBwvT+hwcstJ ur7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=S514flX1l7HQ2zeyjjxF+i1QS9wOGzXjfM01RTGxaCw=; b=KSTOyh5F+fzfjo5wbgd63DVT7C0y3B/aLA3h08fM+WcFZJSfW4PR9Ps2Lp1DiDp2K3 OOrtLwfrWTXg4ryaCchOxPTEOOhk+AvE1sceWMqIc/zJNgvCPdE06E59vdoprxdTmTUu Al3ETrROhllKkl6nJrXDuDcrrW2Qynzy+h1ZItQxRX3kvfNgtDkqhekYkok8Dqy3kKKm nWRwSrxQMx0yoDkcKBGZMb5o4akBckVVdlYHX9Bwmum2wtyiepsxcUDkT9oynB1qPE5M w3DR1R98d9g31U3DZfPZZOWZDqjxtWgjrTAAT3nySvsDzjwwA9ORvpxxulorZSEvO4Tz k/HA== X-Gm-Message-State: AMke39lcs5PUOTmsQNVs9+a9VFfrLNgDXzob5rUG5JYtrMRXF1I4EjHHKy7iYwTXcrEgsQ== X-Received: by 10.99.217.85 with SMTP id e21mr36701588pgj.79.1487129793157; Tue, 14 Feb 2017 19:36:33 -0800 (PST) Received: from ?IPv6:2601:602:9c01:e86a:1fb0:47b:8245:c067? ([2601:602:9c01:e86a:1fb0:47b:8245:c067]) by smtp.googlemail.com with ESMTPSA id q19sm3779382pfl.21.2017.02.14.19.36.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Feb 2017 19:36:32 -0800 (PST) Subject: Re: [PATCH 1/1] add --partuuid to probe To: Steve Kenton , Andrei Borzenkov , The development of GNU GRUB References: <20170214180035.3461-1-skenton@ou.edu> <84ba2661-e272-716c-52f7-79059a37dfbd@ou.edu> From: Nick Vinson Message-ID: Date: Tue, 14 Feb 2017 19:36:28 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <84ba2661-e272-716c-52f7-79059a37dfbd@ou.edu> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ovo4hdtuvO3G060wjLBR5f4NEt6U8DnSM" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::243 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2017 03:36:38 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ovo4hdtuvO3G060wjLBR5f4NEt6U8DnSM Content-Type: multipart/mixed; boundary="V3axWh6qlwgJINw85RSfTNfgaw9eC6RJj" From: Nick Vinson To: Steve Kenton , Andrei Borzenkov , The development of GNU GRUB Message-ID: Subject: Re: [PATCH 1/1] add --partuuid to probe References: <20170214180035.3461-1-skenton@ou.edu> <84ba2661-e272-716c-52f7-79059a37dfbd@ou.edu> In-Reply-To: <84ba2661-e272-716c-52f7-79059a37dfbd@ou.edu> --V3axWh6qlwgJINw85RSfTNfgaw9eC6RJj Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I'll need to check it against the 2.02 sources, but even if it needs updating, it shouldn't be too hard to do it. I can add your changes to the patchset. -Nick On 02/14/2017 11:39 AM, Steve Kenton wrote: > Nick, >=20 > What is the state of your patch set? I think mine is much smaller if yo= u > want to roll it into yours and resubmit. We were told all along to wait= > until after 2.02, which should to be very soon, so it looks like it's > show time! >=20 > Steve Kenton >=20 >=20 > On 02/14/2017 07:12 PM, Andrei Borzenkov wrote: >> 14.02.2017 21:00, Steve Kenton =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >>> Support both EFI and NT Disk Signature for passing to kernel as >>> root=3DPARTUUID=3D$val >>> >> Yes, I guess we need to add it finally. Unfortunately it is too late f= or >> 2.02, but it should go after in release. There were also patches for >> grub-probe and we also need to support it in search to be on par with >> filesystem UUID. May be if you could prepare consolidated patch set it= >> would be great. >> >> I apologize that it tool so long. Thank you for not giving up! >> >>> Signed-off-by: Steve Kenton >>> --- >>> It's been six months so I thought I'd resend this so it does not get >>> lost >>> in case I get hit by a meteor or something before the next release >>> >>> grub-core/commands/probe.c | 53 >>> ++++++++++++++++++++++++++++++++++++++++++++++ >>> 1 file changed, 53 insertions(+) >>> >>> diff --git a/grub-core/commands/probe.c b/grub-core/commands/probe.c >>> index cf2793e..3afc8b8 100644 >>> --- a/grub-core/commands/probe.c >>> +++ b/grub-core/commands/probe.c >> Please also add patch for manual. >> >>> @@ -45,6 +45,7 @@ static const struct grub_arg_option options[] =3D >>> {"fs", 'f', 0, N_("Determine filesystem type."), 0, 0}, >>> {"fs-uuid", 'u', 0, N_("Determine filesystem UUID."), 0,= >>> 0}, >>> {"label", 'l', 0, N_("Determine filesystem label."), 0, = 0}, >>> + {"partuuid", 'g', 0, N_("Determine partition GUID/UUID."), 0,= >>> 0}, /* GUID but Linux kernel calls it "PARTUUID" */ >>> {0, 0, 0, 0, 0, 0} >>> }; >>> @@ -154,6 +155,58 @@ grub_cmd_probe (grub_extcmd_context_t ctxt, >>> int argc, char **args) >>> grub_device_close (dev); >>> return GRUB_ERR_NONE; >>> } >>> + if (state[6].set) >>> + { >>> + char *partuuid =3D NULL; /* NULL to silence a spurious GCC >>> warning */ >>> + grub_uint8_t diskbuf[16]; >>> + if (dev->disk && dev->disk->partition) >>> + { >>> + grub_partition_t p =3D dev->disk->partition; >>> + if (!grub_strcmp (p->partmap->name, "msdos")) >>> + { >>> + const int diskid_offset =3D 440; /* location in MBR */ >>> + dev->disk->partition =3D p->parent; >>> + /* little-endian 4-byte NT disk signature */ >>> + err =3D grub_disk_read (dev->disk, 0, diskid_offset, 4, >>> diskbuf); >>> + dev->disk->partition =3D p; >>> + if (err) >>> + return grub_errno; >>> + partuuid =3D grub_xasprintf ("%02x%02x%02x%02x-%02x", >>> + diskbuf[3], diskbuf[2], diskbuf[1], diskbuf[0],= >>> + p->number + 1); /* one based partition number *= / >>> + } >>> + else if (!grub_strcmp (p->partmap->name, "gpt")) >>> + { >>> + const int guid_offset =3D 16; /* location in entry */ >>> + dev->disk->partition =3D p->parent; >>> + /* little-endian 16-byte EFI partition GUID */ >>> + err =3D grub_disk_read (dev->disk, p->offset, p->index + >>> guid_offset, 16, diskbuf); >>> + dev->disk->partition =3D p; >>> + if (err) >>> + return grub_errno; >>> + partuuid =3D grub_xasprintf >>> ("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02= x", >>> + diskbuf[3], diskbuf[2], diskbuf[1], diskbuf[0],= >>> + diskbuf[5], diskbuf[4], >>> + diskbuf[7], diskbuf[6], >>> + diskbuf[8], diskbuf[9], >>> + diskbuf[10], diskbuf[11], diskbuf[12], >>> diskbuf[13], diskbuf[14], diskbuf[15]); >>> + } >>> + else >>> + return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, >>> + N_("partition map %s does not support partition >>> UUIDs"), >>> + dev->disk->partition->partmap->name); >>> + } >>> + else >>> + partuuid =3D grub_strdup (""); /* a freeable empty string */ >>> + >>> + if (state[0].set) >>> + grub_env_set (state[0].arg, partuuid); >>> + else >>> + grub_printf ("%s", partuuid); >>> + grub_free (partuuid); >>> + grub_device_close (dev); >>> + return GRUB_ERR_NONE; >>> + } >>> grub_device_close (dev); >>> return grub_error (GRUB_ERR_BAD_ARGUMENT, "unrecognised target");= >>> } >>> >=20 --V3axWh6qlwgJINw85RSfTNfgaw9eC6RJj-- --ovo4hdtuvO3G060wjLBR5f4NEt6U8DnSM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEczDTDnZxlTLnbyK/I0TYj6JBO78FAlijzLwACgkQI0TYj6JB O78haw/9EiKHXHm03SRuT+WJiCzMKaZkyVJMf39mo6oFkWd4GdCJwaCi1r3okwhx fTnxbRE+yOg24+bzUWpRILN4nGx1cGEFaTwysbOER7chWOGX9HB9VBdk+PeXcf2+ 91fiLyNjhRiWXXcwjccEeyrXaGI9/RvL79dlpFsG7s96QdNPM/HDnKp5WiwBubfG roMLgv1/ZGIf8QgzitLq749CGUpJVmcQQByMW5QEabUygg9Tof5E5bn22T7i48K/ sGOH6gnKKqT2xl5359Wdc3IaFzpWlF7NXzSKz3ncpNDqa3HqRv3pN3SrUezI0nSO 2ToKzpYkZLEx34lzIMfo7HEWFXoOfOdkgK30ztLKF4ceKINkQKmEOlkACl6jiNmC v3ps6eJPAo42trK2Z/+FZxwvVfruSq1ufSaH9MhwQQ/LJiWue141VmZ/WTCNTvn8 zeo8gM6LsUBUZv15rIWNx/r6mbBMl6gw9AgXnTm18Tk3KaMvkQyHKNr1kTTbyfVU hmABhRSjOMem1YQeN6AZIToK5O0V0kjJvEedGjjd1jIP33DkN1exWHGz8+7vovOW 7hje/wjq2ltEJXjpaex7+Z5+rAfvZO4H7tt4b9ZQkz/WF3ArAPexav1WPYWOyNm9 VQLzzc3faxg9qDIF8vpsA0PeKN+2j/cQRyAyzQ1Yd4brUglWjTo= =yk5e -----END PGP SIGNATURE----- --ovo4hdtuvO3G060wjLBR5f4NEt6U8DnSM--