From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Yywwj-0000rp-U5 for mharc-grub-devel@gnu.org; Sun, 31 May 2015 02:42:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yywwh-0000rj-G4 for grub-devel@gnu.org; Sun, 31 May 2015 02:42:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yywwd-0008SZ-Dn for grub-devel@gnu.org; Sun, 31 May 2015 02:42:07 -0400 Received: from mail-lb0-x230.google.com ([2a00:1450:4010:c04::230]:35919) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yywwd-0008Qk-5W for grub-devel@gnu.org; Sun, 31 May 2015 02:42:03 -0400 Received: by lbbqq2 with SMTP id qq2so68195021lbb.3 for ; Sat, 30 May 2015 23:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=nMd1JTK92gxavZG+cVtF/vbEB+G5a6wBehZUgBVRRpI=; b=dAfZUrszqt+IeytClsHkTQJEs0uqFoZAg2/3lXchE7LAzOndjsFTxGvjDbldW19+xO qoqCBxVDpovtGBY+spqGbIl1WfgLYsuECgfIcEURTk2lh6KNeb1XcxnQ5M15BrYsFQbY Y6rUaPwPIIIWAOzDr1jHZ4pvIB8FmVASzH5QJHjrIHzxVBVr5gcEBCDxPpVPE1XWCwMF 9ECVbH+zP6hIHgu6Q25U/b6igoIYIs+V9glRbZSg6OA3U3rYzfVGVSgaFCMWObAlGUzP NKHafsBZuPeTFN1qFdG6aRd7uPMm+tb+BImSKimRa6VpyaUoPBhgpqAIcWTiILzFcUyD yYwA== X-Received: by 10.112.93.37 with SMTP id cr5mr15754692lbb.106.1433054522283; Sat, 30 May 2015 23:42:02 -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 p9sm3007761laf.11.2015.05.30.23.42.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 May 2015 23:42:01 -0700 (PDT) Date: Sun, 31 May 2015 09:42:00 +0300 From: Andrei Borzenkov To: Mathieu Trudel-Lapierre Subject: Re: Set a bootdrive environment variable. Message-ID: <20150531094200.52cf9bd0@opensuse.site> In-Reply-To: References: <1432658768-4225-1-git-send-email-mathieu.trudel-lapierre@canonical.com> <20150527070407.05884736@opensuse.site> X-Mailer: Claws Mail 3.11.0 (GTK+ 2.24.27; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::230 Cc: grub-devel@gnu.org 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: Sun, 31 May 2015 06:42:08 -0000 =D0=92 Wed, 27 May 2015 08:55:09 -0400 Mathieu Trudel-Lapierre =D0=BF=D0=B8=D1=88=D0=B5=D1= =82: > On Wed, May 27, 2015 at 12:04 AM, Andrei Borzenkov > wrote: >=20 > > =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 detection= 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? > > >=20 > My understanding from why the search was used is that $root may not have > 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. 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. > In retrospect, having a properly set $cmdpath (or $grub_bootdev or > whatever), probably makes this unnecessary. >=20 >=20 > > > Included is a patch that adds a "bootdrive" variable alongside cmdpat= h; > > 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. > > >=20 > That was one of the reasons I wanted review on it, so thanks! >=20 > I'm happy to change it to $grub_bootdev or whatever else if we feel having > separate variable for this in indeed a good idea (and I'll add what's > needed to get $grub_bootpath). > 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