[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Factor out sparse tree makefile fragments and introduce an alternative hg-clone



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
# Date 1176741517 -3600
# Node ID 98efd2e410ae683b56469b2e5a47813d1766086b
# Parent  52474e2df62810921528877cc5d84364070ca392
Factor out sparse tree makefile fragments and introduce an alternative hg-clone
method in preparation for migrating away from the sparse tree layout.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxxxxx>
---
 buildconfigs/Rules.mk                |   94 +----------------------------------
 buildconfigs/mk.linux-2.6-xen        |   83 +++++++++++++++++++++---------
 buildconfigs/mk.linux-2.6.5-SLES-xen |   12 ++++
 buildconfigs/mk.linux-2.6.9-RHEL-xen |   12 ++++
 buildconfigs/src.hg-clone            |    9 +++
 buildconfigs/src.sparse              |   74 +++++++++++++++++++++++++++
 6 files changed, 167 insertions(+), 117 deletions(-)

diff -r 52474e2df628 -r 98efd2e410ae buildconfigs/Rules.mk
--- a/buildconfigs/Rules.mk     Mon Apr 16 11:42:12 2007 +0100
+++ b/buildconfigs/Rules.mk     Mon Apr 16 17:38:37 2007 +0100
@@ -3,78 +3,8 @@ include Config.mk
 
 export DESTDIR
 
-# Choose the best mirror to download linux kernel
-KERNEL_REPO = http://www.kernel.org
-
 ALLKERNELS = $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.*))
 ALLSPARSETREES = $(patsubst %-xen-sparse,%,$(wildcard *-xen-sparse))
-
-# Setup pristine search path
-PRISTINE_SRC_PATH      ?= .:..
-vpath pristine-% $(PRISTINE_SRC_PATH)
-
-# Let XEN_TARGET_ARCH override ARCH.
-ifeq ($(XEN_TARGET_ARCH),x86_32)
-LINUX_ARCH     ?= i386
-else
-LINUX_ARCH     ?= $(XEN_TARGET_ARCH)
-endif
-
-# Expand Linux series to Linux version
-LINUX_SERIES   ?= 2.6
-LINUX_VER      ?= $(shell grep "^LINUX_VER " buildconfigs/mk.linux-2.6-xen | 
sed -e 's/.*=[ ]*//')
-
-# Setup Linux search path
-LINUX_SRC_PATH ?= .:..
-vpath linux-%.tar.bz2 $(LINUX_SRC_PATH)
-vpath patch-%.bz2 $(LINUX_SRC_PATH)
-
-# download a pristine Linux kernel tarball if there isn't one in LINUX_SRC_PATH
-linux-%.tar.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$*)).$(word 
2,$(subst ., ,$*))
-linux-%.tar.bz2:
-       @echo "Cannot find $@ in path $(LINUX_SRC_PATH)"
-       wget $(KERNEL_REPO)/pub/linux/kernel/v$(_LINUX_VDIR)/$@ -O./$@
-
-patch-%.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$(*F))).$(word 
2,$(subst ., ,$(*F)))
-patch-%.bz2: override _LINUX_XDIR = $(if $(word 3,$(subst -, 
,$(*F))),snapshots,testing)
-patch-%.bz2:
-       @echo "Cannot find $(@F) in path $(LINUX_SRC_PATH)"
-       wget 
$(KERNEL_REPO)/pub/linux/kernel/v$(_LINUX_VDIR)/$(_LINUX_XDIR)/$(@F) -O./$@
-
-pristine-%: pristine-%/.valid-pristine
-       @true
-
-pristine-%/.valid-pristine: %.tar.bz2
-       rm -rf tmp-pristine-$* $(@D)
-       mkdir -p tmp-pristine-$*
-       tar -C tmp-pristine-$* -jxf $<
-       -@rm -f tmp-pristine-$*/pax_global_header
-       mv tmp-pristine-$*/* $(@D)
-       @rm -rf tmp-pristine-$*
-       touch $(@D)/.hgskip
-       touch $@ # update timestamp to avoid rebuild
-
-PATCHDIRS := $(wildcard patches/*-*)
-
-ifneq ($(PATCHDIRS),)
--include $(patsubst %,%/.makedep,$(PATCHDIRS))
-
-$(patsubst patches/%,patches/%/.makedep,$(PATCHDIRS)): patches/%/.makedep: 
-       @echo 'ref-$*/.valid-ref: $$(wildcard patches/$*/*.patch)' >$@
-
-ref-%/.valid-ref: pristine-%/.valid-pristine
-       set -e
-       rm -rf $(@D)
-       cp -al $(<D) $(@D)
-       if [ -d patches/$* ] ; then                                    \
-           echo Applying patches from patches/$*... ;                 \
-           for i in $$(cat patches/$*/series) ; do                    \
-               echo ... $$i ;                                         \
-               patch -d $(@D) -p1 --quiet <patches/$*/$$i || exit 1 ; \
-            done ;                                                    \
-       fi
-       touch $@ # update timestamp to avoid rebuild
-endif
 
 %-install:
        $(MAKE) -f buildconfigs/mk.$* build
@@ -101,32 +31,13 @@ endif
 %-clean:
        $(MAKE) -f buildconfigs/mk.$* clean
 
-linux-2.6-xen.patch: ref-linux-$(LINUX_VER)/.valid-ref
-       rm -rf tmp-$@
-       cp -al $(<D) tmp-$@
-       ( cd linux-2.6-xen-sparse && bash ./mkbuildtree ../tmp-$@ )     
-       diff -Nurp $(patsubst ref%,pristine%,$(<D)) tmp-$@ > $@ || true
-       rm -rf tmp-$@
-
-%-xen.patch: ref-%/.valid-ref
-       rm -rf tmp-$@
-       cp -al $(<D) tmp-$@
-       ( cd $*-xen-sparse && bash ./mkbuildtree ../tmp-$@ )    
-       diff -Nurp $(patsubst ref%,pristine%,$(<D)) tmp-$@ > $@ || true
-       rm -rf tmp-$@
+%.patch:
+       $(MAKE) -f buildconfigs/mk.$* $@
 
 %-mrproper:
-       $(MAKE) -f buildconfigs/mk.$*-xen mrpropper
+       $(MAKE) -f buildconfigs/mk.$*-xen mrproper
        rm -rf pristine-$(*)* ref-$(*)*
        rm -rf $*-xen.patch
 
-.PHONY: config-update-pae
-config-update-pae:
-ifeq ($(XEN_TARGET_X86_PAE),y)
-       sed -e 's!^CONFIG_HIGHMEM4G=y$$!\# CONFIG_HIGHMEM4G is not set!;s!^\# 
CONFIG_HIGHMEM64G is not set$$!CONFIG_HIGHMEM64G=y!' $(CONFIG_FILE) > 
$(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE)
-else
-       grep '^CONFIG_HIGHMEM64G=y' $(CONFIG_FILE) >/dev/null && ( sed -e 
's!^CONFIG_HIGHMEM64G=y$$!\# CONFIG_HIGHMEM64G is not set!;s!^\# 
CONFIG_HIGHMEM4G is not set$$!CONFIG_HIGHMEM4G=y!' $(CONFIG_FILE) > 
$(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) ) || true
-endif
-
 # never delete any intermediate files.
 .SECONDARY:
diff -r 52474e2df628 -r 98efd2e410ae buildconfigs/mk.linux-2.6-xen
--- a/buildconfigs/mk.linux-2.6-xen     Mon Apr 16 11:42:12 2007 +0100
+++ b/buildconfigs/mk.linux-2.6-xen     Mon Apr 16 17:38:37 2007 +0100
@@ -1,7 +1,16 @@ LINUX_SERIES = 2.6
 LINUX_SERIES = 2.6
-LINUX_VER    = 2.6.18
+LINUX_VER    ?= 2.6.18
 
 EXTRAVERSION ?= xen
+
+XEN_LINUX_SOURCE ?= sparse
+
+# Let XEN_TARGET_ARCH override ARCH.
+ifeq ($(XEN_TARGET_ARCH),x86_32)
+LINUX_ARCH     ?= i386
+else
+LINUX_ARCH     ?= $(XEN_TARGET_ARCH)
+endif
 
 LINUX_SRCDIR = linux-$(LINUX_VER)-xen
 LINUX_DIR    = build-linux-$(LINUX_VER)-$(EXTRAVERSION)_$(XEN_TARGET_ARCH)
@@ -15,8 +24,6 @@ endif
 
 LINUX_VER3  := $(LINUX_SERIES).$(word 3, $(subst ., ,$(LINUX_VER)))
 
