direct-io.hg

view buildconfigs/mk.linux-2.6-xen @ 15505:224da1b2c5c2

Add hooks for a script to update kernel configuration after tree has been
prepared. This is to support upstream sources which do not enable Xen in their
default configurations.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Mon Jul 09 11:29:39 2007 +0100 (2007-07-09)
parents 806dc0aca747
children
line source
1 LINUX_SERIES = 2.6
2 LINUX_VER ?= 2.6.18
4 EXTRAVERSION ?= -xen
6 # Linux search path, will be searched for tarballs and mercurial
7 # repositories.
8 LINUX_SRC_PATH ?= .:..
10 XEN_LINUX_SOURCE ?= hg-clone
12 # Let XEN_TARGET_ARCH override ARCH.
13 ifeq ($(XEN_TARGET_ARCH),x86_32)
14 LINUX_ARCH ?= i386
15 else
16 LINUX_ARCH ?= $(XEN_TARGET_ARCH)
17 endif
19 LINUX_DIR = build-linux-$(LINUX_VER)$(EXTRAVERSION)_$(XEN_TARGET_ARCH)
21 IMAGE_TARGET ?= vmlinuz
22 INSTALL_BOOT_PATH := $(DESTDIR)/boot
24 LINUX_VER3 := $(LINUX_SERIES).$(word 3, $(subst ., ,$(LINUX_VER)))
26 .PHONY: _build
27 _build: build
29 include buildconfigs/src.$(XEN_LINUX_SOURCE)
31 # Default to allowing interface mismatch
32 ifndef XEN_LINUX_ALLOW_INTERFACE_MISMATCH
33 XEN_LINUX_ALLOW_INTERFACE_MISMATCH := y
34 endif
36 # The real action starts here!
37 .PHONY: build
38 build: $(LINUX_DIR)/include/linux/autoconf.h
39 ifneq ($(XEN_LINUX_ALLOW_INTERFACE_MISMATCH),y)
40 @if ! diff -urN -X buildconfigs/interface.exclude \
41 $(LINUX_SRCDIR)/include/xen/interface xen/include/public ; then \
42 echo "" 1>&2 ; \
43 echo " *** $(LINUX_SRCDIR)/include/xen/interface is out of date " 1>&2 ; \
44 echo " *** relative to $(XEN_ROOT)/xen/include/public." 1>&2 ; \
45 echo "" 1>&2 ; \
46 exit 1 ; \
47 fi
48 endif
49 if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \
50 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) modules ; \
51 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_MOD_PATH=$(DESTDIR) modules_install ; \
52 fi
53 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(DESTDIR) $(IMAGE_TARGET)
54 mkdir -p $(INSTALL_BOOT_PATH)
55 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(INSTALL_BOOT_PATH) install
57 $(LINUX_DIR)/include/linux/autoconf.h: CONFIG_FILE=$(CURDIR)/$(LINUX_DIR)/.config
58 $(LINUX_DIR)/include/linux/autoconf.h: $(LINUX_SRCDIR)/.valid-src
59 rm -rf $(LINUX_DIR)
60 mkdir -p $(LINUX_DIR)
61 # Re-use config from install dir if one exists. Next try to use
62 # buildconfigs/create_config.sh is one is provided by the source
63 # tree. Finally attempt to use make defconfig.
64 set -e ; \
65 CONFIG_VERSION=$$(sed -ne 's/$$(XENGUEST)//; s/^EXTRAVERSION = //p' $(LINUX_SRCDIR)/Makefile); \
66 if [ -r $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION$(EXTRAVERSION) ] ; then \
67 cp $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION$(EXTRAVERSION) $(CONFIG_FILE) ; \
68 elif [ -e $(LINUX_SRCDIR)/buildconfigs/create_config.sh ] ; then \
69 cd $(LINUX_SRCDIR) && sh buildconfigs/create_config.sh \
70 $(CONFIG_FILE) $(EXTRAVERSION) $(XEN_TARGET_ARCH) $(XEN_SYSTYPE) ; \
71 echo "Configured $(LINUX_DIR) using create_config.sh" ; \
72 elif $(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) defconfig O=$$(/bin/pwd)/$(LINUX_DIR) ; then \
73 echo "Configured $(LINUX_DIR) using defconfig" ; \
74 else \
75 echo "No configuration method found for this kernel" ; \
76 fi
77 ifneq ($(XEN_LINUX_CONFIG_UPDATE),)
78 echo "Updating $(CONFIG_FILE) using $(XEN_LINUX_CONFIG_UPDATE)"
79 sh $(XEN_LINUX_CONFIG_UPDATE) $(CONFIG_FILE)
80 endif
81 ifeq ($(XEN_TARGET_ARCH),x86_32)
82 ifeq ($(pae),y)
83 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)
84 else
85 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
86 endif
87 endif
88 ifneq ($(EXTRAVERSION),)
89 echo "$(EXTRAVERSION)" >$(LINUX_DIR)/localversion-xen
90 endif
91 $(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) oldconfig O=$$(/bin/pwd)/$(LINUX_DIR)
92 @if [ ! -f $(LINUX_DIR)/Makefile ] ; then \
93 echo "***********************************"; \
94 echo "oldconfig did not create a Makefile"; \
95 echo "Generating $(LINUX_DIR)/Makefile "; \
96 echo "***********************************"; \
97 ( echo "# Automatically generated: don't edit"; \
98 echo ""; \
99 echo "VERSION = 2"; \
100 echo "PATCHLEVEL = 6"; \
101 echo ""; \
102 echo "KERNELSRC := $(CURDIR)/$(LINUX_SRCDIR)"; \
103 echo "KERNELOUTPUT := $(CURDIR)/$(LINUX_DIR)"; \
104 echo ""; \
105 echo "MAKEFLAGS += --no-print-directory"; \
106 echo ""; \
107 echo ".PHONY: all \$$(MAKECMDGOALS)"; \
108 echo ""; \
109 echo "all:"; \
110 echo " \$$(MAKE) -C \$$(KERNELSRC) O=\$$(KERNELOUTPUT)"; \
111 echo ""; \
112 echo "Makefile:;"; \
113 echo ""; \
114 echo "\$$(filter-out all Makefile,\$$(MAKECMDGOALS)) %/:"; \
115 echo " \$$(MAKE) -C \$$(KERNELSRC) O=\$$(KERNELOUTPUT) \$$@"; \
116 ) > $(LINUX_DIR)/Makefile ; \
117 fi
119 .PHONY: prep
120 prep: $(LINUX_DIR)/include/linux/autoconf.h
122 .PHONY: config
123 config: CONFIGMODE = menuconfig
124 config: $(LINUX_DIR)/include/linux/autoconf.h
125 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) $(CONFIGMODE)
127 .PHONY: clean
128 clean::
129 [ ! -d $(LINUX_DIR) ] || \
130 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
132 .PHONY: delete
133 delete:
134 rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) $(LINUX_SRCDIR)
136 .PHONY: mrproper
137 mrproper:
138 rm -rf $(LINUX_SRCDIR)
139 rm -f linux-$(LINUX_VER).tar.bz2