ia64/xen-unstable

changeset 2443:e1636300e803

bitkeeper revision 1.1159.72.1 (413cb1f9MtRHM7cQFiJRcJ1gYUPxdw)

Add NetBSD support.
author cl349@labyrinth.cl.cam.ac.uk
date Mon Sep 06 18:52:41 2004 +0000 (2004-09-06)
parents 25e6d3dde54a
children 7432c2c8b98b
files .rootkeys BitKeeper/etc/ignore BitKeeper/etc/logging_ok Makefile netbsd-2.0-xen-sparse/Makefile netbsd-2.0-xen-sparse/mkbuildtree netbsd-2.0-xen-sparse/nbconfig-xen netbsd-2.0-xen-sparse/nbmake-xen
line diff
     1.1 --- a/.rootkeys	Mon Sep 06 15:53:59 2004 +0000
     1.2 +++ b/.rootkeys	Mon Sep 06 18:52:41 2004 +0000
     1.3 @@ -259,6 +259,10 @@ 4124f66f4NaKNa0xPiGGykn9QaZk3w linux-2.6
     1.4  40f56a0ddHCSs3501MY4hRf22tctOw linux-2.6.8.1-xen-sparse/mkbuildtree
     1.5  412f46c0LJuKAgSPGoC0Z1DEkLfuLA linux-2.6.8.1-xen-sparse/mm/memory.c
     1.6  410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.8.1-xen-sparse/mm/page_alloc.c
     1.7 +413cb1e4zst25MDYjg63Y-NGC5_pLg netbsd-2.0-xen-sparse/Makefile
     1.8 +413cb1e5c_Mkxf_X0zimEhTKI_l4DA netbsd-2.0-xen-sparse/mkbuildtree
     1.9 +413cb1e5kY_Zil7-b0kI6hvCIxBEYg netbsd-2.0-xen-sparse/nbconfig-xen
    1.10 +413cb1e5-58q5doPifcE1Q8ZAgm-JQ netbsd-2.0-xen-sparse/nbmake-xen
    1.11  40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Make.defs
    1.12  3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile
    1.13  4124b307nRyK3dhn1hAsvrY76NuV3g tools/check/Makefile
     2.1 --- a/BitKeeper/etc/ignore	Mon Sep 06 15:53:59 2004 +0000
     2.2 +++ b/BitKeeper/etc/ignore	Mon Sep 06 18:52:41 2004 +0000
     2.3 @@ -32,6 +32,9 @@ linux-2.4.26.tar.gz
     2.4  linux-2.6.7-xenU
     2.5  linux-2.6.7.tar.bz2
     2.6  linux-xen-sparse
     2.7 +netbsd-*-xen0
     2.8 +netbsd-*-xenU
     2.9 +netbsd-*-tools
    2.10  patches/*
    2.11  tools/*/build/lib*/*.py
    2.12  tools/balloon/balloon
     3.1 --- a/BitKeeper/etc/logging_ok	Mon Sep 06 15:53:59 2004 +0000
     3.2 +++ b/BitKeeper/etc/logging_ok	Mon Sep 06 18:52:41 2004 +0000
     3.3 @@ -10,6 +10,7 @@ br260@br260.wolfson.cam.ac.uk
     3.4  br260@labyrinth.cl.cam.ac.uk
     3.5  br260@laudney.cl.cam.ac.uk
     3.6  cl349@freefall.cl.cam.ac.uk
     3.7 +cl349@labyrinth.cl.cam.ac.uk
     3.8  djm@kirby.fc.hp.com
     3.9  gm281@boulderdash.cl.cam.ac.uk
    3.10  iap10@freefall.cl.cam.ac.uk
     4.1 --- a/Makefile	Mon Sep 06 15:53:59 2004 +0000
     4.2 +++ b/Makefile	Mon Sep 06 18:52:41 2004 +0000
     4.3 @@ -103,6 +103,54 @@ linux-xen%:
     4.4  	    modules_install
     4.5  	$(MAKE) -C $(BDIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install
     4.6  
     4.7 +
     4.8 +NETBSD_RELEASE   ?= 2.0
     4.9 +NETBSD_VER       ?= $(shell ( /bin/ls -ld netbsd-$(NETBSD_RELEASE)*-xen-sparse ) 2>/dev/null | \
    4.10 +		      sed -e 's!^.*netbsd-\(.\+\)-xen-sparse!\1!' )
    4.11 +NETBSD_CVSSNAP   ?= 20040906
    4.12 +NETBSD_SRC_PATH  ?= .:..
    4.13 +NETBSD_SRC       ?= $(firstword $(foreach dir,$(subst :, ,$(NETBSD_SRC_PATH)),\
    4.14 +                    $(wildcard $(dir)/netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.*z*)))
    4.15 +NETBSD_TOOLS_SRC ?= $(firstword $(foreach dir,$(subst :, ,$(NETBSD_SRC_PATH)),\
    4.16 +                    $(wildcard $(dir)/netbsd-$(NETBSD_VER)-tools.tar.*z*)))
    4.17 +
    4.18 +NETBSD_TREES := netbsd-$(NETBSD_VER)-xenU
    4.19 +
    4.20 +pristine-netbsd-src: 
    4.21 +ifeq ($(NETBSD_SRC),)
    4.22 +	@echo "Cannot find netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.gz in path $(NETBSD_SRC_PATH)"
    4.23 +	@wget http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2 -O./netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2
    4.24 +NETBSD_SRC := ./netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2 
    4.25 +endif
    4.26 +
    4.27 +pristine-netbsd-tools-src: 
    4.28 +ifeq ($(NETBSD_TOOLS_SRC),)
    4.29 +	@echo "Cannot find netbsd-$(NETBSD_VER)-tools.tar.gz in path $(NETBSD_SRC_PATH)"
    4.30 +	@wget http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/netbsd-$(NETBSD_VER)-tools.tar.bz2 -O./netbsd-$(NETBSD_VER)-tools.tar.bz2
    4.31 +NETBSD_TOOLS_SRC := ./netbsd-$(NETBSD_VER)-tools.tar.bz2 
    4.32 +endif
    4.33 +
    4.34 +netbsd-tools: pristine-netbsd-tools-src
    4.35 +	@[ -d netbsd-$(NETBSD_RELEASE)-tools ] || { \
    4.36 +		echo extract $(NETBSD_TOOLS_SRC); \
    4.37 +		tar -jxf $(NETBSD_TOOLS_SRC); }
    4.38 +
    4.39 +mk-netbsd-trees: netbsd-tools pristine-netbsd-src 
    4.40 +	$(RM) -rf $(NETBSD_TREES)
    4.41 +	echo $(NETBSD_SRC) | grep -q bz2 && \
    4.42 +	    tar -jxf $(NETBSD_SRC) || tar -zxf $(NETBSD_SRC)
    4.43 +	mv netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP) \
    4.44 +	    netbsd-$(NETBSD_VER)-xenU
    4.45 +	( cd netbsd-$(NETBSD_VER)-xen-sparse ; \
    4.46 +          ./mkbuildtree ../netbsd-$(NETBSD_VER)-xenU )
    4.47 +
    4.48 +# build the specified netbsd tree
    4.49 +BDIR = $(subst netbsd-,netbsd-$(NETBSD_VER)-,$@)
    4.50 +netbsd-xen%:	
    4.51 +	$(MAKE) -C $(BDIR) config
    4.52 +	$(MAKE) -C $(BDIR) netbsd
    4.53 +	$(MAKE) -C $(BDIR) INSTALL_PATH=$(INSTALL_DIR) INSTALL_NAME=boot/netbsd-$(NETBSD_VER)-$(subst netbsd-,,$@) install
    4.54 +
    4.55  # build xen, the tools, and a domain 0 plus unprivileged linux-xen images,
    4.56  # and place them in the install directory. 'make install' should then
    4.57  # copy them to the normal system directories
    4.58 @@ -130,6 +178,10 @@ linux24:
    4.59  	$(MAKE) LINUX_RELEASE=2.4 config-xen0
    4.60  	$(MAKE) LINUX_RELEASE=2.4 linux-xen0
    4.61  
    4.62 +netbsd:
    4.63 +	$(MAKE) mk-netbsd-trees
    4.64 +	$(MAKE) netbsd-xenU
    4.65 +
    4.66  clean: delete-symlinks
    4.67  	$(MAKE) -C xen clean
    4.68  	$(MAKE) -C tools clean
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/netbsd-2.0-xen-sparse/Makefile	Mon Sep 06 18:52:41 2004 +0000
     5.3 @@ -0,0 +1,20 @@
     5.4 +#
     5.5 +#
     5.6 +#
     5.7 +
     5.8 +.PHONY: config netbsd
     5.9 +
    5.10 +TOPDIR		?= $(shell pwd)
    5.11 +NETBSD_RELEASE	?= $(patsubst netbsd-%-xen%,%,$(notdir $(TOPDIR)))
    5.12 +NETBSD_VER	?= $(patsubst netbsd-%-xen%,%,$(notdir $(TOPDIR)))
    5.13 +
    5.14 +config:
    5.15 +	@mkdir -p compile/XEN
    5.16 +	cd compile/XEN && TOPDIR=$(TOPDIR) NETBSD_VER=$(NETBSD_VER) ../../nbconfig-xen XEN
    5.17 +
    5.18 +netbsd:
    5.19 +	cd compile/XEN && TOPDIR=$(TOPDIR) NETBSD_VER=$(NETBSD_VER) ../../nbmake-xen dependall
    5.20 +
    5.21 +install:
    5.22 +	@mkdir -p $(dir $(INSTALL_PATH)/$(INSTALL_NAME))
    5.23 +	install -c compile/XEN/netbsd $(INSTALL_PATH)/$(INSTALL_NAME)
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/netbsd-2.0-xen-sparse/mkbuildtree	Mon Sep 06 18:52:41 2004 +0000
     6.3 @@ -0,0 +1,114 @@
     6.4 +#!/bin/sh
     6.5 +
     6.6 +# mkbuildtree <build tree>
     6.7 +#
     6.8 +# Creates symbolic links in <build tree> for the sparse tree
     6.9 +# in the current directory.
    6.10 +
    6.11 +# Script to determine the relative path between two directories.
    6.12 +# Copyright (c) D. J. Hawkey Jr. 2002
    6.13 +# Fixed for Xen project by K. Fraser in 2003.  
    6.14 +abs_to_rel ()
    6.15 +{
    6.16 +	local CWD SRCPATH
    6.17 +                
    6.18 +	if [ "$1" != "/" -a "${1##*[^/]}" = "/" ]; then
    6.19 +		SRCPATH=${1%?}
    6.20 +	else
    6.21 +		SRCPATH=$1
    6.22 +	fi
    6.23 +	if [ "$2" != "/" -a "${2##*[^/]}" = "/" ]; then
    6.24 +		DESTPATH=${2%?}
    6.25 +	else
    6.26 +		DESTPATH=$2
    6.27 +	fi
    6.28 +
    6.29 +	CWD=$PWD
    6.30 +	[ "${1%%[^/]*}" != "/" ] && cd $1 && SRCPATH=$PWD
    6.31 +	[ "${2%%[^/]*}" != "/" ] && cd $2 && DESTPATH=$PWD
    6.32 +	[ "$CWD" != "$PWD" ] && cd $CWD
    6.33 +
    6.34 +	BASEPATH=$SRCPATH
    6.35 +
    6.36 +	[ "$SRCPATH" = "$DESTPATH" ] && DESTPATH="." && return
    6.37 +	[ "$SRCPATH" = "/" ] && DESTPATH=${DESTPATH#?} && return
    6.38 +
    6.39 +	while [ "$BASEPATH/" != "${DESTPATH%${DESTPATH#$BASEPATH/}}" ]; do
    6.40 +          BASEPATH=${BASEPATH%/*}
    6.41 +	done
    6.42 +
    6.43 +	SRCPATH=${SRCPATH#$BASEPATH}
    6.44 +        DESTPATH=${DESTPATH#$BASEPATH}
    6.45 +        DESTPATH=${DESTPATH#?}
    6.46 +	while [ -n "$SRCPATH" ]; do
    6.47 +		SRCPATH=${SRCPATH%/*}
    6.48 +		DESTPATH="../$DESTPATH"
    6.49 +	done
    6.50 +
    6.51 +	[ -z "$BASEPATH" ] && BASEPATH="/"
    6.52 +	[ "${DESTPATH##*[^/]}" = "/" ] && DESTPATH=${DESTPATH%?}
    6.53 +}
    6.54 +
    6.55 +# relative_lndir <target_dir>
    6.56 +# Creates a tree of symlinks in the current working directory that mirror
    6.57 +# real files in <target_dir>. <target_dir> should be relative to the current
    6.58 +# working directory. Symlinks in <target_dir> are ignored. Source-control files
    6.59 +# are ignored.
    6.60 +relative_lndir ()
    6.61 +{
    6.62 +  local SYMLINK_DIR REAL_DIR pref i j
    6.63 +  SYMLINK_DIR=$PWD
    6.64 +  REAL_DIR=$1
    6.65 +  (
    6.66 +  cd $REAL_DIR
    6.67 +  for i in `find . -type d | grep -v SCCS`; do
    6.68 +    [ -d $SYMLINK_DIR/$i ] || mkdir -p $SYMLINK_DIR/$i
    6.69 +    (
    6.70 +    cd $i
    6.71 +    pref=`echo $i | sed -e 's#/[^/]*#../#g' -e 's#^\.##'`
    6.72 +    for j in `find . -type f -o -type l -maxdepth 1`; do
    6.73 +      ln -sf ${pref}${REAL_DIR}/$i/$j ${SYMLINK_DIR}/$i/$j
    6.74 +    done
    6.75 +    )
    6.76 +  done
    6.77 +  )
    6.78 +}
    6.79 +
    6.80 +[ "$1" == "" ] && { echo "Syntax: $0 <linux tree to xenify>"; exit 1; }
    6.81 +
    6.82 +# Get absolute path to the destination directory
    6.83 +pushd . >/dev/null
    6.84 +cd ${1}
    6.85 +AD=$PWD
    6.86 +popd >/dev/null
    6.87 +  
    6.88 +# Get absolute path to the source directory
    6.89 +AS=`pwd`
    6.90 +
    6.91 +# Get path to source, relative to destination
    6.92 +abs_to_rel ${AD} ${AS}
    6.93 +RS=$DESTPATH
    6.94 +
    6.95 +# Remove old copies of files and directories at the destination
    6.96 +for i in `find . -type f -o -type l` ; do rm -f ${AD}/${i#./} ; done
    6.97 +
    6.98 +# We now work from the destination directory
    6.99 +cd ${AD}
   6.100 +
   6.101 +# Remove old symlinks
   6.102 +for i in `find . -type l`; do rm -f $i; done
   6.103 +
   6.104 +# Create symlinks of files and directories which exist in the sparse source
   6.105 +relative_lndir ${RS}
   6.106 +rm -f mkbuildtree
   6.107 +
   6.108 +
   6.109 +# Create links to the shared definitions of the hypervisor interface
   6.110 +rm -rf ${AD}/sys/arch/xen/include/hypervisor-ifs
   6.111 +mkdir  ${AD}/sys/arch/xen/include/hypervisor-ifs
   6.112 +cd     ${AD}/sys/arch/xen/include/hypervisor-ifs
   6.113 +relative_lndir ../../../../../${RS}/../xen/include/hypervisor-ifs
   6.114 +
   6.115 +# Remove files which don't exist anymore
   6.116 +rm -rf ${AD}/sys/arch/xen/xen/events.c
   6.117 +rm -rf ${AD}/sys/arch/xen/include/events.h
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/netbsd-2.0-xen-sparse/nbconfig-xen	Mon Sep 06 18:52:41 2004 +0000
     7.3 @@ -0,0 +1,20 @@
     7.4 +#! /bin/sh
     7.5 +#
     7.6 +
     7.7 +: ${HOS:=$(uname -s | tr /A-Z/ /a-z/)}
     7.8 +: ${HARCH:=$(uname -i)}
     7.9 +: ${NETBSD_RELEASE:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+\).*/\1/')}
    7.10 +: ${NETBSD_VERSION:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+.*\)-xen.*/\1/')}
    7.11 +
    7.12 +TOOLDIR="$TOPDIR/../netbsd-${NETBSD_RELEASE}-tools/$HOS-$HARCH"; export TOOLDIR
    7.13 +
    7.14 +CONF="$1"
    7.15 +case "$1" in
    7.16 +  /*)
    7.17 +    CONF="$1"
    7.18 +    ;;
    7.19 +  *)
    7.20 +    CONF="$TOPDIR"/sys/arch/xen/conf/"$1"
    7.21 +    ;;
    7.22 +esac
    7.23 +exec "${TOOLDIR}/bin/nbconfig" -b $(pwd) -s "$TOPDIR"/sys "$CONF"
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/netbsd-2.0-xen-sparse/nbmake-xen	Mon Sep 06 18:52:41 2004 +0000
     8.3 @@ -0,0 +1,26 @@
     8.4 +#! /bin/sh
     8.5 +# Set proper variables to allow easy "make" building of a NetBSD subtree.
     8.6 +# Generated from:  $NetBSD: build.sh,v 1.126 2004/02/04 11:23:40 lukem Exp $
     8.7 +#
     8.8 +
     8.9 +: ${HOS:=$(uname -s | tr /A-Z/ /a-z/)}
    8.10 +: ${HARCH:=$(uname -i)}
    8.11 +: ${NETBSD_RELEASE:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+\).*/\1/')}
    8.12 +: ${NETBSD_VERSION:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+.*\)-xen.*/\1/')}
    8.13 +
    8.14 +NETBSDSRCDIR="$TOPDIR"; export NETBSDSRCDIR
    8.15 +DESTDIR="$TOPDIR/root"; export DESTDIR
    8.16 +unset MAKEOBJDIRPREFIX
    8.17 +MAKEOBJDIR='${.CURDIR:C,^'"$TOPDIR,$TOPDIR/obj,}"; export MAKEOBJDIR
    8.18 +RELEASEDIR="$TOPDIR/release"; export RELEASEDIR
    8.19 +MKUNPRIVED='yes'; export MKUNPRIVED
    8.20 +MAKEVERBOSE='1'; export MAKEVERBOSE
    8.21 +LC_ALL='C'; export LC_ALL
    8.22 +TOOLDIR="$TOPDIR/../netbsd-${NETBSD_RELEASE}-tools/$HOS-$HARCH"; export TOOLDIR
    8.23 +MACHINE='i386'; export MACHINE
    8.24 +MACHINE_ARCH='i386'; export MACHINE_ARCH
    8.25 +MAKEFLAGS="-de -m $TOPDIR/share/mk MKOBJDIRS=yes"; export MAKEFLAGS
    8.26 +BUILDID="${NETBSD_RELEASE}"; export BUILDID
    8.27 +USETOOLS=yes; export USETOOLS
    8.28 +
    8.29 +exec "${TOOLDIR}/bin/nbmake" ${1+"$@"}