-include buildconfigs/Rules.mk
-
 # The real action starts here!
 .PHONY: build
 build: $(LINUX_DIR)/include/linux/autoconf.h
@@ -28,31 +35,56 @@ build: $(LINUX_DIR)/include/linux/autoco
        mkdir -p $(INSTALL_BOOT_PATH)
        $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) 
INSTALL_PATH=$(INSTALL_BOOT_PATH) install
 
-$(LINUX_SRCDIR)/.valid-src: ref-linux-$(LINUX_VER)/.valid-ref
-       rm -rf $(LINUX_SRCDIR)
-       cp -al $(<D) $(LINUX_SRCDIR)
-       # Apply arch-xen patches
-       ( cd linux-$(LINUX_SERIES)-xen-sparse && \
-          LINUX_ARCH=$(LINUX_ARCH) bash ./mkbuildtree ../$(LINUX_SRCDIR) )
-       # Patch kernel Makefile to set EXTRAVERSION
-       ( cd $(LINUX_SRCDIR) ; \
-         sed -e 's,^EXTRAVERSION.*,&$$(XENGUEST),' \
-             -e 's,^KERNELRELEASE,XENGUEST := $$(shell [ -r 
$$(objtree)/.xenguest ] \&\& cat $$(objtree)/.xenguest)\n&,' Makefile >Mk.tmp ; 
\
-         rm -f Makefile ; mv Mk.tmp Makefile )
-       touch $@
-
+$(LINUX_DIR)/include/linux/autoconf.h: CONFIG_FILE=$(PWD)/$(LINUX_DIR)/.config
 $(LINUX_DIR)/include/linux/autoconf.h: $(LINUX_SRCDIR)/.valid-src
        rm -rf $(LINUX_DIR)
        mkdir -p $(LINUX_DIR)
-       # Re-use config from install dir if one exits else use default config
+       # Re-use config from install dir if one exists else use the 
create_config.sh provided
+       # by the source tree.
        CONFIG_VERSION=$$(sed -ne 's/$$(XENGUEST)//; s/^EXTRAVERSION = //p' 
$(LINUX_SRCDIR)/Makefile); \
-       [ -r 
$(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) ] && \
-         cp 
$(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) 
$(LINUX_DIR)/.config \
-         || sh buildconfigs/create_config.sh $(LINUX_DIR)/.config 
$(EXTRAVERSION) $(XEN_TARGET_ARCH) $(XEN_SYSTYPE)
-       # See if we need to munge config to enable PAE
-       $(MAKE) CONFIG_FILE=$(LINUX_DIR)/.config -f buildconfigs/Rules.mk 
config-update-pae
-       echo "-$(EXTRAVERSION)" >$(LINUX_DIR)/.xenguest
+       if [ -r 
$(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) ] ; then \
+         cp 
$(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) 
$(CONFIG_FILE) ; \
+        else \
+         cd $(LINUX_SRCDIR) && sh buildconfigs/create_config.sh \
+               $(CONFIG_FILE) $(EXTRAVERSION) $(XEN_TARGET_ARCH) 
$(XEN_SYSTYPE) ; \
+       fi
+ifeq ($(XEN_TARGET_ARCH),x86_32)
+ifeq ($(XEN_TARGET_X86_PAE),y)
+       sed -e 's!^CONFIG_HIGHMEM4G=y$$!\# CONFIG_HIGHMEM4G is not set!;s!^\# 
CONFIG_HIGHMEM64G is not set$$!CONFIG_HIGHMEM64G=y!' $(CONFIG_FILE) > 
$(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE)
+else
+       grep '^CONFIG_HIGHMEM64G=y' $(CONFIG_FILE) >/dev/null && ( sed -e 
's!^CONFIG_HIGHMEM64G=y$$!\# CONFIG_HIGHMEM64G is not set!;s!^\# 
CONFIG_HIGHMEM4G is not set$$!CONFIG_HIGHMEM4G=y!' $(CONFIG_FILE) > 
$(CONFIG_FILE)- && mv $(CONFIG_FILE)- $(CONFIG_FILE) ) || true
+endif
+endif
+       echo "-$(EXTRAVERSION)" >$(LINUX_DIR)/localversion-xen
        $(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) oldconfig 
