From: Chunyan Liu <cyliu@suse.com>
To: xen-devel@lists.xensource.com, qemu-devel@nongnu.org
Cc: Chunyan Liu <cyliu@suse.com>,
Ian.Jackson@eu.citrix.com, Ian.Campbell@citrix.com,
stefano.stabellini@eu.citrix.com
Subject: [Qemu-devel] [RFC PATCH V5 2/3] xl.cfg: add 'cmdline' in config file
Date: Mon, 7 Jul 2014 14:34:34 +0800 [thread overview]
Message-ID: <1404714875-24362-3-git-send-email-cyliu@suse.com> (raw)
In-Reply-To: <1404714875-24362-1-git-send-email-cyliu@suse.com>
Currently in xl.cfg, use 'root' and 'extra' to generate the command
line. 'cmdline' could be a more generic equivalent. So, add 'cmdline'
in xl.cfg and let it be preferred. 'root' and 'extra' still works.
But when 'cmdline' is specified, 'root' and 'extra' will be ignored.
[HVM config example]
[snip]
builder="hvm"
device_model_override="/home/cyliu/git/qemu/x86_64-softmmu/qemu-system-x86_64"
kernel="/mnt/vmlinuz-3.0.13-0.27-default"
ramdisk="/mnt/initrd-3.0.13-0.27-default"
root="/dev/hda2"
extra="console=tty0 console=ttyS0"
[snip]
or:
[snip]
builder="hvm"
device_model_override="/home/cyliu/git/qemu/x86_64-softmmu/qemu-system-x86_64"
kernel="/mnt/vmlinuz-3.0.13-0.27-default"
ramdisk="/mnt/initrd-3.0.13-0.27-default"
cmdline="root=/dev/hda2 console=tty0 console=ttyS0"
[snip]
Signed-off-by: Chunyan Liu <cyliu@suse.com>
---
Changes:
- add back the 'cmdline' in xl.cfg, but as separate patch
docs/man/xl.cfg.pod.5 | 7 +++++++
tools/libxl/xl_cmdimpl.c | 20 ++++++++++++++------
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index c4a6589..cb5b76b 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -323,6 +323,13 @@ Load the specified file as the kernel image.
Load the specified file as the ramdisk.
+=item B<cmdline="STRING">
+
+Append B<cmdline="STRING"> to the kernel command line. (Note: it is
+guest specific what meaning this has). It can replace B<root="STRING">
+plus B<extra="STRING"> and is preferred. When B<cmdline="STRING"> is set,
+B<root="STRING"> and B<extra="STRING"> will be ignored.
+
=item B<root="STRING">
Append B<root="STRING"> to the kernel command line (Note: it is guest
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index d4cd50b..cfe13e3 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -693,19 +693,27 @@ static void parse_top_level_sdl_options(XLU_Config *config,
static char *parse_cmdline(XLU_Config *config)
{
char *cmdline = NULL;
- const char *root = NULL, *extra = "";
+ const char *root = NULL, *extra = NULL, *buf = NULL;
+ xlu_cfg_get_string (config, "cmdline", &buf, 0);
xlu_cfg_get_string (config, "root", &root, 0);
xlu_cfg_get_string (config, "extra", &extra, 0);
- if (root) {
- if (asprintf(&cmdline, "root=%s %s", root, extra) == -1)
- cmdline = NULL;
+ if (buf) {
+ cmdline = strdup(buf);
+ if (root || extra)
+ fprintf(stderr, "Warning: ignoring root= and extra= "
+ "in favour of cmdline=\n");
} else {
- cmdline = strdup(extra);
+ if (root) {
+ if (asprintf(&cmdline, "root=%s %s", root, extra) == -1)
+ cmdline = NULL;
+ } else if (extra) {
+ cmdline = strdup(extra);
+ }
}
- if ((root || extra) && !cmdline) {
+ if ((buf || root || extra) && !cmdline) {
fprintf(stderr, "Failed to allocate memory for cmdline\n");
exit(1);
}
--
1.8.4.5
next prev parent reply other threads:[~2014-07-07 6:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-07 6:34 [Qemu-devel] [RFC PATCH V5 0/3] Support xen HVM direct kernel boot Chunyan Liu
2014-07-07 6:34 ` [Qemu-devel] [RFC PATCH V5 1/3] xen: pass kernel initrd to qemu Chunyan Liu
2014-07-10 14:48 ` Ian Campbell
2014-11-27 18:14 ` [Qemu-devel] [for 4.5] missing chunk in 11dffa2359e8a2629490c14c029c7c7c777b3e47 Stefano Stabellini
2014-11-28 6:03 ` Chun Yan Liu
2014-07-07 6:34 ` Chunyan Liu [this message]
2014-07-10 14:49 ` [Qemu-devel] [RFC PATCH V5 2/3] xl.cfg: add 'cmdline' in config file Ian Campbell
2014-07-07 6:34 ` [Qemu-devel] [RFC PATCH V5 3/3] qemu: support xen hvm direct kernel boot Chunyan Liu
2014-07-10 15:12 ` [Qemu-devel] [RFC PATCH V5 0/3] Support xen HVM " Ian Campbell
2014-07-10 15:14 ` Stefano Stabellini
2014-08-04 17:26 ` Stefano Stabellini
2014-08-26 21:02 ` Ian Campbell
2014-08-27 3:26 ` Chun Yan Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404714875-24362-3-git-send-email-cyliu@suse.com \
--to=cyliu@suse.com \
--cc=Ian.Campbell@citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).