ia64/xen-unstable

view linux-2.4.29-xen-sparse/mkbuildtree @ 4764:fa155c185fd6

bitkeeper revision 1.1389.5.13 (42790489SjF8fj4T9jNcZdksbNpR4g)

Merge firebug.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-unstable.bk
into firebug.cl.cam.ac.uk:/local/scratch/smh22/xen-unstable.bk
author smh22@firebug.cl.cam.ac.uk
date Wed May 04 17:21:13 2005 +0000 (2005-05-04)
parents abf7ff0997cc c483f767d98d
children 39bfbd5ae9b8
line source
1 #!/bin/bash
3 # mkbuildtree <build tree>
4 #
5 # Creates symbolic links in <build tree> for the sparse tree
6 # in the current directory.
8 # Script to determine the relative path between two directories.
9 # Copyright (c) D. J. Hawkey Jr. 2002
10 # Fixed for Xen project by K. Fraser in 2003.
11 abs_to_rel ()
12 {
13 local CWD SRCPATH
15 if [ "$1" != "/" -a "${1##*[^/]}" = "/" ]; then
16 SRCPATH=${1%?}
17 else
18 SRCPATH=$1
19 fi
20 if [ "$2" != "/" -a "${2##*[^/]}" = "/" ]; then
21 DESTPATH=${2%?}
22 else
23 DESTPATH=$2
24 fi
26 CWD=$PWD
27 [ "${1%%[^/]*}" != "/" ] && cd $1 && SRCPATH=$PWD
28 [ "${2%%[^/]*}" != "/" ] && cd $2 && DESTPATH=$PWD
29 [ "$CWD" != "$PWD" ] && cd $CWD
31 BASEPATH=$SRCPATH
33 [ "$SRCPATH" = "$DESTPATH" ] && DESTPATH="." && return
34 [ "$SRCPATH" = "/" ] && DESTPATH=${DESTPATH#?} && return
36 while [ "$BASEPATH/" != "${DESTPATH%${DESTPATH#$BASEPATH/}}" ]; do
37 BASEPATH=${BASEPATH%/*}
38 done
40 SRCPATH=${SRCPATH#$BASEPATH}
41 DESTPATH=${DESTPATH#$BASEPATH}
42 DESTPATH=${DESTPATH#?}
43 while [ -n "$SRCPATH" ]; do
44 SRCPATH=${SRCPATH%/*}
45 DESTPATH="../$DESTPATH"
46 done
48 [ -z "$BASEPATH" ] && BASEPATH="/"
49 [ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}
50 }
52 # relative_lndir <target_dir>
53 # Creates a tree of symlinks in the current working directory that mirror
54 # real files in <target_dir>. <target_dir> should be relative to the current
55 # working directory. Symlinks in <target_dir> are ignored. Source-control files
56 # are ignored.
57 relative_lndir ()
58 {
59 local SYMLINK_DIR REAL_DIR pref i j
60 SYMLINK_DIR=$PWD
61 REAL_DIR=$1
62 (
63 cd $REAL_DIR
64 for i in `find . -type d | grep -v SCCS`; do
65 [ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i
66 (
67 cd $i
68 pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`
69 for j in `find . -maxdepth 1 -type f -o -type l`; do
70 ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j
71 done
72 )
73 done
74 )
75 }
77 [ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }
79 # Get absolute path to the destination directory
80 pushd . >/dev/null
81 cd ${1} || { echo "cannot cd to ${1}"; exit 1; }
82 AD=$PWD
83 popd >/dev/null
85 # Get absolute path to the source directory
86 AS=`pwd`
88 # Get path to source, relative to destination
89 abs_to_rel ${AD} ${AS}
90 RS=$DESTPATH
92 # Remove old copies of files and directories at the destination
93 for i in `find . -type f -o -type l` ; do rm -f ${AD}/${i#./} ; done
95 # We now work from the destination directory
96 cd ${AD} || { echo "cannot cd to ${AD}"; exit 1; }
98 # Remove old symlinks
99 for i in `find . -type l`; do rm -f $i; done
101 # Create symlinks of files and directories which exist in the sparse source
102 relative_lndir ${RS}
103 rm -f mkbuildtree
105 set ${RS}/../linux-2.6.*-xen-sparse
106 [ "$1" == "${RS}/../linux-2.6.*-xen-parse" ] && { echo "no Linux 2.6 sparse tree at ${RS}/../linux-2.6.*-xen-sparse"; exit 1; }
107 LINUX_26="$1"
110 # Create links to the shared definitions of the Xen interfaces.
111 rm -rf ${AD}/include/asm-xen/xen-public
112 mkdir ${AD}/include/asm-xen/xen-public
113 cd ${AD}/include/asm-xen/xen-public
114 relative_lndir ../../../${RS}/../xen/include/public
116 # Create a link to the shared definitions for the control interface
117 cd ${AD}/include/asm-xen
119 ## Symlinks for files:
120 ## - which are identical in the i386 and xen-i386 architecture-dependent
121 ## subdirectories.
122 ## - which are identical in the Linux 2.6 and Linux 2.4 ports.
124 cd ${AD}/include/asm-xen
125 ln -sf ../asm-i386/a.out.h
126 ln -sf ../asm-i386/apicdef.h
127 ln -sf ../asm-i386/apic.h
128 ln -sf ../asm-i386/atomic.h
129 ln -sf ../asm-i386/bitops.h
130 ln -sf ../asm-i386/boot.h
131 ln -sf ../asm-i386/byteorder.h
132 ln -sf ../asm-i386/cache.h
133 ln -sf ../asm-i386/checksum.h
134 ln -sf ../asm-i386/cpufeature.h
135 ln -sf ../asm-i386/current.h
136 ln -sf ../asm-i386/debugreg.h
137 ln -sf ../asm-i386/delay.h
138 ln -sf ../asm-i386/div64.h
139 ln -sf ../asm-i386/dma.h
140 ln -sf ../asm-i386/elf.h
141 ln -sf ../asm-i386/errno.h
142 ln -sf ../asm-i386/fcntl.h
143 ln -sf ../asm-i386/floppy.h
144 ln -sf ../asm-i386/hardirq.h
145 ln -sf ../asm-i386/hdreg.h
146 ln -sf ../asm-i386/i387.h
147 ln -sf ../asm-i386/ide.h
148 ln -sf ../asm-i386/init.h
149 ln -sf ../asm-i386/io_apic.h
150 ln -sf ../asm-i386/ioctl.h
151 ln -sf ../asm-i386/ioctls.h
152 ln -sf ../asm-i386/ipcbuf.h
153 ln -sf ../asm-i386/ipc.h
154 ln -sf ../asm-i386/kmap_types.h
155 ln -sf ../asm-i386/ldt.h
156 ln -sf ../asm-i386/linux_logo.h
157 ln -sf ../asm-i386/locks.h
158 ln -sf ../asm-i386/math_emu.h
159 ln -sf ../asm-i386/mc146818rtc.h
160 ln -sf ../asm-i386/mca_dma.h
161 ln -sf ../asm-i386/mman.h
162 ln -sf ../asm-i386/mmu.h
163 ln -sf ../asm-i386/mmx.h
164 ln -sf ../asm-i386/mpspec.h
165 ln -sf ../asm-i386/msgbuf.h
166 ln -sf ../asm-i386/msr.h
167 ln -sf ../asm-i386/mtrr.h
168 ln -sf ../asm-i386/namei.h
169 ln -sf ../asm-i386/param.h
170 ln -sf ../asm-i386/parport.h
171 ln -sf ../asm-i386/pgtable-3level.h
172 ln -sf ../asm-i386/poll.h
173 ln -sf ../asm-i386/posix_types.h
174 ln -sf ../asm-i386/ptrace.h
175 ln -sf ../asm-i386/resource.h
176 ln -sf ../asm-i386/rwlock.h
177 ln -sf ../asm-i386/rwsem.h
178 ln -sf ../asm-i386/scatterlist.h
179 ln -sf ../asm-i386/semaphore.h
180 ln -sf ../asm-i386/sembuf.h
181 ln -sf ../asm-i386/serial.h
182 ln -sf ../asm-i386/setup.h
183 ln -sf ../asm-i386/shmbuf.h
184 ln -sf ../asm-i386/shmparam.h
185 ln -sf ../asm-i386/sigcontext.h
186 ln -sf ../asm-i386/siginfo.h
187 ln -sf ../asm-i386/signal.h
188 ln -sf ../asm-i386/smplock.h
189 ln -sf ../asm-i386/socket.h
190 ln -sf ../asm-i386/sockios.h
191 ln -sf ../asm-i386/softirq.h
192 ln -sf ../asm-i386/spinlock.h
193 ln -sf ../asm-i386/statfs.h
194 ln -sf ../asm-i386/stat.h
195 ln -sf ../asm-i386/string-486.h
196 ln -sf ../asm-i386/string.h
197 ln -sf ../asm-i386/termbits.h
198 ln -sf ../asm-i386/termios.h
199 ln -sf ../asm-i386/timex.h
200 ln -sf ../asm-i386/tlb.h
201 ln -sf ../asm-i386/types.h
202 ln -sf ../asm-i386/uaccess.h
203 ln -sf ../asm-i386/ucontext.h
204 ln -sf ../asm-i386/unaligned.h
205 ln -sf ../asm-i386/unistd.h
206 ln -sf ../asm-i386/user.h
207 ln -sf ../asm-i386/vm86.h
208 ln -sf ../../${LINUX_26}/include/asm-xen/balloon.h
209 ln -sf ../../${LINUX_26}/include/asm-xen/ctrl_if.h
210 ln -sf ../../${LINUX_26}/include/asm-xen/evtchn.h
211 ln -sf ../../${LINUX_26}/include/asm-xen/gnttab.h
212 ln -sf ../../${LINUX_26}/include/asm-xen/hypervisor.h
213 ln -sf ../../${LINUX_26}/include/asm-xen/xen_proc.h
214 ln -sf ../../${LINUX_26}/include/asm-xen/asm-i386/synch_bitops.h
215 ln -sf ../../${LINUX_26}/include/asm-xen/asm-i386/hypercall.h
217 mkdir -p linux-public && cd linux-public
218 ln -sf ../../../${LINUX_26}/include/asm-xen/linux-public/privcmd.h
219 ln -sf ../../../${LINUX_26}/include/asm-xen/linux-public/suspend.h
221 cd ${AD}/arch/xen/kernel
222 ln -sf ../../i386/kernel/i387.c
223 ln -sf ../../i386/kernel/init_task.c
224 ln -sf ../../i386/kernel/pci-i386.c
225 ln -sf ../../i386/kernel/pci-i386.h
226 ln -sf ../../i386/kernel/ptrace.c
227 ln -sf ../../i386/kernel/semaphore.c
228 ln -sf ../../i386/kernel/sys_i386.c
229 ln -sf ../../../${LINUX_26}/arch/xen/kernel/ctrl_if.c
230 ln -sf ../../../${LINUX_26}/arch/xen/kernel/evtchn.c
231 ln -sf ../../../${LINUX_26}/arch/xen/kernel/fixup.c
232 ln -sf ../../../${LINUX_26}/arch/xen/kernel/gnttab.c
233 ln -sf ../../../${LINUX_26}/arch/xen/kernel/reboot.c
234 ln -sf ../../../${LINUX_26}/arch/xen/kernel/skbuff.c
236 cd ${AD}/arch/xen/lib
237 ln -sf ../../i386/lib/checksum.S
238 ln -sf ../../i386/lib/dec_and_lock.c
239 ln -sf ../../i386/lib/getuser.S
240 ln -sf ../../i386/lib/iodebug.c
241 ln -sf ../../i386/lib/memcpy.c
242 ln -sf ../../i386/lib/mmx.c
243 ln -sf ../../i386/lib/old-checksum.c
244 ln -sf ../../i386/lib/strstr.c
245 ln -sf ../../i386/lib/usercopy.c
246 ln -sf ../../../${LINUX_26}/arch/xen/kernel/xen_proc.c
248 cd ${AD}/arch/xen/mm
249 ln -sf ../../i386/mm/extable.c
250 ln -sf ../../i386/mm/pageattr.c
251 ln -sf ../../../${LINUX_26}/arch/xen/i386/mm/hypervisor.c
253 cd ${AD}/arch/xen/drivers/balloon
254 ln -sf ../../../../${LINUX_26}/drivers/xen/balloon/balloon.c
256 cd ${AD}/arch/xen/drivers/console
257 ln -sf ../../../../${LINUX_26}/drivers/xen/console/console.c
259 cd ${AD}/arch/xen/drivers/dom0
260 ln -sf ../../../../${LINUX_26}/drivers/xen/privcmd/privcmd.c core.c
262 cd ${AD}/arch/xen/drivers/evtchn
263 ln -sf ../../../../${LINUX_26}/drivers/xen/evtchn/evtchn.c
265 cd ${AD}/arch/xen/drivers/netif/frontend
266 ln -sf ../../../../../${LINUX_26}/drivers/xen/netfront/netfront.c main.c
268 cd ${AD}/arch/xen/drivers/netif/backend
269 ln -sf ../../../../../${LINUX_26}/drivers/xen/netback/common.h
270 ln -sf ../../../../../${LINUX_26}/drivers/xen/netback/control.c
271 ln -sf ../../../../../${LINUX_26}/drivers/xen/netback/interface.c
272 ln -sf ../../../../../${LINUX_26}/drivers/xen/netback/netback.c main.c
274 cd ${AD}/arch/xen/drivers/blkif/backend
275 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/common.h
276 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/blkback.c main.c
277 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/control.c
278 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/interface.c
279 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkback/vbd.c
281 cd ${AD}/arch/xen/drivers/blkif/frontend
282 ln -sf ../../../../../${LINUX_26}/drivers/xen/blkfront/blkfront.c
284 cd ${AD}/arch/xen/drivers/usbif/frontend
285 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbfront/usbfront.c main.c
286 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbfront/xhci.h
288 cd ${AD}/arch/xen/drivers/usbif/backend
289 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbback/common.h
290 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbback/control.c
291 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbback/interface.c
292 ln -sf ../../../../../${LINUX_26}/drivers/xen/usbback/usbback.c main.c