ia64/xen-unstable

view tools/misc/xen-clone @ 2834:60b89851a69a

bitkeeper revision 1.1159.151.1 (418803bcQsPRkzzuqVsajF6mgmahFw)

Update xen-clone to cope with the new install tar ball
author iap10@labyrinth.cl.cam.ac.uk
date Tue Nov 02 22:01:32 2004 +0000 (2004-11-02)
parents 11be1dfb262b
children 1d309996ebfd
line source
1 #!/bin/sh -x
3 # usage: xen-clone bk_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:-/usr/groups/xeno/BK/xeno.bk}
14 # BK_REP=${1:-xeno-master/xeno.bk}
15 LINUX_DIR=${3:-/usr/groups/xeno/archive/}
16 ;;
17 *)
18 BK_REP=${1:-bk://xen.bkbits.net/xeno-1.0.bk}
19 # BK_REP=${1:-ssh://xen@xen.bkbits.net/xeno-1.0.bk}
20 LINUX_DIR=${3:-.:..}
21 ;;
22 esac
24 DEST_DIR=${2:-xeno-clone}
25 DEST_BK_REP=`basename "${BK_REP}"`
26 DEST_VER=`basename ${DEST_BK_REP} .bk`
28 echo usage: xen-clone bk_repository dest_dir orig_linux_dir
29 echo Source BK Repository : ${BK_REP}
30 echo Destination Dir/Repository : ${DEST_DIR}/${DEST_BK_REP}
31 echo Pristine Linux Source directory : ${LINUX_DIR}
33 mkdir -p ${DEST_DIR}
34 cd ${DEST_DIR}
35 TOP=`/bin/pwd`
37 # site-specific set up of installation directories
38 case "$SITE" in
39 UCCL)
40 PATH=$PATH:/usr/groups/xeno/build_tools/bin
41 mkdir ${DEST_VER}-install
42 ln -s ${DEST_VER}-install install
43 mkdir -p install/boot
44 cd install/boot
45 ln -sf ../../../xeno-roots/roots .
46 ln -sf ../../../xeno-roots/usr .
47 ln -sf ../lib .
48 ln -sf ../bin .
49 ln -sf /usr/groups/srgboot/${USER}/xenoboot.sh .
50 ln -sf `pwd` /usr/groups/srgboot/${USER}/${DEST_DIR}
51 ln -sf xen.gz image.gz
52 cd ../..
53 ;;
54 esac
56 # clone the master repository (now checked-out by default)
57 if [ ! -d ${DEST_BK_REP} ]
58 then
59 bk clone ${BK_REP} ${DEST_BK_REP}
60 else
61 cd ${DEST_BK_REP}
62 bk pull
63 cd ${TOP}
64 fi
67 if [ -d ${DEST_BK_REP}/linux-2.4.*-xen-sparse ]
68 then
69 # this is a new style Xen repository so building is dead easy
71 export LINUX_SRC_PATH=${LINUX_DIR}
73 cd ${DEST_BK_REP}
74 ln -sf ../install install
75 make -j4 world
76 make -j4 linux24
77 cd ../install/boot
78 [ -r vmlinuz-2.6.*-xen0 ] && ln -s vmlinuz-2.6.*-xen0 xenolinux.gz
80 else
81 # old style repository without 'make world'
84 # identify this version of linux
85 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!'`
87 if [ -z "${LINUX_VER}" ]
88 then
89 echo Unable to identify Linux version. Bailing.
90 exit -1
91 fi
93 # copy in the master Linux tree for this kernel
94 if [ ! -d linux-${LINUX_VER} ]
95 then
96 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
97 fi
99 # build and install Xen and tools
100 cd ${DEST_BK_REP}
101 make dist || make install
103 # Turn linux into xenolinux then build it
104 cd xenolinux-${LINUX_VER}-sparse
105 ./mkbuildtree ../../linux-${LINUX_VER}
106 cd ../..
107 mv linux-${LINUX_VER} xenolinux-${LINUX_VER}
108 cd xenolinux-${LINUX_VER}
110 # cope with the change from ARCH=xeno to ARCH=xen
111 cd arch; XEN=`/bin/ls -d xen*`; cd ..
113 # built it all
114 ARCH=$XEN make oldconfig
115 ARCH=$XEN make dep
116 ARCH=$XEN make bzImage
117 ARCH=$XEN make dist || ARCH=xen make install
118 ARCH=$XEN make modules
119 ARCH=$XEN make INSTALL_MOD_PATH=${TOP}/install modules_install
120 cd ..
122 fi