GRUB2 config parser behavior for "load_env -f"

Alan Dunn amdunn at google.com
Tue Jan 12 13:02:18 AEDT 2016


Hi,

>From my reading of the code (in particular,
http://git.kernel.org/cgit/linux/kernel/git/geoff/petitboot.git/tree/discover/grub2/env.c?id=106276d3d1bfae163828e111d6a8596104fba400#n81
) and experimentation, it looks like the current behavior of Petitboot's
GRUB2 config parser for "load_env -f <path>" is to always try and load an
environment file at "$prefix/<path>", with $prefix="" if unset.  However,
it seems like this is not the current behavior of GRUB2 (at least as of
GRUB2 2.02-beta2), which adds nothing to the path (from my reading of the
source and experimentation).

It looks like GRUB2 accepts only absolute paths, which can be
filesystem-prefixed (e.g. "(hd0,gpt1)/boot/grub/grub.cfg"), falling back to
the device specified by $root for the filesystem if none is specified, with
$root normally being set based on the value of $prefix.  It looks like
Petitboot by default doesn't set root, but it seems like we could at least
accommodate the important case where the configuration doesn't manually set
the value of root (by pretending that it points to the filesystem where the
configuration file is) pretty easily.

Would you folks be open to accepting a patch (that I will write) to put
Petitboot's behavior more in line with GRUB2 by eliminating the addition of
"$prefix/" in "load_env -f" and loading paths on the current filesystem
(and ensuring that this behavior is properly tested)?

Thanks,
- Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/petitboot/attachments/20160111/91b4cd2c/attachment.html>


More information about the Petitboot mailing list