xen: Allow a default compiled-in command line using Kconfig
PATCH v9 1/1 xen: Allow a default compiled-in command line using Kconfig
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/browse/XEN-41)
If CMDLINE is set, it will be parsed prior to the bootloader command line. This order of parsing implies that if any non-cumulative options are set in both CMDLINE and the bootloader command line, only the ones in the latter will take effect. Furthermore, if CMDLINE_OVERRIDE is set to y, the whole bootloader command line will be ignored, which will be useful to work around broken bootloaders. A wrapper to the original common/kernel.c:cmdline_parse() was introduced to complete this task.
---
Changed since v8:
* Changed the CMDLINE's "depends on EXPERT='y'" into a conditional prompt.
--- xen/common/Kconfig | 21 +++++++++++++++++++++ xen/common/kernel.c | 30 ++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 6 deletions(-)
xen/common/Kconfig +21 -0
@@ -237,4 +237,25 @@ config FAST_SYMBOL_LOOKUP The only user of this is Live patching. If unsure, say Y. + +config CMDLINE + string "Built-in hypervisor command string" if EXPERT = "y" + default "" + ---help--- + Enter arguments here that should be compiled into the hypervisor + image and used at boot time. When the system boots, this string + will be parsed prior to the bootloader command line. So if a + non-cumulative option is set both in this string and in the + bootloader command line, only the latter one will take effect. + +config CMDLINE_OVERRIDE + bool "Built-in command line overrides bootloader arguments" + default n + depends on CMDLINE != "" + ---help--- + Set this option to 'Y' to have the hypervisor ignore the bootloader + command line, and use ONLY the built-in command line. + + This is used to work around broken bootloaders. This should + be set to 'N' under normal conditions. endmenu
xen/common/kernel.c +24 -6
@@ -23,6 +23,7 @@enum system_state system_state = SYS_STATE_early_boot;xen_commandline_t saved_cmdline; +static const char __initconst opt_builtin_cmdline[] =CONFIG_CMDLINE ;static void __init assign_integer_param (const struct kernel_param *param,uint64_t val)
@@ -46,18 +47,13 @@ static void __init assign_integer_param( } } -void __init cmdline_parse (const char *cmdline) +static void __init _cmdline_parse (const char *cmdline) {char opt[100 ], *optval, *optkey, *q;const char *p = cmdline;const struct kernel_param *param;int bool_assert; -if ( cmdline ==NULL ) -return ; - -safe_strcpy (saved_cmdline, cmdline); -for ( ; ; ) {/* Skip whitespace. */
@@ -147,6 +143,28 @@ void __init cmdline_parse(const char *cmdline) } } +/** +* cmdline_parse -- parses the xen command line. +* If CONFIG_CMDLINE is set, it would be parsed prior to @cmdline. +* But if CONFIG_CMDLINE_OVERRIDE is set to y, @cmdline will be ignored. +*/ +void __init cmdline_parse (const char *cmdline) +{ +if ( opt_builtin_cmdline[0 ] ) + { +printk ("Built-in command line: %s\n" , opt_builtin_cmdline); +_cmdline_parse (opt_builtin_cmdline); + } + +#ifndef CONFIG_CMDLINE_OVERRIDE +if ( cmdline ==NULL ) +return ; + +safe_strcpy (saved_cmdline, cmdline); +_cmdline_parse (cmdline); +#endif +} +int __init parse_bool (const char *s) { if ( !strcmp("no", s) ||
Signature · 7 lines
2.12.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 23 lines · Zhongze Liu
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/browse/XEN-41)
If CMDLINE is set, it will be parsed prior to the bootloader command line. This order of parsing implies that if any non-cumulative options are set in both CMDLINE and the bootloader command line, only the ones in the latter will take effect. Furthermore, if
CMDLINE_OVERRIDEis set to y, the whole bootloader command line will be ignored, which will be useful to work around broken bootloaders. A wrapper to the original common/kernel.c:cmdline_parse() was introduced to complete this task.Signed-off-by Zhongze Liu <[email protected]>Reviewed-by Jan Beulich <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>Cc Andrew Cooper <[email protected]>Cc George Dunlap <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Konrad Rzeszutek Wilk <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Tim Deegan <[email protected]>Cc Wei Liu <[email protected]>
Quoted 1 line
---
Your previous patch was fixed up by Jan and applied.
In the future please check the staging branch instead of master.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 4 lines
Quoted 1 line
Quoted 1 line · On 21.03.17 at 17:41, <[email protected]> wrote:
Changed since v8:
* Changed the CMDLINE's "depends on EXPERT='y'" into a conditional prompt.
I'm not sure why you've sent this - the patch went in 2 hours ago, and I actually did send you the mail about the problem after fixing it and having pushed.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 26 lines · Wei Liu
Quoted 23 lines · Zhongze Liu
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/browse/XEN-41)
If CMDLINE is set, it will be parsed prior to the bootloader command line. This order of parsing implies that if any non-cumulative options are set in both CMDLINE and the bootloader command line, only the ones in the latter will take effect. Furthermore, if
CMDLINE_OVERRIDEis set to y, the whole bootloader command line will be ignored, which will be useful to work around broken bootloaders. A wrapper to the original common/kernel.c:cmdline_parse() was introduced to complete this task.Signed-off-by Zhongze Liu <[email protected]>Reviewed-by Jan Beulich <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>Cc Andrew Cooper <[email protected]>Cc George Dunlap <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Konrad Rzeszutek Wilk <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Tim Deegan <[email protected]>Cc Wei Liu <[email protected]>Quoted 1 line
---
Quoted 1 line
Your previous patch was fixed up by Jan and applied.
Conghratulations for your first contribution!
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH v6 1/1 xen: Allow a default compiled-in command line using Kconfig
Quoted 33 lines · 2017年3月22日星期三,Stefano Stabellini <[email protected]> 写道:
Quoted 2 lines · Wei Liu
Quoted 1 line · Zhongze Liu
This allows downstreams to set their defaults without modifying the
source code
Quoted 4 lines
Quoted 4 lines
all over the place. Also probably useful for the embedded space. (See Also: https://xenproject.atlassian.net/browse/XEN-41)
If CMDLINE is set, it will be parsed prior to the bootloader command
line.
Quoted 1 line
Quoted 1 line
This order of parsing implies that if any non-cumulative options are
set in
Quoted 1 line
Quoted 1 line
both CMDLINE and the bootloader command line, only the ones in the
latter will
Quoted 2 lines
Quoted 2 lines
take effect. Furthermore, if
CMDLINE_OVERRIDEis set to y, the whole bootloader command line will be ignored, which will be useful to workaround
Quoted 1 line
Quoted 1 line
broken bootloaders. A wrapper to the original
common/kernel.c:cmdline_parse()
Quoted 15 lines
Quoted 14 lines
was introduced to complete this task.
Signed-off-by Zhongze Liu <[email protected]>Reviewed-by Jan Beulich <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>Cc Andrew Cooper <[email protected]>Cc George Dunlap <[email protected]>Cc Ian Jackson <[email protected]>Cc Jan Beulich <[email protected]>Cc Konrad Rzeszutek Wilk <[email protected]>Cc Stefano Stabellini <[email protected]>Cc Tim Deegan <[email protected]>Cc Wei Liu <[email protected]>---
Quoted 4 lines
Quoted 1 line
Your previous patch was fixed up by Jan and applied.
Conghratulations for your first contribution!
Thanks.
I've really learnt a lot here.
This community is awesome.
And Xen rocks!
Cheers!
Zhongze Liu.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel