ia64/xen-unstable

view tools/misc/xen-clone @ 6946:e703abaf6e3d

Add behaviour to the remove methods to remove the transaction's path itself. This allows us to write Remove(path) to remove the specified path rather than having to slice the path ourselves.
author emellor@ewan
date Sun Sep 18 14:42:13 2005 +0100 (2005-09-18)
parents a83ac0806d6b
children 3c05406f5e0a
line source
1 #!/bin/sh -x
3 # usage: xen-clone hg_repository dest_dir orig_linux_dir
4 #
5 # this script contains some CL site specific details, but can easily be adapted
6 #
8 # test which site we're on
9 [ -d /usr/groups/xeno/ -a -d /usr/groups/srgboot ] && SITE=UCCL
11 case "$SITE" in
12 UCCL)
13 BK_REP=${1:-http://hg.srg.cl.cam.ac.uk/xen-unstable.hg}
14 LINUX_DIR=${3:-/usr/groups/xeno/archive/}
15 ;;
16 *)
17 BK_REP=${1:-http://xenbits.xensource.com/xen-unstable.hg}
18 LINUX_DIR=${3:-.:..}
19 ;;
20 esac
22 DEST_DIR=${2:-xeno-clone}
23 DEST_BK_REP=`basename "${BK_REP}"`
24 DEST_VER=`basename ${DEST_BK_REP} .hg`
26 echo usage: xen-clone hg dest_dir orig_linux_dir
27 echo Source BK Repository : ${BK_REP}
28 echo Destination Dir/Repository : ${DEST_DIR}/${DEST_BK_REP}
29 echo Pristine Linux Source directory : ${LINUX_DIR}
31 mkdir -p ${DEST_DIR}
32 cd ${DEST_DIR}
33 TOP=`/bin/pwd`
35 # site-specific set up of installation directories
36 case "$SITE" in
37 UCCL)
38 PATH=$PATH:/usr/groups/xeno/build_tools/bin
39 mkdir -p install/boot
40 cd install/boot
41 ln -sf ../../../xeno-roots/roots .
42 ln -sf ../../../xeno-roots/usr .
43 ln -sf ../lib .
44 ln -sf ../bin .
45 ln -sf /usr/groups/srgboot/${USER}/xenoboot.sh .
46 ln -sf `pwd` /usr/groups/srgboot/${USER}/${DEST_DIR}
47 ln -sf xen.gz image.gz
48 cd ../..
49 ;;
50 esac
52 # clone the master repository (now checked-out by default)
53 if [ ! -d ${DEST_BK_REP} ]
54 then
55 mkdir -p ${DEST_BK_REP} ; cd ${DEST_BK_REP} ; hg init ${BK_REP} ; hg co ; cd ${TOP}
56 else
57 cd ${DEST_BK_REP}
58 hg pull ; hg co
59 cd ${TOP}
60 fi
63 if [ -d ${DEST_BK_REP}/linux-2.4*-xen-sparse ]
64 then
65 # this is a new style Xen repository so building is dead easy
67 export LINUX_SRC_PATH=${LINUX_DIR}
69 cd ${DEST_BK_REP}
71 # Recent repositories install into 'dist/install' rather than 'install'.
72 if [ -f install.sh ]
73 then
74 mkdir -p dist
75 ln -sf ../../install dist/install
76 else
77 ln -sf ../install install
78 fi
80 make -j4 KERNELS=linux-* world
81 #make -j4 linux24
82 cd ../install/boot
83 if [ -r vmlinuz-2.6-xen0 ]
84 then
85 ln -s vmlinuz-2.6-xen0 xenolinux.gz
86 else
87 kern=`ls vmlinuz-2.6.*-xen0 | head -1`
88 [ -r "$kern" ] && ln -s "$kern" xenolinux.gz
89 fi
91 else
92 # old style repository without 'make world'
95 # identify this version of linux
96 LINUX_VER=`( /bin/ls -ld ${DEST_BK_REP}/*xenolinux-sparse || /bin/ls -ld ${DEST_BK_REP}/*xenolinux-*-sparse ) 2>/dev/null | sed -e 's!^.*xenolinux-\(.\+\)-sparse!\1!'`
98 if [ -z "${LINUX_VER}" ]
99 then
100 echo Unable to identify Linux version. Bailing.
101 exit -1
102 fi
104 # copy in the master Linux tree for this kernel
105 if [ ! -d linux-${LINUX_VER} ]
106 then
107 tar -jxf ${LINUX_DIR}/linux-${LINUX_VER}.tar.bz2 || tar -zxf ${LINUX_DIR}/linux-${LINUX_VER}.tar.gz || tar -zxf ${LINUX_DIR}/linux-${LINUX_VER}.tgz || cp -a ${LINUX_DIR}/linux-${LINUX_VER} . || wget ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-${LINUX_VER}.tar.gz -O- | tar -zxf - || exit -1
108 fi
110 # build and install Xen and tools
111 cd ${DEST_BK_REP}
112 make dist || make install
114 # Turn linux into xenolinux then build it
115 cd xenolinux-${LINUX_VER}-sparse
116 ./mkbuildtree ../../linux-${LINUX_VER}
117 cd ../..
118 mv linux-${LINUX_VER} xenolinux-${LINUX_VER}
119 cd xenolinux-${LINUX_VER}
121 # cope with the change from ARCH=xeno to ARCH=xen
122 cd arch; XEN=`/bin/ls -d xen*`; cd ..
124 # built it all
125 ARCH=$XEN make oldconfig
126 ARCH=$XEN make dep
127 ARCH=$XEN make bzImage
128 ARCH=$XEN make dist || ARCH=xen make install
129 ARCH=$XEN make modules
130 ARCH=$XEN make INSTALL_MOD_PATH=${TOP}/install modules_install
131 cd ..
133 fi