ia64/xen-unstable

view tools/misc/xen-clone @ 1808:e6bff1f485f8

bitkeeper revision 1.1100 (40f77573CvU9GWZuhmX5Moolj6ljnQ)

xen-clone fix
author iap10@labyrinth.cl.cam.ac.uk
date Fri Jul 16 06:28:03 2004 +0000 (2004-07-16)
parents 225b184bd62d
children 94e737d8be1b
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}"`
27 echo usage: xen-clone bk_repository dest_dir orig_linux_dir
28 echo Source BK Repository : ${BK_REP}
29 echo Destination Dir/Repository : ${DEST_DIR}/${DEST_BK_REP}
30 echo Pristine Linux Source directory : ${LINUX_DIR}
32 mkdir -p ${DEST_DIR}
33 cd ${DEST_DIR}
34 TOP=`/bin/pwd`
36 # site-specific set up of installation directories
37 case "$SITE" in
38 UCCL)
39 PATH=$PATH:/usr/groups/xeno/build_tools/bin
40 mkdir -p install/boot
41 cd install/boot
42 ln -sf ../../../xeno-roots/roots .
43 ln -sf ../../../xeno-roots/usr .
44 ln -sf ../lib .
45 ln -sf ../bin .
46 ln -sf /usr/groups/srgboot/${USER}/xenoboot.sh .
47 ln -sf `pwd` /usr/groups/srgboot/${USER}/${DEST_DIR}
48 ln -sf xen.gz image.gz
49 cd ../..
50 ;;
51 esac
53 # clone the master repository (now checked-out by default)
54 if [ ! -d ${DEST_BK_REP} ]
55 then
56 bk clone ${BK_REP} ${DEST_BK_REP}
57 else
58 cd ${DEST_BK_REP}
59 bk pull
60 cd ${TOP}
61 fi
64 if [ -d ${DEST_BK_REP}/linux-*-xen-sparse ]
65 then
66 # this is a new style Xen repository so building is dead easy
68 LINUX_VER=`( /bin/ls -ld ${DEST_BK_REP}/*linux-2.4.*-xen-sparse ) 2>/dev/null | sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!'`
70 if [ -e ${LINUX_DIR}/linux-${LINUX_VER}.tar.gz ]
71 then
72 export LINUX_SRC=${LINUX_DIR}/linux-${LINUX_VER}.tar.gz
73 fi
75 cd ${DEST_BK_REP}
76 ln -sf ../install install
77 make -j4 world
78 cd ../install/boot
79 [ -r vmlinuz-${LINUX_VER}-xen0 ] && ln -s vmlinuz-${LINUX_VER}-xen0 xenolinux.gz
81 else
82 # old style repository without 'make world'
85 # identify this version of linux
86 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!'`
88 if [ -z "${LINUX_VER}" ]
89 then
90 echo Unable to identify Linux version. Bailing.
91 exit -1
92 fi
94 # copy in the master Linux tree for this kernel
95 if [ ! -d linux-${LINUX_VER} ]
96 then
97 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
98 fi
100 # build and install Xen and tools
101 cd ${DEST_BK_REP}
102 make dist || make install
104 # Turn linux into xenolinux then build it
105 cd xenolinux-${LINUX_VER}-sparse
106 ./mkbuildtree ../../linux-${LINUX_VER}
107 cd ../..
108 mv linux-${LINUX_VER} xenolinux-${LINUX_VER}
109 cd xenolinux-${LINUX_VER}
111 # cope with the change from ARCH=xeno to ARCH=xen
112 cd arch; XEN=`/bin/ls -d xen*`; cd ..
114 # built it all
115 ARCH=$XEN make oldconfig
116 ARCH=$XEN make dep
117 ARCH=$XEN make bzImage
118 ARCH=$XEN make dist || ARCH=xen make install
119 ARCH=$XEN make modules
120 ARCH=$XEN make INSTALL_MOD_PATH=${TOP}/install modules_install
121 cd ..
123 fi