Thursday, June 16, 2011

Install Xen3.3.0 on VMware workstation 7.1

When testing my new xen hypervisor scheduling algorighm, I often got hang issues when debugging.
Then I am thinking: why not install hypervisor on vmware workstation.

Several steps:

1. Install workstation

2. Create Vmware guest using ubuntu 8.0.4(hardy) iso images

3. boot up guest, under the guest os, download xen3.3.0 source code

4. make world; make install(need to install a lot of tools before this)
apt-get install bcc bin86 gawk bridge-utils iproute libcurl3 libcurl4-openssl-dev bzip2 module-init-tools transfig tgif texinfo pciutils-dev mercurial build-essential make gcc libc6-dev zlib1g-dev python python-dev python-twisted libncurs
es5-dev patch libvncserver-dev libsdl-dev libjpeg62-dev


5. using mkinitramfs to create init fs

# depmod 2.6.18.8-xen
# mkinitramfs -o initrd-2.6.18.8-xen.img 2.6.18.8-xen



6 Add
title xen 3.3
root (hd0,0)
kernel /boot/xen-3.3.0.gz
#module /boot/vmlinuz-2.6.18.8-xen root=UUID=79cf418b-8975-4041-8d74-345f5728b363 ro quiet splash console=tty0
module /boot/vmlinuz-2.6.18.8-xen root=/dev/sda1 ro quiet splash console=tty0
module /boot/initrd.img-2.6.18.8-xen

to /boot/grub/menu.lst

7. Boot up Xen


8. apt-get install xen-tools
modify /etc/xen-tools/xen-tools.conf
choose lenny, and other adjustments you want.


9. sudo xen-create-image --ip 192.168.92.3 --hostname=vm0

10. sudo xm create -c vm0.cfg


most likely guest stuck at crond, add "xencons=tty" in /home/xen/vm0.cfg at extras line.

Friday, June 10, 2011

Create and apply patch

The diff program can be used to compare two files and to make patches. A typical
example might be

diff -ruN file.old file.new > file.diff

If you want to apply the patch to one file, modify the diff file first few lines
as
--- a/frameworks/base/core/java/android/webkit/WebView.java 2011-05-31 16:41
:46.985618991 -0400
+++ b/frameworks/base/core/java/android/webkit/WebView.java 2011-06-10 14:09
:28.513675152 -0400


This command will create a diff (recursively if directories are used) that shows

the changes, or "delta", between the two files.


To apply the patch created above, we can invoke

patch --dry-run -p1 -i file.diff.

patch -p1 -i file.diff.


The -p tells patch how much it should strip from the paths for the file names in

the patch. -p0 means to strip nothing, or leave the path intact.



For example, supposing the file name in the patch file was

/u/howard/src/blurfl/blurfl.c

setting -p0 gives the entire file name unmodified, -p1 gives

u/howard/src/blurfl/blurfl.c

without the leading slash, -p4 gives

blurfl/blurfl.c

and not specifying -p at all just gives you blurfl.c.