ia64/xen-unstable

view tools/misc/xen-clone @ 4920:64f9e006da57

bitkeeper revision 1.1410 (4286de1dJ_YgvFcDITt_LZ4LXBdTXA)

Merge freefall.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-2.0-testing.bk
into freefall.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
author iap10@freefall.cl.cam.ac.uk
date Sun May 15 05:29:01 2005 +0000 (2005-05-15)
parents 0a4b76b6b5a0 eeffc4961eee
children 8041c2fa1cbc
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 -p install/boot
42 cd install/boot
43 ln -sf ../../../xeno-roots/roots .
44 ln -sf ../../../xeno-roots/usr .
45 ln -sf ../lib .
46 ln -sf ../bin .
47 ln -sf /usr/groups/srgboot/${USER}/xenoboot.sh .
48 ln -sf `pwd` /usr/groups/srgboot/${USER}/${DEST_DIR}
49 ln -sf xen.gz image.gz
50 cd ../..
51 ;;
52 esac
54 # clone the master repository (now checked-out by default)
55 if [ ! -d ${DEST_BK_REP} ]
56 then
57 bk clone ${BK_REP} ${DEST_BK_REP}
58 else
59 cd ${DEST_BK_REP}
60 bk pull
61 cd ${TOP}
62 fi
65 if [ -d ${DEST_BK_REP}/linux-2.4.*-xen-sparse ]
66 then
67 # this is a new style Xen repository so building is dead easy
69 export LINUX_SRC_PATH=${LINUX_DIR}
71 cd ${DEST_BK_REP}
73 # Recent repositories install into 'dist/install' rather than 'install'.
74 if [ -f install.sh ]
75 then
76 mkdir -p dist
77 ln -sf ../../install dist/install
78 else
79 ln -sf ../install install
80 fi
82 make -j4 world
83 make -j4 linux24
84 cd ../install/boot
85 if [ -r vmlinuz-2.6-xen0 ]
86 then
87 ln -s vmlinuz-2.6-xen0 xenolinux.gz
88 else
89 kern=`ls vmlinuz-2.6.*-xen0 | head -1`
90 [ -r "$kern" ] && ln -s "$kern" xenolinux.gz
91 fi
93 else
94 # old style repository without 'make world'
97 # identify this version of linux
98 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!'`
100 if [ -z "${LINUX_VER}" ]
101 then
102 echo Unable to identify Linux version. Bailing.
103 exit -1
104 fi
106 # copy in the master Linux tree for this kernel
107 if [ ! -d linux-${LINUX_VER} ]
108 then
109 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
110 fi
112 # build and install Xen and tools
113 cd ${DEST_BK_REP}
114 make dist || make install
116 # Turn linux into xenolinux then build it
117 cd xenolinux-${LINUX_VER}-sparse
118 ./mkbuildtree ../../linux-${LINUX_VER}
119 cd ../..
120 mv linux-${LINUX_VER} xenolinux-${LINUX_VER}
121 cd xenolinux-${LINUX_VER}
123 # cope with the change from ARCH=xeno to ARCH=xen
124 cd arch; XEN=`/bin/ls -d xen*`; cd ..
126 # built it all
127 ARCH=$XEN make oldconfig
128 ARCH=$XEN make dep
129 ARCH=$XEN make bzImage
130 ARCH=$XEN make dist || ARCH=xen make install
131 ARCH=$XEN make modules
132 ARCH=$XEN make INSTALL_MOD_PATH=${TOP}/install modules_install
133 cd ..
135 fi