GRUB2 config parser behavior for "load_env -f"

Sam Mendoza-Jonas sam at mendozajonas.com
Tue Jan 12 13:13:50 AEDT 2016


Hi Alan,

Patches are always welcome! I'm happy to test such a change on my end.
Do you have a link to the GRUB2 source/docs that mentions this behaviour?

Thanks,
Sam

On Mon, Jan 11, 2016 at 06:02:18PM -0800, Alan Dunn wrote:
> 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

> _______________________________________________
> Petitboot mailing list
> Petitboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/petitboot



More information about the Petitboot mailing list