[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Set a bootdrive environment variable.
From: |
Andrei Borzenkov |
Subject: |
Re: Set a bootdrive environment variable. |
Date: |
Sun, 31 May 2015 09:42:00 +0300 |
В Wed, 27 May 2015 08:55:09 -0400
Mathieu Trudel-Lapierre <address@hidden> пишет:
> On Wed, May 27, 2015 at 12:04 AM, Andrei Borzenkov <address@hidden>
> wrote:
>
> > В Tue, 26 May 2015 12:46:07 -0400
> > Mathieu Trudel-Lapierre <address@hidden> пишет:
> >
> > > 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= 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 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.
>
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.
>
>
> > > Included is a patch that adds a "bootdrive" variable alongside cmdpath;
> > which
> > > contains just the drive designation for the boot device, to be used as
> > such:
> > >
> > > search --set=root --hint=$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 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.
>
> Mathieu Trudel-Lapierre <address@hidden>
> Freenode: cyphermox, Jabber: address@hidden
> 4096R/EE018C93 1967 8F7D 03A1 8F38 732E FF82 C126 33E1 EE01 8C93