On Mon, Jan 23, 2017 at 03:43:32PM -0800, Matthew Garrett wrote: > Add a command to read values from the qemu fwcfg store. This allows data > to be passed from the qemu command line to grub. > > Example use: > > echo '(hd0,1)' >rootdev > qemu -fw_cfg opt/rootdev,file=rootdev > > fwconfig opt/rootdev root > --- > docs/grub.texi | 6 +++ > grub-core/Makefile.core.def | 6 +++ > grub-core/commands/fwconfig.c | 121 > ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 133 insertions(+) > create mode 100644 grub-core/commands/fwconfig.c > > diff --git a/docs/grub.texi b/docs/grub.texi > index 4469638..4f8a378 100644 > --- a/docs/grub.texi > +++ b/docs/grub.texi > @@ -3818,6 +3818,7 @@ you forget a command, you can run the command > @command{help} > * eval:: Evaluate agruments as GRUB commands > * export:: Export an environment variable > * false:: Do nothing, unsuccessfully > +* fwconfig:: Retrieves a value from the qemu fwcfg store > * getenv:: Retrieve an EFI firmware variable > * gettext:: Translate a string > * gptsync:: Fill an MBR based on GPT entries > @@ -4259,6 +4260,11 @@ Do nothing, unsuccessfully. This is mainly useful in > control constructs > such as @code{if} and @code{while} (@pxref{Shell-like scripting}). > @end deffn > > +@node fwconfig > +@subsection fwconig > +@deffn Command fwconfig fwpath envvar > +Retrieves @var{fwpath} from the qemu fwcfg store and stores it in > @var{envvar} > + > @node getenv > @subsection getenv > > diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def > index db77a7f..f6b6f38 100644 > --- a/grub-core/Makefile.core.def > +++ b/grub-core/Makefile.core.def > @@ -2362,3 +2362,9 @@ module = { > common = loader/i386/xen_file64.c; > extra_dist = loader/i386/xen_fileXX.c; > }; > + > +module = { > + name = fwconfig; > + common = commands/fwconfig.c; > + enable = x86; > +}; > diff --git a/grub-core/commands/fwconfig.c b/grub-core/commands/fwconfig.c > new file mode 100644 > index 0000000..289d167 > --- /dev/null > +++ b/grub-core/commands/fwconfig.c > @@ -0,0 +1,121 @@ > +/* fwconfig.c - command to read config from qemu fwconfig */ > +/* > + * GRUB -- GRand Unified Bootloader > + * Copyright (C) 2015 CoreOS, Inc.
Hmm, See https://www.gnu.org/licenses/why-assign.html > + * > + * GRUB is free software: you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation, either version 3 of the License, or > + * (at your option) any later version. So what is your option here (see the 'at your option'). > + * > + * GRUB is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with GRUB. If not, see <http://www.gnu.org/licenses/>. > + */ _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel