diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-02-12 14:35:39 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-02-12 14:35:39 +0000 |
commit | 0243b256d6187ea610174531607366945e489605 (patch) | |
tree | fd2de9267b7493642626f8c84d7c81ebcd336bed /stubdom/stubdom-dm | |
parent | 67bfbd67d1311a1a590b47e568a07622d4492873 (diff) | |
download | xen-0243b256d6187ea610174531607366945e489605.tar.gz xen-0243b256d6187ea610174531607366945e489605.tar.bz2 xen-0243b256d6187ea610174531607366945e489605.zip |
Add stubdomain support. See stubdom/README for usage details.
- Move PAGE_SIZE and STACK_SIZE into __PAGE_SIZE and __STACK_SIZE in
arch_limits.h so as to permit getting them from there without
pulling all the internal Mini-OS defines.
- Setup a xen-elf cross-compilation environment in stubdom/cross-root
- Add a POSIX layer on top of Mini-OS by linking against the newlib C
library and lwIP, and implementing the Unixish part in mini-os/lib/sys.c
- Cross-compile zlib and libpci too.
- Add an xs.h-compatible layer on top of Mini-OS' xenbus.
- Cross-compile libxc with an additional xc_minios.c and a few things
disabled.
- Cross-compile ioemu with an additional block-vbd, but without sound,
tpm and other details. A few hacks are needed:
- Align ide and scsi buffers at least on sector size to permit
direct transmission to the block backend. While we are at it, just
page-align it to possibly save a segment. Also, limit the scsi
buffer size because of limitations of the block paravirtualization
protocol.
- Allocate big tables dynamically rather that letting them go to
bss: when Mini-OS gets installed in memory, bss is not lazily
allocated, and doing so during Mini-OS is unnecessarily trick while
we can simply use malloc.
- Had to change the Mini-OS compilation somehow, so as to export
Mini-OS compilation flags to the Makefiles of libxc and ioemu.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
Diffstat (limited to 'stubdom/stubdom-dm')
-rw-r--r-- | stubdom/stubdom-dm | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/stubdom/stubdom-dm b/stubdom/stubdom-dm new file mode 100644 index 0000000000..3edeb9d2dc --- /dev/null +++ b/stubdom/stubdom-dm @@ -0,0 +1,97 @@ +#!/bin/bash +# +# Copyright 2007-2008 Samuel Thibault <samuel.thibault@eu.citrix.net> +# +# dm script around stubdomains. +# + +# To fit xterms nicely +height=339 + +# Parse arguments + +domid= +domname= +vncviewer=0 +vncpid= +while [ "$#" -gt 0 ]; +do + if [ "$#" -ge 2 ]; + then + case "$1" in + -d) domid=$2; shift ;; + -domain-name) domname=$2; shift ;; + -vnc) + ip=${2%:*}; + vnc_port=${2#*:}; + shift + ;; + esac + fi + case "$1" in + -vncviewer) vncviewer=1 ;; + esac + shift +done + +[ -z "$domid" ] && ( echo "couldn't find domain ID" ; exit 1 ) +[ -z "$domname" ] && ( echo "couldn't find domain name" ; exit 1 ) + +# Termination handler + +term() { + kill %1 + ( + [ -n "$vncpid" ] && kill -9 $vncpid + xm destroy stubdom-$domname + #xm destroy $domname + ) & + # We need to exit immediately so as to let xend do the commands above + exit 0 +} + +trap term SIGHUP + +############ +# stubdomain +# Wait for any previous stubdom to terminate +while xm list | grep stubdom-$domname +do + sleep 1 +done + +creation="xm create -c stubdom-$domname target=$domid memory=32" + +(while true ; do sleep 60 ; done) | $creation & +#xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to shut down ; read" & +consolepid=$! + + +while ! vnc_port=`xenstore-read /local/domain/$domid/console/vnc-port` +do + # Check that the stubdom job is still alive + kill -0 $consolepid || term + sleep 1 +done + +################ +# DEBUG: tcpdump +#while ! stubdomid=`xm domid stubdom-$domname` +#do +# sleep 1 +#done +#xterm -geometry 160x25+0+$height -e /bin/sh -c "tcpdump -n -i vif$stubdomid.0" & +#xterm -geometry 160x25+0+$((2 * $height)) -e /bin/sh -c "tcpdump -n -i vif$stubdomid.1" & + +########### +# vncviewer +if [ "$vncviewer" = 1 ] +then + vncviewer $ip:$vnc_port & + vncpid=$! +fi + +# wait for SIGHUP or stubdom termination +wait $consolepid + +term |