]> git.ipfire.org Git - thirdparty/grub.git/commit
kern/xen: Add Xen command line parsing
authorAaron Rainbolt <arraybolt3@gmail.com>
Thu, 14 Aug 2025 01:36:45 +0000 (20:36 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 4 Sep 2025 12:34:31 +0000 (14:34 +0200)
commit587db89afc959f83c552bcbb96cd679cbdc2991a
tree8f439367b6c40dcbc5e224acd8cf21341b6fbacb
parentb2a975bc5d516df1c3495d6d80878d65c3199114
kern/xen: Add Xen command line parsing

Xen traditionally allows customizing guest behavior by passing arguments
to the VM kernel via the kernel command line. This is no longer possible
when using GRUB with Xen, as the kernel command line is decided by the
GRUB configuration file within the guest, not data passed to the guest
by Xen.

To work around this limitation, enable GRUB to parse a command line
passed to it by Xen, and expose data from the command line to the GRUB
configuration as environment variables. These variables can be used in
the GRUB configuration for any desired purpose, such as extending the
kernel command line passed to the guest. The command line format is
inspired by the Linux kernel's command line format.

To reduce the risk of misuse, abuse, or accidents in production, the
command line will only be parsed if it consists entirely of 7-bit ASCII
characters, only alphabetical characters and underscores are permitted
in variable names, and all variable names must start with the string
"xen_grub_env_". This also allows room for expanding the command line
arguments accepted by GRUB in the future, should other arguments end up
becoming desirable in the future.

Signed-off-by: Aaron Rainbolt <arraybolt3@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
docs/grub.texi
grub-core/Makefile.core.def
grub-core/kern/i386/xen/pvh.c
grub-core/kern/xen/cmdline.c [new file with mode: 0644]
grub-core/kern/xen/init.c
include/grub/xen.h