ia64/xen-unstable

view stubdom/stubdom-dm @ 17042:a905c582a406

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>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Feb 12 14:35:39 2008 +0000 (2008-02-12)
parents
children 2a8eaba24bf0
line source
1 #!/bin/bash
2 #
3 # Copyright 2007-2008 Samuel Thibault <samuel.thibault@eu.citrix.net>
4 #
5 # dm script around stubdomains.
6 #
8 # To fit xterms nicely
9 height=339
11 # Parse arguments
13 domid=
14 domname=
15 vncviewer=0
16 vncpid=
17 while [ "$#" -gt 0 ];
18 do
19 if [ "$#" -ge 2 ];
20 then
21 case "$1" in
22 -d) domid=$2; shift ;;
23 -domain-name) domname=$2; shift ;;
24 -vnc)
25 ip=${2%:*};
26 vnc_port=${2#*:};
27 shift
28 ;;
29 esac
30 fi
31 case "$1" in
32 -vncviewer) vncviewer=1 ;;
33 esac
34 shift
35 done
37 [ -z "$domid" ] && ( echo "couldn't find domain ID" ; exit 1 )
38 [ -z "$domname" ] && ( echo "couldn't find domain name" ; exit 1 )
40 # Termination handler
42 term() {
43 kill %1
44 (
45 [ -n "$vncpid" ] && kill -9 $vncpid
46 xm destroy stubdom-$domname
47 #xm destroy $domname
48 ) &
49 # We need to exit immediately so as to let xend do the commands above
50 exit 0
51 }
53 trap term SIGHUP
55 ############
56 # stubdomain
57 # Wait for any previous stubdom to terminate
58 while xm list | grep stubdom-$domname
59 do
60 sleep 1
61 done
63 creation="xm create -c stubdom-$domname target=$domid memory=32"
65 (while true ; do sleep 60 ; done) | $creation &
66 #xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to shut down ; read" &
67 consolepid=$!
70 while ! vnc_port=`xenstore-read /local/domain/$domid/console/vnc-port`
71 do
72 # Check that the stubdom job is still alive
73 kill -0 $consolepid || term
74 sleep 1
75 done
77 ################
78 # DEBUG: tcpdump
79 #while ! stubdomid=`xm domid stubdom-$domname`
80 #do
81 # sleep 1
82 #done
83 #xterm -geometry 160x25+0+$height -e /bin/sh -c "tcpdump -n -i vif$stubdomid.0" &
84 #xterm -geometry 160x25+0+$((2 * $height)) -e /bin/sh -c "tcpdump -n -i vif$stubdomid.1" &
86 ###########
87 # vncviewer
88 if [ "$vncviewer" = 1 ]
89 then
90 vncviewer $ip:$vnc_port &
91 vncpid=$!
92 fi
94 # wait for SIGHUP or stubdom termination
95 wait $consolepid
97 term