From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Z0imZ-00012z-1V for mharc-grub-devel@gnu.org; Thu, 04 Jun 2015 23:58:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41332) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0imW-00012M-Fs for grub-devel@gnu.org; Thu, 04 Jun 2015 23:58:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0imR-000682-Eb for grub-devel@gnu.org; Thu, 04 Jun 2015 23:58:56 -0400 Received: from mail-la0-x232.google.com ([2a00:1450:4010:c03::232]:35275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0imR-00067y-0f for grub-devel@gnu.org; Thu, 04 Jun 2015 23:58:51 -0400 Received: by labko7 with SMTP id ko7so45633144lab.2 for ; Thu, 04 Jun 2015 20:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-type; bh=VqE2YydUCI4o68gtQqizR0NpraPP3p1y84X/LPsfzBo=; b=vMWgs+GLEu4DQdkPNTucUumOk8S4lHETggDLlkL51lwlItBQHIXqqLJJs7G5gyyfy6 hv/X8Wt3MKFsFynZiNGtHkjvv+zhvGeK+ceDRVLJ2mIhzFktd4tLOuQTRAQ0+XfB9fIl lGHdaMQePJfJI87oAC2LW0tKKQf/my99eY0wveMn3asapdL2tX+GU34hwV3TveXlrwPk DLO0IY3t/SPGXMpXY4Cf9zrwXNCt/YySceOC0vDGyfpMI4FtZ3C4o8o9oP2vyqwpmMmS DXbyw80Z95kum6Jmc+GDUQD/N+N0LQ0eDRjbDF5OTam8PADdX7JeIwZvozJMZi5LgJuq Ia+Q== X-Received: by 10.152.87.33 with SMTP id u1mr1311984laz.35.1433476729943; Thu, 04 Jun 2015 20:58:49 -0700 (PDT) Received: from opensuse.site (ppp91-76-14-38.pppoe.mtu-net.ru. [91.76.14.38]) by mx.google.com with ESMTPSA id c5sm1359793lac.15.2015.06.04.20.58.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2015 20:58:49 -0700 (PDT) Date: Fri, 5 Jun 2015 06:58:48 +0300 From: Andrei Borzenkov To: grub-devel@gnu.org Subject: Re: Set a bootdrive environment variable. Message-ID: <20150605065848.3298f738@opensuse.site> In-Reply-To: <55707151.7060506@gmail.com> References: <1432658768-4225-1-git-send-email-mathieu.trudel-lapierre@canonical.com> <20150527070407.05884736@opensuse.site> <20150531094200.52cf9bd0@opensuse.site> <55707151.7060506@gmail.com> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.27; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/M58IGgn3GVSiKzB73Y5i8Nk"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::232 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jun 2015 03:58:58 -0000 --Sig_/M58IGgn3GVSiKzB73Y5i8Nk Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable =D0=92 Thu, 04 Jun 2015 17:40:01 +0200 Vladimir '=CF=86-coder/phcoder' Serbinenko =D0=BF=D0=B8= =D1=88=D0=B5=D1=82: > What's the problem with extracting this from $prefix ? This seems to be > a better match if what you want is location of GRUB. The original problem was that this information was needed to set $prefix so it cannot be extracted from it :) It can be extracted from $cmdpath but then it requires regexp in early config and feels backwards in general. > On 31.05.2015 08:42, Andrei Borzenkov wrote: > > =D0=92 Wed, 27 May 2015 08:55:09 -0400 > > Mathieu Trudel-Lapierre =D0=BF=D0=B8=D1=88=D0=B5= =D1=82: > >=20 > >> On Wed, May 27, 2015 at 12:04 AM, Andrei Borzenkov > >> wrote: > >> > >>> =D0=92 Tue, 26 May 2015 12:46:07 -0400 > >>> Mathieu Trudel-Lapierre =D0=BF=D0=B8=D1=88=D0= =B5=D1=82: > >>> > >>>> I've been playing with fixing Ubuntu bug 1097570; trying to debug a > >>> script we > >>>> use for the EFI images which detects where to boot from based on the > >>> location > >>>> of a .disk/info file. > >>>> > >>>> Turns out this mostly works, except for the fact that grub appears to > >>> always > >>>> list devices in a specific order, which interferes with the detectio= n if > >>> more > >>>> than one device contains that file. > >>>> > >>>> I think I can make this work appropriately provided we: > >>>> - Use hints for search --file; > >>>> - Have some value to pass to --hint=3D designating the boot drive. > >>>> > >>> > >>> If you always want to use the same device GRUB was booted from why do > >>> you need to search for anything at all? > >>> > >> > >> My understanding from why the search was used is that $root may not ha= ve > >> been set for all types of devices (i.e. CDs), and the same built grub > >> images (for EFI) were used on bootable USB and CDs since they are both > >> built from a single ISO. > >> > >=20 > > That depends on your image. If image defines prefix and drive and/or > > partition is missing (e.g. (,msdos1)) missing parts are derived from > > whatever firmware provides (effectively what ends up in $cmdpath) and > > should be set for any boot media. > >=20 > > Although I just hit a system (Fujitsu Lifebook S761) which passes bogus > > device path to image that does not match any existing handle, so both > > $cmdpath and $root are not set. > >=20 > >> In retrospect, having a properly set $cmdpath (or $grub_bootdev or > >> whatever), probably makes this unnecessary. > >> > >> > >>>> Included is a patch that adds a "bootdrive" variable alongside cmdpa= th; > >>> which > >>>> contains just the drive designation for the boot device, to be used = as > >>> such: > >>>> > >>>> search --set=3Droot --hint=3D$bootdrive --file .disk/info > >>>> > >>>> I'd much appreciate review on that patch :) > >>>> > >>> > >>> You can extract it from $cmdpath using regexp already. In retrospect > >>> having separate variables for device and path would be more flexible; > >>> but $drive is not appropriate name as it can refer to network as well. > >>> Something like $grub_bootdev and $grub_bootpath. > >>> > >> > >> That was one of the reasons I wanted review on it, so thanks! > >> > >> I'm happy to change it to $grub_bootdev or whatever else if we feel ha= ving > >> separate variable for this in indeed a good idea (and I'll add what's > >> needed to get $grub_bootpath). > >> > >=20 > > The problem is that $cmdpath had been around for long enough. If > > $cmdpath is used only after loading normal (that are cases I'm aware > > of) we can make it compatibility variable set by normal without causing > > more core bloat. > >=20 > >> > >> Mathieu Trudel-Lapierre > >> Freenode: cyphermox, Jabber: mathieu.tl@gmail.com > >> 4096R/EE018C93 1967 8F7D 03A1 8F38 732E FF82 C126 33E1 EE01 8C93 > >=20 > >=20 > > _______________________________________________ > > Grub-devel mailing list > > Grub-devel@gnu.org > > https://lists.gnu.org/mailman/listinfo/grub-devel > >=20 >=20 >=20 --Sig_/M58IGgn3GVSiKzB73Y5i8Nk Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlVxHngACgkQR6LMutpd94z/kwCgoB33i7s31XHl4LtvjpbAfuzl higAnjdfIhFGaK+vl1Re8kxtfctzJ5N8 =4d9E -----END PGP SIGNATURE----- --Sig_/M58IGgn3GVSiKzB73Y5i8Nk--