[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] xen: Allow a default compiled-in command line using Kconfig



Added two new config entries in common/Kconfig: CMDLINE_BOOL and CMDLINE.
These two entries enable an embedded command line
to be compiled in the hypervisor.
If CMDLINE_BOOL is set to Y, both arm and x86 startup routines
will call cmdline_parse() first on CMDLINE,
then on the line passed by the bootloader.
This allows downstreams to set their defaults
without modifying the source code all over the place.
Also probably useful for the embedded space.

See Also: 
https://xenproject.atlassian.net/projects/XEN/issues/XEN-41?filter=allopenissues

Signed-off-by: Zhongze Liu <blackskygg@xxxxxxxxx>
---
 xen/arch/arm/setup.c |  5 +++++
 xen/arch/x86/setup.c |  5 +++++
 xen/common/Kconfig   | 27 +++++++++++++++++++++++++++
 3 files changed, 37 insertions(+)

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 92a2de6b70..55860a1299 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -729,6 +729,11 @@ void __init start_xen(unsigned long boot_phys_offset,
         + (fdt_paddr & ((1 << SECOND_SHIFT) - 1));
     fdt_size = boot_fdt_info(device_tree_flattened, fdt_paddr);

+#ifdef CONFIG_CMDLINE
+    printk("Compiled-in command line: %s\n", CONFIG_CMDLINE);
+    cmdline_parse(cmdline);
+#endif
+
     cmdline = boot_fdt_cmdline(device_tree_flattened);
     printk("Command line: %s\n", cmdline);
     cmdline_parse(cmdline);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index dab67d5491..2b961f95cf 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -690,6 +690,11 @@ void __init noreturn __start_xen(unsigned long mbi_p)
         kextra += 3;
         while ( kextra[1] == ' ' ) kextra++;
     }
+
+#ifdef CONFIG_CMDLINE
+    printk("Compiled-in command line: %s\n", CONFIG_CMDLINE);
+    cmdline_parse(CONFIG_CMDLINE);
+#endif
     cmdline_parse(cmdline);

     /* Must be after command line argument parsing and before
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index f2ecbc43d6..1afcd8142c 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -237,4 +237,31 @@ config FAST_SYMBOL_LOOKUP
   The only user of this is Live patching.

   If unsure, say Y.
+
+config CMDLINE_BOOL
+ bool "Built-in hypervisor command line"
+ default n
+ ---help---
+  Allow for specifying boot arguments to the hypervisor at
+  build time.  On some systems (e.g. embedded ones), it is
+  necessary or convenient to provide some or all of the
+  hypervisor boot arguments with the hypervisor itself (that is,
+  to not rely on the boot loader to provide them.)
+
+  To compile command line arguments into the hypervisor,
+  set this option to 'Y', then fill in the
+  boot arguments in CONFIG_CMDLINE.
+
+config CMDLINE
+ string "Built-in hypervisor command string"
+ depends on CMDLINE_BOOL
+ default ""
+ ---help---
+  Enter arguments here that should be compiled into the hypervisor
+  image and used at boot time.  If the boot loader provides a
+  command line at boot time, it is appended to this string to
+  form the full hypervisor command line, when the system boots.
+
+  However, you can use the CONFIG_CMDLINE_OVERRIDE option to
+  change this behavior.
 endmenu
-- 
2.12.0

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.