O=$$(/bin/pwd)/$(LINUX_DIR)
+       @if [ ! -f $(LINUX_DIR)/Makefile ] ; then \
+           echo "***********************************"; \
+           echo "oldconfig did not create a Makefile"; \
+           echo "Generating $(LINUX_DIR)/Makefile   "; \
+           echo "***********************************"; \
+           ( echo "# Automatically generated: don't edit"; \
+             echo ""; \
+             echo "VERSION = 2"; \
+             echo "PATCHLEVEL = 6"; \
+             echo ""; \
+             echo "KERNELSRC    := $(PWD)/$(LINUX_SRCDIR)"; \
+             echo "KERNELOUTPUT := $(PWD)/$(LINUX_DIR)"; \
+             echo ""; \
+             echo "MAKEFLAGS += --no-print-directory"; \
+             echo ""; \
+             echo ".PHONY: all \$$(MAKECMDGOALS)"; \
+             echo ""; \
+             echo "all:"; \
+             echo "    \$$(MAKE) -C \$$(KERNELSRC) O=\$$(KERNELOUTPUT)"; \
+             echo ""; \
+             echo "Makefile:;"; \
+             echo ""; \
+             echo "\$$(filter-out all Makefile,\$$(MAKECMDGOALS)) %/:"; \
+             echo "    \$$(MAKE) -C \$$(KERNELSRC) O=\$$(KERNELOUTPUT) \$$@"; \
+           ) > $(LINUX_DIR)/Makefile ; \
+       fi
+
+include buildconfigs/src.$(XEN_LINUX_SOURCE)
 
 .PHONY: prep
 prep: $(LINUX_DIR)/include/linux/autoconf.h
@@ -67,12 +99,11 @@ clean::
        [ ! -d $(LINUX_DIR) ] || \
                $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
 
-
 .PHONY: delete
 delete: 
        rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) 
 
-.PHONY: mrpropper
-mrpropper:
+.PHONY: mrproper
+mrproper:
        rm -rf $(LINUX_SRCDIR)
        rm -f linux-$(LINUX_VER).tar.bz2
diff -r 52474e2df628 -r 98efd2e410ae buildconfigs/mk.linux-2.6.5-SLES-xen
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/buildconfigs/mk.linux-2.6.5-SLES-xen      Mon Apr 16 17:38:37 2007 +0100
@@ -0,0 +1,12 @@
+# This tree only supports PAE
+XEN_TARGET_ARCH = x86_32
+XEN_TARGET_X86_PAE = y
+
+EXTRAVERSION = xen
+LINUX_VER = 2.6.5-SLES
+
+XEN_LINUX_SOURCE = hg-clone
+XEN_LINUX_HGREPO ?= http://xenbits.xensource.com/kernels/sles9x.hg
+XEN_LINUX_HGREV  ?= tip
+
+include buildconfigs/mk.linux-2.6-xen
diff -r 52474e2df628 -r 98efd2e410ae buildconfigs/mk.linux-2.6.9-RHEL-xen
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/buildconfigs/mk.linux-2.6.9-RHEL-xen      Mon Apr 16 17:38:37 2007 +0100
@@ -0,0 +1,12 @@
+# This tree only supports PAE
+XEN_TARGET_ARCH = x86_32
+XEN_TARGET_X86_PAE = y
+
+EXTRAVERSION = xen
+LINUX_VER = 2.6.9-RHEL
+
+XEN_LINUX_SOURCE = hg-clone
+XEN_LINUX_HGREPO ?= http://xenbits.xensource.com/kernels/rhel4x.hg
+XEN_LINUX_HGREV  ?= tip
+
+include buildconfigs/mk.linux-2.6-xen
diff -r 52474e2df628 -r 98efd2e410ae buildconfigs/src.hg-clone
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/buildconfigs/src.hg-clone Mon Apr 16 17:38:37 2007 +0100
@@ -0,0 +1,9 @@
+XEN_LINUX_HGREPO ?= http://xenbits.xensource.com/linux-$(LINUX_VER)-xen.hg
+XEN_LINUX_HGREV  ?= tip
+
+$(LINUX_SRCDIR)/.valid-src:
+# TODO handle updating an existing clone?
+       if [ ! -d $(LINUX_SRCDIR) ] ; then \
+           hg clone -r $(XEN_LINUX_HGREV) $(XEN_LINUX_HGREPO) $(LINUX_SRCDIR); 
\
+       fi
+       touch $@
diff -r 52474e2df628 -r 98efd2e410ae buildconfigs/src.sparse
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/buildconfigs/src.sparse   Mon Apr 16 17:38:37 2007 +0100
@@ -0,0 +1,74 @@
+# Choose the best mirror to download linux kernel
+KERNEL_REPO = http://www.kernel.org
+
+# Setup pristine search path
+PRISTINE_SRC_PATH      ?= .:..
+vpath pristine-% $(PRISTINE_SRC_PATH)
+
+# Setup Linux search path
+LINUX_SRC_PATH ?= .:..
+vpath linux-%.tar.bz2 $(LINUX_SRC_PATH)
+vpath patch-%.bz2 $(LINUX_SRC_PATH)
+
+# download a pristine Linux kernel tarball if there isn't one in LINUX_SRC_PATH
+linux-%.tar.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$*)).$(word 
2,$(subst ., ,$*))
+linux-%.tar.bz2:
+       @echo "Cannot find $@ in path $(LINUX_SRC_PATH)"
+       wget $(KERNEL_REPO)/pub/linux/kernel/v$(_LINUX_VDIR)/$@ -O./$@
+
+patch-%.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$(*F))).$(word 
2,$(subst ., ,$(*F)))
+patch-%.bz2: override _LINUX_XDIR = $(if $(word 3,$(subst -, 
,$(*F))),snapshots,testing)
+patch-%.bz2:
+       @echo "Cannot find $(@F) in path $(LINUX_SRC_PATH)"
+       wget 
$(KERNEL_REPO)/pub/linux/kernel/v$(_LINUX_VDIR)/$(_LINUX_XDIR)/$(@F) -O./$@
+
+pristine-%: pristine-%/.valid-pristine
+       @true
+
+pristine-%/.valid-pristine: %.tar.bz2
+       rm -rf tmp-pristine-$* $(@D)
+       mkdir -p tmp-pristine-$*
+       tar -C tmp-pristine-$* -jxf $<
+       -@rm -f tmp-pristine-$*/pax_global_header
+       mv tmp-pristine-$*/* $(@D)
+       @rm -rf tmp-pristine-$*
+       touch $(@D)/.hgskip
+       touch $@ # update timestamp to avoid rebuild
+
+PATCHDIRS := $(wildcard patches/*-*)
+
+ifneq ($(PATCHDIRS),)
+-include $(patsubst %,%/.makedep,$(PATCHDIRS))
+
+$(patsubst patches/%,patches/%/.makedep,$(PATCHDIRS)): patches/%/.makedep: 
+       @echo 'ref-$*/.valid-ref: $$(wildcard patches/$*/*.patch)' >$@
+
+ref-%/.valid-ref: pristine-%/.valid-pristine
+       set -e
+       rm -rf $(@D)
+       cp -al $(<D) $(@D)
+       if [ -d patches/$* ] ; then                                    \
+           echo Applying patches from patches/$*... ;                 \
+           for i in $$(cat patches/$*/series) ; do                    \
+               echo ... $$i ;                                         \
+               patch -d $(@D) -p1 --quiet <patches/$*/$$i || exit 1 ; \
+            done ;                                                    \
+       fi
+       touch $@ # update timestamp to avoid rebuild
+endif
+
+$(LINUX_SRCDIR)/.valid-src: ref-linux-$(LINUX_VER)/.valid-ref
+       rm -rf $(LINUX_SRCDIR)
+       cp -al $(<D) $(LINUX_SRCDIR)
+       # Apply arch-xen patches
+       ( cd linux-$(LINUX_SERIES)-xen-sparse && \
+          LINUX_ARCH=$(LINUX_ARCH) bash ./mkbuildtree ../$(LINUX_SRCDIR) )
+       ( cd $(LINUX_SRCDIR) && ln -s $(PWD)/buildconfigs buildconfigs )
+       touch $@
+
+linux-2.6-xen.patch: ref-linux-$(LINUX_VER)/.valid-ref
+       rm -rf tmp-$@
+       cp -al $(<D) tmp-$@
+       ( cd linux-2.6-xen-sparse && bash ./mkbuildtree ../tmp-$@ )
+       diff -Nurp $(patsubst ref%,pristine%,$(<D)) tmp-$@ > $@ || true
+       rm -rf tmp-$@

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.