Files
xen/buildconfigs/src.sparse
T
Ian Campbell 7a35a3f0b5 Factor out sparse tree makefile fragments and introduce hg-clone and
tarball methods in preparation for migrating away from the sparse tree
layout.

This re-introduces 14883:6568c1882af5 and 14862:98efd2e410ae plus
further fixes.

Also add makefile fragments to support building the paravirt ops tree
(make linux-2.6-paravirt-build).

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
2007-05-25 11:03:40 +01:00

77 lines
2.6 KiB
Plaintext

# Choose the best mirror to download linux kernel
KERNEL_REPO = http://www.kernel.org
LINUX_SRCDIR ?= linux-$(LINUX_VER)-xen
# 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) && [ -e buildconfigs ] || 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-$@