ia64/xen-unstable

changeset 13322:c89384734c19

[linux build] Build Linux kernels with output files in a separate directory.
Use a single source tree (linux-2.6-xen) and use Linux' O= option to
make the build put output files in a
build-linux-$(LINUX_VER)-$(EXTRAVERSION)_$(XEN_TARGET_ARCH) directory,
making it possible to build both x86_32 and x86_64 kernels in the same
tree.

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author Christian Limpach <Christian.Limpach@xensource.com>
date Mon Jan 08 11:33:45 2007 +0000 (2007-01-08)
parents 9ba91a854787
children a06ee98fa3b6 7878db2276c9
files .hgignore buildconfigs/mk.linux-2.6-xen
line diff
     1.1 --- a/.hgignore	Sat Jan 06 15:56:52 2007 +0000
     1.2 +++ b/.hgignore	Mon Jan 08 11:33:45 2007 +0000
     1.3 @@ -20,6 +20,7 @@
     1.4  ^\.config$
     1.5  ^TAGS$
     1.6  ^tags$
     1.7 +^build.*$
     1.8  ^dist/.*$
     1.9  ^docs/.*\.aux$
    1.10  ^docs/.*\.dvi$
     2.1 --- a/buildconfigs/mk.linux-2.6-xen	Sat Jan 06 15:56:52 2007 +0000
     2.2 +++ b/buildconfigs/mk.linux-2.6-xen	Mon Jan 08 11:33:45 2007 +0000
     2.3 @@ -3,7 +3,8 @@ LINUX_VER    = 2.6.16.33
     2.4  
     2.5  EXTRAVERSION ?= xen
     2.6  
     2.7 -LINUX_DIR    = linux-$(LINUX_VER)-$(EXTRAVERSION)
     2.8 +LINUX_SRCDIR = linux-$(LINUX_VER)-xen
     2.9 +LINUX_DIR    = build-linux-$(LINUX_VER)-$(EXTRAVERSION)_$(XEN_TARGET_ARCH)
    2.10  
    2.11  IMAGE_TARGET ?= vmlinuz
    2.12  INSTALL_BOOT_PATH ?= $(DESTDIR)
    2.13 @@ -23,24 +24,30 @@ build: $(LINUX_DIR)/include/linux/autoco
    2.14  	mkdir -p $(INSTALL_BOOT_PATH)
    2.15  	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(INSTALL_BOOT_PATH) install
    2.16  
    2.17 -$(LINUX_DIR)/include/linux/autoconf.h: ref-linux-$(LINUX_VER)/.valid-ref
    2.18 -	rm -rf $(LINUX_DIR)
    2.19 -	cp -al $(<D) $(LINUX_DIR)
    2.20 +$(LINUX_SRCDIR)/.valid-src: ref-linux-$(LINUX_VER)/.valid-ref
    2.21 +	rm -rf $(LINUX_SRCDIR)
    2.22 +	cp -al $(<D) $(LINUX_SRCDIR)
    2.23  	# Apply arch-xen patches
    2.24  	( cd linux-$(LINUX_SERIES)-xen-sparse && \
    2.25 -          LINUX_ARCH=$(LINUX_ARCH) bash ./mkbuildtree ../$(LINUX_DIR) )
    2.26 +          LINUX_ARCH=$(LINUX_ARCH) bash ./mkbuildtree ../$(LINUX_SRCDIR) )
    2.27 +	# Patch kernel Makefile to set EXTRAVERSION
    2.28 +	( cd $(LINUX_SRCDIR) ; \
    2.29 +	  sed -e 's,^EXTRAVERSION.*,&$$(XENGUEST)\nXENGUEST := $$(shell [ -r $$(objtree)/.xenguest ] \&\& cat $$(objtree)/.xenguest),' Makefile >Mk.tmp ; \
    2.30 +	  rm -f Makefile ; mv Mk.tmp Makefile )
    2.31 +	touch $@
    2.32 +
    2.33 +$(LINUX_DIR)/include/linux/autoconf.h: $(LINUX_SRCDIR)/.valid-src
    2.34 +	rm -rf $(LINUX_DIR)
    2.35 +	mkdir -p $(LINUX_DIR)
    2.36  	# Re-use config from install dir if one exits else use default config
    2.37 -	CONFIG_VERSION=$$(sed -ne 's/^EXTRAVERSION = //p' $(LINUX_DIR)/Makefile); \
    2.38 +	CONFIG_VERSION=$$(sed -ne 's/$$(XENGUEST)//; s/^EXTRAVERSION = //p' $(LINUX_SRCDIR)/Makefile); \
    2.39  	[ -r $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) ] && \
    2.40  	  cp $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) $(LINUX_DIR)/.config \
    2.41  	  || sh buildconfigs/create_config.sh $(LINUX_DIR)/.config $(EXTRAVERSION) $(XEN_TARGET_ARCH) $(XEN_SYSTYPE)
    2.42  	# See if we need to munge config to enable PAE
    2.43  	$(MAKE) CONFIG_FILE=$(LINUX_DIR)/.config -f buildconfigs/Rules.mk config-update-pae
    2.44 -	# Patch kernel Makefile to set EXTRAVERSION
    2.45 -	( cd $(LINUX_DIR) ; \
    2.46 -	  sed -e 's/^EXTRAVERSION.*/&$$(XENGUEST)\nXENGUEST = -$(EXTRAVERSION)/' Makefile >Mk.tmp ; \
    2.47 -	  rm -f Makefile ; mv Mk.tmp Makefile )
    2.48 -	$(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) oldconfig
    2.49 +	echo "-$(EXTRAVERSION)" >$(LINUX_DIR)/.xenguest
    2.50 +	$(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) oldconfig O=$$(/bin/pwd)/$(LINUX_DIR)
    2.51  
    2.52  .PHONY: prep
    2.53  prep: $(LINUX_DIR)/include/linux/autoconf.h
    2.54 @@ -62,4 +69,5 @@ delete:
    2.55  
    2.56  .PHONY: mrpropper
    2.57  mrpropper:
    2.58 +	rm -rf $(LINUX_SRCDIR)
    2.59  	rm -f linux-$(LINUX_VER).tar.bz2