[or-cvs] r16631: {torvm} Add support for passing kernel command line via stdin to qem (in torvm/trunk/build/win32: . patches)
coderman at seul.org
coderman at seul.org
Sat Aug 23 02:42:08 UTC 2008
Author: coderman
Date: 2008-08-22 22:42:08 -0400 (Fri, 22 Aug 2008)
New Revision: 16631
Added:
torvm/trunk/build/win32/patches/qemu-kernel-cmdline-from-stdin.patch
Modified:
torvm/trunk/build/win32/Makefile
Log:
Add support for passing kernel command line via stdin to qemu. Allows things like control port password to reside in memory and not visible on process listing as arguments
Modified: torvm/trunk/build/win32/Makefile
===================================================================
--- torvm/trunk/build/win32/Makefile 2008-08-23 02:39:21 UTC (rev 16630)
+++ torvm/trunk/build/win32/Makefile 2008-08-23 02:42:08 UTC (rev 16631)
@@ -5,12 +5,10 @@
export SHELL
DLCMD=scripts/download.sh
-ifeq (,$(WDLDIR))
- WDLDIR=dl
-endif
ifeq (,$(ISODIR))
ISODIR=iso
endif
+override ISODIR:=$(realpath $(ISODIR))
# various utilities are downloaded and packaged into an ISO image
# with an autorun.inf that launches a build of all the win32 parts.
@@ -178,7 +176,7 @@
gzip -d $(ISODIR)/add/hdd.img.gz; \
cp files/fstab $(ISODIR)/bin/; \
cp files/buildall.sh $(ISODIR)/dl/src; \
- cp patches/qemu-winpcap-0.9.1.patch $(ISODIR)/dl/src; \
+ cp patches/* $(ISODIR)/dl/src; \
unzip $(WDLDIR)/$(ZLIB_F) -d $(ISODIR)/ bin/zlib1.dll; \
unzip $(WDLDIR)/$(GZIP_F) -d $(ISODIR)/ bin/gzip.exe; \
unzip $(WDLDIR)/$(BZIP2_F) -d $(ISODIR)/ bin/bzip2.exe bin/bzip2.dll; \
Added: torvm/trunk/build/win32/patches/qemu-kernel-cmdline-from-stdin.patch
===================================================================
--- torvm/trunk/build/win32/patches/qemu-kernel-cmdline-from-stdin.patch (rev 0)
+++ torvm/trunk/build/win32/patches/qemu-kernel-cmdline-from-stdin.patch 2008-08-23 02:42:08 UTC (rev 16631)
@@ -0,0 +1,62 @@
+diff -Naur orig-qemu-0.9.1/vl.c mod-qemu-0.9.1/vl.c
+--- orig-qemu-0.9.1/vl.c 2008-01-06 19:38:42.000000000 +0000
++++ mod-qemu-0.9.1/vl.c 2008-08-23 01:58:11.042129035 +0000
+@@ -7582,6 +7582,7 @@
+ "Linux boot specific:\n"
+ "-kernel bzImage use 'bzImage' as kernel image\n"
+ "-append cmdline use 'cmdline' as kernel command line\n"
++ "-appendstdin read from stdin for kernel command line\n"
+ "-initrd file use 'file' as initial ram disk\n"
+ "\n"
+ "Debug/Expert options:\n"
+@@ -7719,6 +7720,7 @@
+ QEMU_OPTION_old_param,
+ QEMU_OPTION_clock,
+ QEMU_OPTION_startdate,
++ QEMU_OPTION_appendstdin,
+ };
+
+ typedef struct QEMUOption {
+@@ -7827,6 +7829,7 @@
+ #endif
+ { "clock", HAS_ARG, QEMU_OPTION_clock },
+ { "startdate", HAS_ARG, QEMU_OPTION_startdate },
++ { "appendstdin", 0, QEMU_OPTION_appendstdin },
+ { NULL },
+ };
+
+@@ -7869,6 +7872,24 @@
+ }
+ }
+
++#define MAX_KERNEL_CMDLN 32768
++static char * read_stdin(void)
++{
++ int bufsz = MAX_KERNEL_CMDLN;
++ char * parms = NULL;
++ int cnt;
++
++ parms = qemu_mallocz(sizeof(MAX_KERNEL_CMDLN));
++ if (!parms)
++ return NULL;
++ cnt = read(0, parms, bufsz-1);
++ /* probably not necessary due to mallocz, but just to be safe... */
++ parms[cnt] = 0;
++
++ /* don't know when this can be free'd; let process exit sort it out */
++ return parms;
++}
++
+ /* XXX: currently we cannot use simultaneously different CPUs */
+ static void register_machines(void)
+ {
+@@ -8316,6 +8337,9 @@
+ case QEMU_OPTION_append:
+ kernel_cmdline = optarg;
+ break;
++ case QEMU_OPTION_appendstdin:
++ kernel_cmdline = read_stdin();
++ break;
+ case QEMU_OPTION_cdrom:
+ drive_add("file=\"%s\"," CDROM_ALIAS, optarg);
+ break;
More information about the tor-commits
mailing list