From 2a632d88f77c98ce72f4ead7c372f74a3fb840a8 Mon Sep 17 00:00:00 2001 From: "cl349@labyrinth.cl.cam.ac.uk" Date: Mon, 6 Sep 2004 18:52:41 +0000 Subject: bitkeeper revision 1.1159.72.1 (413cb1f9MtRHM7cQFiJRcJ1gYUPxdw) Add NetBSD support. --- .rootkeys | 4 ++ BitKeeper/etc/ignore | 3 + BitKeeper/etc/logging_ok | 1 + Makefile | 52 +++++++++++++++++ netbsd-2.0-xen-sparse/Makefile | 20 +++++++ netbsd-2.0-xen-sparse/mkbuildtree | 114 +++++++++++++++++++++++++++++++++++++ netbsd-2.0-xen-sparse/nbconfig-xen | 20 +++++++ netbsd-2.0-xen-sparse/nbmake-xen | 26 +++++++++ 8 files changed, 240 insertions(+) create mode 100644 netbsd-2.0-xen-sparse/Makefile create mode 100755 netbsd-2.0-xen-sparse/mkbuildtree create mode 100755 netbsd-2.0-xen-sparse/nbconfig-xen create mode 100755 netbsd-2.0-xen-sparse/nbmake-xen diff --git a/.rootkeys b/.rootkeys index ed597156b3..98d2a0e4e8 100644 --- a/.rootkeys +++ b/.rootkeys @@ -259,6 +259,10 @@ 40f56a0ddHCSs3501MY4hRf22tctOw linux-2.6.8.1-xen-sparse/mkbuildtree 412f46c0LJuKAgSPGoC0Z1DEkLfuLA linux-2.6.8.1-xen-sparse/mm/memory.c 410a94a4KT6I6X0LVc7djB39tRDp4g linux-2.6.8.1-xen-sparse/mm/page_alloc.c +413cb1e4zst25MDYjg63Y-NGC5_pLg netbsd-2.0-xen-sparse/Makefile +413cb1e5c_Mkxf_X0zimEhTKI_l4DA netbsd-2.0-xen-sparse/mkbuildtree +413cb1e5kY_Zil7-b0kI6hvCIxBEYg netbsd-2.0-xen-sparse/nbconfig-xen +413cb1e5-58q5doPifcE1Q8ZAgm-JQ netbsd-2.0-xen-sparse/nbmake-xen 40e1b09db5mN69Ijj0X_Eol-S7dXiw tools/Make.defs 3f776bd1Hy9rn69ntXBhPReUFw9IEA tools/Makefile 4124b307nRyK3dhn1hAsvrY76NuV3g tools/check/Makefile diff --git a/BitKeeper/etc/ignore b/BitKeeper/etc/ignore index 98eb5b8337..7ed888a802 100644 --- a/BitKeeper/etc/ignore +++ b/BitKeeper/etc/ignore @@ -32,6 +32,9 @@ linux-2.4.26.tar.gz linux-2.6.7-xenU linux-2.6.7.tar.bz2 linux-xen-sparse +netbsd-*-xen0 +netbsd-*-xenU +netbsd-*-tools patches/* tools/*/build/lib*/*.py tools/balloon/balloon diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 9332c02f2b..441337485c 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -10,6 +10,7 @@ br260@br260.wolfson.cam.ac.uk br260@labyrinth.cl.cam.ac.uk br260@laudney.cl.cam.ac.uk cl349@freefall.cl.cam.ac.uk +cl349@labyrinth.cl.cam.ac.uk djm@kirby.fc.hp.com gm281@boulderdash.cl.cam.ac.uk iap10@freefall.cl.cam.ac.uk diff --git a/Makefile b/Makefile index 971c257603..dc926deb75 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,54 @@ linux-xen%: modules_install $(MAKE) -C $(BDIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install + +NETBSD_RELEASE ?= 2.0 +NETBSD_VER ?= $(shell ( /bin/ls -ld netbsd-$(NETBSD_RELEASE)*-xen-sparse ) 2>/dev/null | \ + sed -e 's!^.*netbsd-\(.\+\)-xen-sparse!\1!' ) +NETBSD_CVSSNAP ?= 20040906 +NETBSD_SRC_PATH ?= .:.. +NETBSD_SRC ?= $(firstword $(foreach dir,$(subst :, ,$(NETBSD_SRC_PATH)),\ + $(wildcard $(dir)/netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.*z*))) +NETBSD_TOOLS_SRC ?= $(firstword $(foreach dir,$(subst :, ,$(NETBSD_SRC_PATH)),\ + $(wildcard $(dir)/netbsd-$(NETBSD_VER)-tools.tar.*z*))) + +NETBSD_TREES := netbsd-$(NETBSD_VER)-xenU + +pristine-netbsd-src: +ifeq ($(NETBSD_SRC),) + @echo "Cannot find netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.gz in path $(NETBSD_SRC_PATH)" + @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 +NETBSD_SRC := ./netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP).tar.bz2 +endif + +pristine-netbsd-tools-src: +ifeq ($(NETBSD_TOOLS_SRC),) + @echo "Cannot find netbsd-$(NETBSD_VER)-tools.tar.gz in path $(NETBSD_SRC_PATH)" + @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 +NETBSD_TOOLS_SRC := ./netbsd-$(NETBSD_VER)-tools.tar.bz2 +endif + +netbsd-tools: pristine-netbsd-tools-src + @[ -d netbsd-$(NETBSD_RELEASE)-tools ] || { \ + echo extract $(NETBSD_TOOLS_SRC); \ + tar -jxf $(NETBSD_TOOLS_SRC); } + +mk-netbsd-trees: netbsd-tools pristine-netbsd-src + $(RM) -rf $(NETBSD_TREES) + echo $(NETBSD_SRC) | grep -q bz2 && \ + tar -jxf $(NETBSD_SRC) || tar -zxf $(NETBSD_SRC) + mv netbsd-$(NETBSD_VER)-xen-kernel-$(NETBSD_CVSSNAP) \ + netbsd-$(NETBSD_VER)-xenU + ( cd netbsd-$(NETBSD_VER)-xen-sparse ; \ + ./mkbuildtree ../netbsd-$(NETBSD_VER)-xenU ) + +# build the specified netbsd tree +BDIR = $(subst netbsd-,netbsd-$(NETBSD_VER)-,$@) +netbsd-xen%: + $(MAKE) -C $(BDIR) config + $(MAKE) -C $(BDIR) netbsd + $(MAKE) -C $(BDIR) INSTALL_PATH=$(INSTALL_DIR) INSTALL_NAME=boot/netbsd-$(NETBSD_VER)-$(subst netbsd-,,$@) install + # build xen, the tools, and a domain 0 plus unprivileged linux-xen images, # and place them in the install directory. 'make install' should then # copy them to the normal system directories @@ -130,6 +178,10 @@ linux24: $(MAKE) LINUX_RELEASE=2.4 config-xen0 $(MAKE) LINUX_RELEASE=2.4 linux-xen0 +netbsd: + $(MAKE) mk-netbsd-trees + $(MAKE) netbsd-xenU + clean: delete-symlinks $(MAKE) -C xen clean $(MAKE) -C tools clean diff --git a/netbsd-2.0-xen-sparse/Makefile b/netbsd-2.0-xen-sparse/Makefile new file mode 100644 index 0000000000..def3b4427e --- /dev/null +++ b/netbsd-2.0-xen-sparse/Makefile @@ -0,0 +1,20 @@ +# +# +# + +.PHONY: config netbsd + +TOPDIR ?= $(shell pwd) +NETBSD_RELEASE ?= $(patsubst netbsd-%-xen%,%,$(notdir $(TOPDIR))) +NETBSD_VER ?= $(patsubst netbsd-%-xen%,%,$(notdir $(TOPDIR))) + +config: + @mkdir -p compile/XEN + cd compile/XEN && TOPDIR=$(TOPDIR) NETBSD_VER=$(NETBSD_VER) ../../nbconfig-xen XEN + +netbsd: + cd compile/XEN && TOPDIR=$(TOPDIR) NETBSD_VER=$(NETBSD_VER) ../../nbmake-xen dependall + +install: + @mkdir -p $(dir $(INSTALL_PATH)/$(INSTALL_NAME)) + install -c compile/XEN/netbsd $(INSTALL_PATH)/$(INSTALL_NAME) diff --git a/netbsd-2.0-xen-sparse/mkbuildtree b/netbsd-2.0-xen-sparse/mkbuildtree new file mode 100755 index 0000000000..2db906080a --- /dev/null +++ b/netbsd-2.0-xen-sparse/mkbuildtree @@ -0,0 +1,114 @@ +#!/bin/sh + +# mkbuildtree +# +# Creates symbolic links in 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 +# Creates a tree of symlinks in the current working directory that mirror +# real files in . should be relative to the current +# working directory. Symlinks in 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 "; 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 + + +# Create links to the shared definitions of the hypervisor interface +rm -rf ${AD}/sys/arch/xen/include/hypervisor-ifs +mkdir ${AD}/sys/arch/xen/include/hypervisor-ifs +cd ${AD}/sys/arch/xen/include/hypervisor-ifs +relative_lndir ../../../../../${RS}/../xen/include/hypervisor-ifs + +# Remove files which don't exist anymore +rm -rf ${AD}/sys/arch/xen/xen/events.c +rm -rf ${AD}/sys/arch/xen/include/events.h diff --git a/netbsd-2.0-xen-sparse/nbconfig-xen b/netbsd-2.0-xen-sparse/nbconfig-xen new file mode 100755 index 0000000000..38a485c6a4 --- /dev/null +++ b/netbsd-2.0-xen-sparse/nbconfig-xen @@ -0,0 +1,20 @@ +#! /bin/sh +# + +: ${HOS:=$(uname -s | tr /A-Z/ /a-z/)} +: ${HARCH:=$(uname -i)} +: ${NETBSD_RELEASE:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+\).*/\1/')} +: ${NETBSD_VERSION:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+.*\)-xen.*/\1/')} + +TOOLDIR="$TOPDIR/../netbsd-${NETBSD_RELEASE}-tools/$HOS-$HARCH"; export TOOLDIR + +CONF="$1" +case "$1" in + /*) + CONF="$1" + ;; + *) + CONF="$TOPDIR"/sys/arch/xen/conf/"$1" + ;; +esac +exec "${TOOLDIR}/bin/nbconfig" -b $(pwd) -s "$TOPDIR"/sys "$CONF" diff --git a/netbsd-2.0-xen-sparse/nbmake-xen b/netbsd-2.0-xen-sparse/nbmake-xen new file mode 100755 index 0000000000..7e2178f01e --- /dev/null +++ b/netbsd-2.0-xen-sparse/nbmake-xen @@ -0,0 +1,26 @@ +#! /bin/sh +# Set proper variables to allow easy "make" building of a NetBSD subtree. +# Generated from: $NetBSD: build.sh,v 1.126 2004/02/04 11:23:40 lukem Exp $ +# + +: ${HOS:=$(uname -s | tr /A-Z/ /a-z/)} +: ${HARCH:=$(uname -i)} +: ${NETBSD_RELEASE:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+\).*/\1/')} +: ${NETBSD_VERSION:=$(basename $(cd $(dirname $0) && pwd) | sed 's/netbsd-\([0-9]\+\.[0-9]\+.*\)-xen.*/\1/')} + +NETBSDSRCDIR="$TOPDIR"; export NETBSDSRCDIR +DESTDIR="$TOPDIR/root"; export DESTDIR +unset MAKEOBJDIRPREFIX +MAKEOBJDIR='${.CURDIR:C,^'"$TOPDIR,$TOPDIR/obj,}"; export MAKEOBJDIR +RELEASEDIR="$TOPDIR/release"; export RELEASEDIR +MKUNPRIVED='yes'; export MKUNPRIVED +MAKEVERBOSE='1'; export MAKEVERBOSE +LC_ALL='C'; export LC_ALL +TOOLDIR="$TOPDIR/../netbsd-${NETBSD_RELEASE}-tools/$HOS-$HARCH"; export TOOLDIR +MACHINE='i386'; export MACHINE +MACHINE_ARCH='i386'; export MACHINE_ARCH +MAKEFLAGS="-de -m $TOPDIR/share/mk MKOBJDIRS=yes"; export MAKEFLAGS +BUILDID="${NETBSD_RELEASE}"; export BUILDID +USETOOLS=yes; export USETOOLS + +exec "${TOOLDIR}/bin/nbmake" ${1+"$@"} -- cgit v1.2.3