Skip to contentSkip to conversation

Migrating away from the sparse tree.

PATCH Ian Campbell 1 participant 1 message Apr 12, 2007

lore
Share & tools
lore
#0 lore raw

For some time now there has been talk of moving away from the sparse tree structure used for Linux in the Xen releases.

A proposed patch is attached. It adds the infrastructure for supporting different Linux source trees but leaves the default as the sparse tree (see phase 2 below).

The sparse tree targets are factored into a separate file (buildconfigs/src.sparse) which is selected based on $(XEN_LINUX_SOURCE). I've also added buildconfigs/src.hg-clone and example rules which use it to build RHEL4x and SLES9x kernels from xenbits. e.g.

        make linux-2.6.9-RHEL-xen-build
        make linux-2.6.5-SLES-xen-build

would clone the relevant trees and build them. I'd also like to get a tree based on the upstreaming effort integrated in a similar manner.

If there was a suitable tree available then
make linux-2.6-xen-build XEN_LINUX_SOURCE=hg-clone XEN_LINUX_HGREPO=foo.hg
should also work.

Phase 2 would be to create the linux-2.6.18-xen.hg tree, switching the default to use it and removing the sparse tree. This would involve applying the patches directory + sparse tree to a 2.6.18 repository.

Ideally that would be a simple clone of the kernel.org tree, but:

        $ time hg clone http://www.kernel.org/hg/linux-2.6 upstream
        requesting all changes
        adding changesets
        adding manifests
        adding file changes
        added 51554 changesets with 440268 changes to 24323 files (+1 heads)
        21615 files updated, 0 files merged, 0 files removed, 0 files unresolved
        real    29m20.315s
        user    2m14.372s
        sys     0m17.345s

This is a tip tree so has more history than just a 2.6.18 clone but not by enough to make a big dent in that half an hour. Unfortunately mercurial doesn't yet appear to have support for dropping old history from a repository[0].

We could create our own repository based on the 2.6.18 tarball which would be much smaller but would have no history. For comparison the rhel4x.hg repository (which uses essentially that scheme) took 1m48 to clone (it's also on a local mirror so much nearer than kernel.org).

Anyone have any other ideas?

Ian.

[0] i.e. something like the proposed "punch" support discussed here:
http://www.selenic.com/mercurial/wiki/index.cgi/TrimmingHistory

buildconfigs/Rules.mk +3 -92
diff -r 423c4a7b82e6 buildconfigs/Rules.mk
@@ -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:
buildconfigs/mk.linux-2.6-xen +57 -26

115 lines not on this page · raw message

buildconfigs/mk.linux-2.6.5-SLES-xen new file +12 -0
diff -r 423c4a7b82e6 buildconfigs/mk.linux-2.6.5-SLES-xen
@@ -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
buildconfigs/mk.linux-2.6.9-RHEL-xen new file +12 -0
diff -r 423c4a7b82e6 buildconfigs/mk.linux-2.6.9-RHEL-xen
@@ -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
buildconfigs/src.hg-clone new file +9 -0
diff -r 423c4a7b82e6 buildconfigs/src.hg-clone
@@ -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 $@
buildconfigs/src.sparse new file +74 -0

74 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel