summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-22 11:52:52 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-09-22 11:52:52 -0400
commit5ec00aab69673833ed82d33b132e1e54d5401249 (patch)
tree0b203f4ce1408d221df85880ce2a3f8b8b08eb66
parentf03d628e1e8bcdbf36aa28e23ca5266e7bafef12 (diff)
Add KVM helper scripts.
Useful for pushing and pull files, as well as launching kernels.
-rwxr-xr-xkvm-pull-traces.sh25
-rwxr-xr-xkvm-push-liblitmus.sh25
-rwxr-xr-xkvm-run-kernel.sh48
-rw-r--r--sample-config/litmus-kvm16
4 files changed, 114 insertions, 0 deletions
diff --git a/kvm-pull-traces.sh b/kvm-pull-traces.sh
new file mode 100755
index 0000000..f823360
--- /dev/null
+++ b/kvm-pull-traces.sh
@@ -0,0 +1,25 @@
1#!/bin/bash
2#
3# Simple script to download files from a KVM image to the local system.
4# Originally written by Andrea Bastoni.
5# Config file support added by Bjoern Brandenburg.
6
7SSH_PORT=2222 # default
8SSH_USER=root # what to log in as
9SSH_HOST=localhost # where is the forwarded port?
10DATA_DIR="~/liblitmus2010/" # where are the traces in the image?
11FILE_GLOB="test*.bin" # which files to copy
12DOWNLOADS=. # where to copy the files
13
14# include config file
15[ -f ~/.litmus_kvm ] && source ~/.litmus_kvm
16
17#SRC="${SSH_USER}@${SSH_HOST}:${DATA_DIR}${FILE_GLOB}"
18#echo scp -P $SSH_PORT ${SRC} ${DOWNLOADS}
19#scp -P $SSH_PORT ${SRC} ${DOWNLOADS}
20
21
22CMD="ssh -l ${SSH_USER} -p ${SSH_PORT}"
23SRC="${SSH_HOST}:${DATA_DIR}${FILE_GLOB}"
24echo rsync -ah -z --progress -e "$CMD" ${SRC} ${DOWNLOADS}
25rsync -ah -z --progress -e "$CMD" ${SRC} ${DOWNLOADS}
diff --git a/kvm-push-liblitmus.sh b/kvm-push-liblitmus.sh
new file mode 100755
index 0000000..0073efd
--- /dev/null
+++ b/kvm-push-liblitmus.sh
@@ -0,0 +1,25 @@
1#!/bin/bash
2
3#
4# Simple script to push a compiled version of liblitmus2010 to a KVM instance.
5# Originally written by Andrea Bastoni.
6# Config file support added by Bjoern Brandenburg.
7
8SSH_PORT=2222 # default
9SSH_USER=root # what to log in as
10SSH_HOST=localhost # where is the forwarded port?
11HOST_LIBLITMUS_DIR="~/liblitmus2010" # where is the compilation unit
12KVM_WORKSPACE="~/" # where to copy the files
13
14# include config file
15[ -f ~/.litmus_kvm ] && source ~/.litmus_kvm
16
17#SRC="${SSH_USER}@${SSH_HOST}:${DATA_DIR}${FILE_GLOB}"
18#echo scp -P $SSH_PORT ${SRC} ${DOWNLOADS}
19#scp -P $SSH_PORT ${SRC} ${DOWNLOADS}
20
21
22CMD="ssh -l ${SSH_USER} -p ${SSH_PORT}"
23TARGET="${SSH_HOST}:${KVM_WORKSPACE}"
24echo rsync -ah -z --progress -e "$CMD" ${HOST_LIBLITMUS_DIR} ${TARGET}
25rsync -ah -z --progress -e "$CMD" ${HOST_LIBLITMUS_DIR} ${TARGET}
diff --git a/kvm-run-kernel.sh b/kvm-run-kernel.sh
new file mode 100755
index 0000000..5470ba5
--- /dev/null
+++ b/kvm-run-kernel.sh
@@ -0,0 +1,48 @@
1#!/bin/bash
2# Launch a kernel with GDB support.
3# Originally written by Andrea Bastoni.
4# Config file support and option parsing added by Bjoern Brandenburg.
5
6function info() {
7 echo "(ii) $*"
8}
9
10while true
11do
12 case $1 in
13 --gdb)
14 shift
15 WANT_GDB=1
16 ;;
17 *) # unknown argument
18 break
19 ;;
20 esac
21done
22
23if [ $# -lt 2 ]; then
24 echo "Usage: run_kvm [--gdb] <vmlinuz> <nr cpu> [other kernel parameters]"
25 exit 1
26fi
27
28SSH_PORT=2222 # default
29GDB_PORT=6666 # override in config file
30KVM_IMAGE=~/kvm_debian_images/debian_amd64_lib.qcow2
31
32# include config file
33[ -f ~/.litmus_kvm ] && source ~/.litmus_kvm
34
35info "Simulating $2 CPUs."
36info "Running on top of image ${KVM_IMAGE}."
37info "Launching kernel $1."
38info "Redirecting SSH to port ${SSH_PORT}."
39
40if [ ! -z "$WANT_GDB" ]
41then
42 info "Opening remote GDB port ${GDB_PORT}."
43 GDB_OPT="-gdb tcp::${GDB_PORT} -S"
44else
45 GDB_OPT=
46fi
47
48qemu-system-x86_64 ${GDB_OPT} -smp $2 -cpu core2duo -hda ${KVM_IMAGE} -m 2000 -net nic,model=e1000 -net user -k en-us -kernel $1 -append "console=ttyS0 root=/dev/hda1 $3" ro -nographic -serial stdio -redir tcp:${SSH_PORT}::22
diff --git a/sample-config/litmus-kvm b/sample-config/litmus-kvm
new file mode 100644
index 0000000..b724a85
--- /dev/null
+++ b/sample-config/litmus-kvm
@@ -0,0 +1,16 @@
1# Simple Litmus KVM tools config file.
2# Copy this to ~/.litmus_kvm
3
4# how to connect to the VM
5SSH_PORT=1234 # CHANGE THIS
6GDB_PORT=4321 # CHANGE THIS
7SSH_HOST=localhost
8
9# for pull
10DATA_DIR="~/liblitmus2010/traces/"
11FILE_GLOB="*"
12DOWNLOADS=~/downloads
13
14# for push
15HOST_LIBLITMUS_DIR=~/dev/liblitmus2010
16KVM_WORKSPACE="~/"