aboutsummaryrefslogtreecommitdiffstats
path: root/linux-2.4.26-xen-sparse/mkbuildtree
diff options
context:
space:
mode:
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-06-09 16:36:08 +0000
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>2004-06-09 16:36:08 +0000
commit03907beb680ee39bee212bb3cb170cb295238cda (patch)
treef594d4df409070fe7f41cb1709f1ae22b76ac17c /linux-2.4.26-xen-sparse/mkbuildtree
parent63cf7286eeb40cadb2581fef38376da82a25b2ba (diff)
downloadxen-03907beb680ee39bee212bb3cb170cb295238cda.tar.gz
xen-03907beb680ee39bee212bb3cb170cb295238cda.tar.bz2
xen-03907beb680ee39bee212bb3cb170cb295238cda.zip
bitkeeper revision 1.946 (40c73c7805slPvnfEohXfQoiriAESg)
Rename Linux directories and upgrade build system.
Diffstat (limited to 'linux-2.4.26-xen-sparse/mkbuildtree')
-rwxr-xr-xlinux-2.4.26-xen-sparse/mkbuildtree223
1 files changed, 223 insertions, 0 deletions
diff --git a/linux-2.4.26-xen-sparse/mkbuildtree b/linux-2.4.26-xen-sparse/mkbuildtree
new file mode 100755
index 0000000000..2e9f7b9920
--- /dev/null
+++ b/linux-2.4.26-xen-sparse/mkbuildtree
@@ -0,0 +1,223 @@
+#!/bin/sh
+
+# mkbuildtree <build tree>
+#
+# Creates symbolic links in <build tree> for the sparse tree
+# in the current directory.
+
+# Script to determine the relative path between two directories.
+# Copyright (c) D. J. Hawkey Jr. 2002
+# Fixed for Xen project by K. Fraser in 2003.
+abs_to_rel ()
+{
+ local CWD SRCPATH
+
+ if [ "$1" != "/" -a "${1##*[^/]}" = "/" ]; then
+ SRCPATH=${1%?}
+ else
+ SRCPATH=$1
+ fi
+ if [ "$2" != "/" -a "${2##*[^/]}" = "/" ]; then
+ DESTPATH=${2%?}
+ else
+ DESTPATH=$2
+ fi
+
+ CWD=$PWD
+ [ "${1%%[^/]*}" != "/" ] && cd $1 && SRCPATH=$PWD
+ [ "${2%%[^/]*}" != "/" ] && cd $2 && DESTPATH=$PWD
+ [ "$CWD" != "$PWD" ] && cd $CWD
+
+ BASEPATH=$SRCPATH
+
+ [ "$SRCPATH" = "$DESTPATH" ] && DESTPATH="." && return
+ [ "$SRCPATH" = "/" ] && DESTPATH=${DESTPATH#?} && return
+
+ while [ "$BASEPATH/" != "${DESTPATH%${DESTPATH#$BASEPATH/}}" ]; do
+ BASEPATH=${BASEPATH%/*}
+ done
+
+ SRCPATH=${SRCPATH#$BASEPATH}
+ DESTPATH=${DESTPATH#$BASEPATH}
+ DESTPATH=${DESTPATH#?}
+ while [ -n "$SRCPATH" ]; do
+ SRCPATH=${SRCPATH%/*}
+ DESTPATH="../$DESTPATH"
+ done
+
+ [ -z "$BASEPATH" ] && BASEPATH="/"
+ [ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}
+}
+
+# relative_lndir <target_dir>
+# Creates a tree of symlinks in the current working directory that mirror
+# real files in <target_dir>. <target_dir> should be relative to the current
+# working directory. Symlinks in <target_dir> are ignored. Source-control files
+# are ignored.
+relative_lndir ()
+{
+ local SYMLINK_DIR REAL_DIR pref i j
+ SYMLINK_DIR=$PWD
+ REAL_DIR=$1
+ (
+ cd $REAL_DIR
+ for i in `find . -type d | grep -v SCCS`; do
+ [ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i
+ (
+ cd $i
+ pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`
+ for j in `find . -type f -o -type l -maxdepth 1`; do
+ ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j
+ done
+ )
+ done
+ )
+}
+
+[ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }
+
+# Get absolute path to the destination directory
+pushd . >/dev/null
+cd ${1}
+AD=$PWD
+popd >/dev/null
+
+# Get absolute path to the source directory
+AS=`pwd`
+
+# Get path to source, relative to destination
+abs_to_rel ${AD} ${AS}
+RS=$DESTPATH
+
+# Remove old copies of files and directories at the destination
+for i in `find . -type f -o -type l` ; do rm -f ${AD}/${i#./} ; done
+
+# We now work from the destination directory
+cd ${AD}
+
+# Remove old symlinks
+for i in `find . -type l`; do rm -f $i; done
+
+# Create symlinks of files and directories which exist in the sparse source
+relative_lndir ${RS}
+rm -f mkbuildtree
+
+## There are a whole bunch of special symlinks, mostly for files
+## which are identical in the i386 and xen-i386 architecture-dependent
+## subdirectories.
+
+# This first symlink is special: it links to shared files in Xen's source tree
+rm -rf ${AD}/include/asm-xen/hypervisor-ifs
+mkdir ${AD}/include/asm-xen/hypervisor-ifs
+cd ${AD}/include/asm-xen/hypervisor-ifs
+relative_lndir ../../../${RS}/../xen/include/hypervisor-ifs
+
+# Another special symlink: to the shared definitions for the control interface
+cd ..
+ln -sf ../../${RS}/../tools/xend/lib/domain_controller.h
+
+# The remainder are the i386 -> xen-i386 links
+ln -sf ../asm-i386/a.out.h
+ln -sf ../asm-i386/apicdef.h
+ln -sf ../asm-i386/apic.h
+ln -sf ../asm-i386/atomic.h
+ln -sf ../asm-i386/bitops.h
+ln -sf ../asm-i386/boot.h
+ln -sf ../asm-i386/byteorder.h
+ln -sf ../asm-i386/cache.h
+ln -sf ../asm-i386/checksum.h
+ln -sf ../asm-i386/cpufeature.h
+ln -sf ../asm-i386/current.h
+ln -sf ../asm-i386/debugreg.h
+ln -sf ../asm-i386/delay.h
+ln -sf ../asm-i386/div64.h
+ln -sf ../asm-i386/dma.h
+ln -sf ../asm-i386/elf.h
+ln -sf ../asm-i386/errno.h
+ln -sf ../asm-i386/fcntl.h
+ln -sf ../asm-i386/floppy.h
+ln -sf ../asm-i386/hardirq.h
+ln -sf ../asm-i386/hdreg.h
+ln -sf ../asm-i386/i387.h
+ln -sf ../asm-i386/ide.h
+ln -sf ../asm-i386/init.h
+ln -sf ../asm-i386/io_apic.h
+ln -sf ../asm-i386/ioctl.h
+ln -sf ../asm-i386/ioctls.h
+ln -sf ../asm-i386/ipcbuf.h
+ln -sf ../asm-i386/ipc.h
+ln -sf ../asm-i386/kmap_types.h
+ln -sf ../asm-i386/ldt.h
+ln -sf ../asm-i386/linux_logo.h
+ln -sf ../asm-i386/locks.h
+ln -sf ../asm-i386/math_emu.h
+ln -sf ../asm-i386/mc146818rtc.h
+ln -sf ../asm-i386/mca_dma.h
+ln -sf ../asm-i386/mman.h
+ln -sf ../asm-i386/mmu.h
+ln -sf ../asm-i386/mmx.h
+ln -sf ../asm-i386/module.h
+ln -sf ../asm-i386/mpspec.h
+ln -sf ../asm-i386/msgbuf.h
+ln -sf ../asm-i386/mtrr.h
+ln -sf ../asm-i386/namei.h
+ln -sf ../asm-i386/param.h
+ln -sf ../asm-i386/parport.h
+ln -sf ../asm-i386/pgtable-3level.h
+ln -sf ../asm-i386/poll.h
+ln -sf ../asm-i386/posix_types.h
+ln -sf ../asm-i386/resource.h
+ln -sf ../asm-i386/rwlock.h
+ln -sf ../asm-i386/rwsem.h
+ln -sf ../asm-i386/scatterlist.h
+ln -sf ../asm-i386/semaphore.h
+ln -sf ../asm-i386/sembuf.h
+ln -sf ../asm-i386/serial.h
+ln -sf ../asm-i386/setup.h
+ln -sf ../asm-i386/shmbuf.h
+ln -sf ../asm-i386/shmparam.h
+ln -sf ../asm-i386/sigcontext.h
+ln -sf ../asm-i386/siginfo.h
+ln -sf ../asm-i386/signal.h
+ln -sf ../asm-i386/smplock.h
+ln -sf ../asm-i386/socket.h
+ln -sf ../asm-i386/sockios.h
+ln -sf ../asm-i386/softirq.h
+ln -sf ../asm-i386/spinlock.h
+ln -sf ../asm-i386/statfs.h
+ln -sf ../asm-i386/stat.h
+ln -sf ../asm-i386/string-486.h
+ln -sf ../asm-i386/string.h
+ln -sf ../asm-i386/termbits.h
+ln -sf ../asm-i386/termios.h
+ln -sf ../asm-i386/timex.h
+ln -sf ../asm-i386/tlb.h
+ln -sf ../asm-i386/types.h
+ln -sf ../asm-i386/uaccess.h
+ln -sf ../asm-i386/ucontext.h
+ln -sf ../asm-i386/unaligned.h
+ln -sf ../asm-i386/unistd.h
+ln -sf ../asm-i386/user.h
+
+cd ../../arch/xen/kernel
+ln -sf ../../i386/kernel/i387.c
+ln -sf ../../i386/kernel/init_task.c
+ln -sf ../../i386/kernel/pci-dma.c
+ln -sf ../../i386/kernel/pci-i386.c
+ln -sf ../../i386/kernel/pci-i386.h
+ln -sf ../../i386/kernel/ptrace.c
+ln -sf ../../i386/kernel/semaphore.c
+ln -sf ../../i386/kernel/sys_i386.c
+cd ../lib
+ln -sf ../../i386/lib/checksum.S
+ln -sf ../../i386/lib/dec_and_lock.c
+ln -sf ../../i386/lib/getuser.S
+ln -sf ../../i386/lib/iodebug.c
+ln -sf ../../i386/lib/memcpy.c
+ln -sf ../../i386/lib/mmx.c
+ln -sf ../../i386/lib/old-checksum.c
+ln -sf ../../i386/lib/strstr.c
+ln -sf ../../i386/lib/usercopy.c
+cd ../mm
+ln -sf ../../i386/mm/extable.c
+ln -sf ../../i386/mm/pageattr.c