From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Z0XFW-0006hh-Sm for mharc-grub-devel@gnu.org; Thu, 04 Jun 2015 11:40:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0XFV-0006gX-5G for grub-devel@gnu.org; Thu, 04 Jun 2015 11:40:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0XFT-0004mu-T0 for grub-devel@gnu.org; Thu, 04 Jun 2015 11:40:05 -0400 Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]:35572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0XFT-0004lo-Iq for grub-devel@gnu.org; Thu, 04 Jun 2015 11:40:03 -0400 Received: by wgme6 with SMTP id e6so36741645wgm.2 for ; Thu, 04 Jun 2015 08:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=YG3kZLGzFwBBIWHdKbiIZJ4mOkfhBAoqfTHbrW53rPA=; b=QRAitORK3kJSBvVw1My2bstlJDhy6A3LnZSVbmB2myuHlNNCfQlnk17YTHMpetDK9c GDgPLO7IQ9v9ULLNgdu06B+vKIfpq5ZbxeHH0iquHrVPyrtmBnCu32OYsvmuyYX6TzXy dZk6p/NBks6BUEkCuy4MGiSJrousjinSAffwePb/iI1on2KxhYexS/mDe05sKgXVFkae Ug/thzydZ90qzBW7VQb0576h6xqtKPjlUsR+ycXIVYtX7XPnGHG7hkx2vMT1LZ9Z68MW WyRHMLpdDsdowZDZX5UyxMDpE9aI+a6BPymeYR5tsYQlNDHaD2hrJFCfalJc5pwsU7yN 5imw== X-Received: by 10.180.9.6 with SMTP id v6mr53820918wia.83.1433432402973; Thu, 04 Jun 2015 08:40:02 -0700 (PDT) Received: from ?IPv6:2620:0:105f:fd00:863a:4bff:fe50:abc4? ([2620:0:105f:fd00:863a:4bff:fe50:abc4]) by mx.google.com with ESMTPSA id wr6sm6282315wjb.21.2015.06.04.08.40.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jun 2015 08:40:01 -0700 (PDT) Message-ID: <55707151.7060506@gmail.com> Date: Thu, 04 Jun 2015 17:40:01 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: Set a bootdrive environment variable. References: <1432658768-4225-1-git-send-email-mathieu.trudel-lapierre@canonical.com> <20150527070407.05884736@opensuse.site> <20150531094200.52cf9bd0@opensuse.site> In-Reply-To: <20150531094200.52cf9bd0@opensuse.site> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fW25XXaKpcfaXg8hv0iqj2rFwwAj23vxQ" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::22c 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: Thu, 04 Jun 2015 15:40:06 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fW25XXaKpcfaXg8hv0iqj2rFwwAj23vxQ Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable What's the problem with extracting this from $prefix ? This seems to be a better match if what you want is location of GRUB. 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 t= o >>> 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= =2E >>> 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 --fW25XXaKpcfaXg8hv0iqj2rFwwAj23vxQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iF4EAREKAAYFAlVwcVEACgkQmBXlbbo5nOulYwEAgmlLrB250I6hcwjTcH0bujVZ L2nRwyzRgCBDZl6GA1QA/iRbzY/4y2ghAG/l7Osv2bbIooxu3lQNxpMhXtz7Ih3N =kmcL -----END PGP SIGNATURE----- --fW25XXaKpcfaXg8hv0iqj2rFwwAj23vxQ--