ia64/xen-unstable

view buildconfigs/mk.linux-2.6-xen @ 16070:65c4977850d7

Revert 16065:671dcd08e806 and try again to fix the issue.

Changing LINUX_VER causes us to clone the wrong repository so instead
use the kernel's "kernelrelease" target to figure out the correct
Linux version.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Keir Fraser <keir@xensource.com>
date Thu Oct 04 14:21:11 2007 +0100 (2007-10-04)
parents 671dcd08e806
children cc58c6f3950e
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 # The source directory is not automatically updated to avoid blowing
11 # away developer's changes. If you want to automatically pull a new
12 # version of the Linux tree then add `XEN_LINUX_UPDATE=y' to your make
13 # command line.
14 ifeq ($(XEN_LINUX_UPDATE),y)
15 __XEN_LINUX_UPDATE = $(LINUX_SRCDIR)/.force-update
16 else
17 __XEN_LINUX_UPDATE =
18 endif
20 XEN_LINUX_SOURCE ?= hg-clone
22 # Let XEN_TARGET_ARCH override ARCH.
23 ifeq ($(XEN_TARGET_ARCH),x86_32)
24 LINUX_ARCH ?= i386
25 else
26 LINUX_ARCH ?= $(XEN_TARGET_ARCH)
27 endif
29 LINUX_DIR = build-linux-$(LINUX_VER)$(EXTRAVERSION)_$(XEN_TARGET_ARCH)
31 IMAGE_TARGET ?= vmlinuz
32 ifneq ($(XEN_TARGET_ARCH),ia64)
33 IMAGE_PATH ?= arch/$(LINUX_ARCH)/boot/$(firstword $(IMAGE_TARGET))
34 else
35 IMAGE_PATH ?= arch/ia64/hp/sim/boot/vmlinux.gz
36 endif
37 INSTALL_BOOT_PATH := $(DESTDIR)/boot
39 LINUX_VER3 := $(LINUX_SERIES).$(word 3, $(subst ., ,$(LINUX_VER)))
41 .PHONY: _build
42 _build: build
44 include buildconfigs/src.$(XEN_LINUX_SOURCE)
46 # Default to allowing interface mismatch
47 ifndef XEN_LINUX_ALLOW_INTERFACE_MISMATCH
48 XEN_LINUX_ALLOW_INTERFACE_MISMATCH := y
49 endif
51 KERNELRELEASE = $(shell $(MAKE) -s --no-print-directory -C $(LINUX_DIR) kernelrelease)
53 # The real action starts here!
54 .PHONY: build
55 build: $(LINUX_DIR)/include/linux/autoconf.h
56 ifneq ($(XEN_LINUX_ALLOW_INTERFACE_MISMATCH),y)
57 @if ! diff -urN -X buildconfigs/interface.exclude \
58 $(LINUX_SRCDIR)/include/xen/interface xen/include/public ; then \
59 echo "" 1>&2 ; \
60 echo " *** $(LINUX_SRCDIR)/include/xen/interface is out of date " 1>&2 ; \
61 echo " *** relative to $(XEN_ROOT)/xen/include/public." 1>&2 ; \
62 echo "" 1>&2 ; \
63 exit 1 ; \
64 fi
65 endif
66 if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \
67 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) modules ; \
68 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_MOD_PATH=$(DESTDIR) modules_install ; \
69 fi
70 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(DESTDIR) $(IMAGE_TARGET)
71 mkdir -p $(INSTALL_BOOT_PATH)
72 cp $(LINUX_DIR)/$(IMAGE_PATH) $(INSTALL_BOOT_PATH)/vmlinuz-$(KERNELRELEASE)
73 cp $(LINUX_DIR)/.config $(INSTALL_BOOT_PATH)/config-$(KERNELRELEASE)
74 cp $(LINUX_DIR)/System.map $(INSTALL_BOOT_PATH)/System.map-$(KERNELRELEASE)
76 $(LINUX_DIR)/include/linux/autoconf.h: CONFIG_FILE=$(CURDIR)/$(LINUX_DIR)/.config
77 $(LINUX_DIR)/include/linux/autoconf.h: $(LINUX_SRCDIR)/.valid-src
78 rm -rf $(LINUX_DIR)
79 mkdir -p $(LINUX_DIR)
80 # Re-use config from install dir if one exists. Next try to use
81 # buildconfigs/create_config.sh is one is provided by the source
82 # tree. Finally attempt to use make defconfig.
83 set -e ; \
84 CONFIG_VERSION=$$(sed -ne 's/$$(XENGUEST)//; s/^EXTRAVERSION = //p' $(LINUX_SRCDIR)/Makefile); \
85 if [ -r $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION$(EXTRAVERSION) ] ; then \
86 cp $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION$(EXTRAVERSION) $(CONFIG_FILE) ; \
87 elif [ -e $(LINUX_SRCDIR)/buildconfigs/create_config.sh ] ; then \
88 cd $(LINUX_SRCDIR) && sh buildconfigs/create_config.sh \
89 $(CONFIG_FILE) $(EXTRAVERSION) $(XEN_TARGET_ARCH) $(XEN_SYSTYPE) ; \
90 echo "Configured $(LINUX_DIR) using create_config.sh" ; \
91 elif $(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) defconfig O=$$(/bin/pwd)/$(LINUX_DIR) ; then \
92 echo "Configured $(LINUX_DIR) using defconfig" ; \
93 else \
94 echo "No configuration method found for this kernel" ; \
95 fi
96 ifneq ($(XEN_LINUX_CONFIG_UPDATE),)
97 echo "Updating $(CONFIG_FILE) using $(XEN_LINUX_CONFIG_UPDATE)"
98 sh $(XEN_LINUX_CONFIG_UPDATE) $(CONFIG_FILE)
99 endif
100 ifeq ($(XEN_TARGET_ARCH),x86_32)
101 ifeq ($(pae),y)
102 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)
103 else
104 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
105 endif
106 endif
107 ifneq ($(EXTRAVERSION),)
108 echo "$(EXTRAVERSION)" >$(LINUX_DIR)/localversion-xen
109 endif
110 $(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) oldconfig O=$$(/bin/pwd)/$(LINUX_DIR)
111 @if [ ! -f $(LINUX_DIR)/Makefile ] ; then \
112 echo "***********************************"; \
113 echo "oldconfig did not create a Makefile"; \
114 echo "Generating $(LINUX_DIR)/Makefile "; \
115 echo "***********************************"; \
116 ( echo "# Automatically generated: don't edit"; \
117 echo ""; \
118 echo "VERSION = 2"; \
119 echo "PATCHLEVEL = 6"; \
120 echo ""; \
121 echo "KERNELSRC := $(CURDIR)/$(LINUX_SRCDIR)"; \
122 echo "KERNELOUTPUT := $(CURDIR)/$(LINUX_DIR)"; \
123 echo ""; \
124 echo "MAKEFLAGS += --no-print-directory"; \
125 echo ""; \
126 echo ".PHONY: all \$$(MAKECMDGOALS)"; \
127 echo ""; \
128 echo "all:"; \
129 echo " \$$(MAKE) -C \$$(KERNELSRC) O=\$$(KERNELOUTPUT)"; \
130 echo ""; \
131 echo "Makefile:;"; \
132 echo ""; \
133 echo "\$$(filter-out all Makefile,\$$(MAKECMDGOALS)) %/:"; \
134 echo " \$$(MAKE) -C \$$(KERNELSRC) O=\$$(KERNELOUTPUT) \$$@"; \
135 ) > $(LINUX_DIR)/Makefile ; \
136 fi
137 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) prepare
139 .PHONY: prep
140 prep: $(LINUX_DIR)/include/linux/autoconf.h
142 .PHONY: config
143 config: CONFIGMODE = menuconfig
144 config: $(LINUX_DIR)/include/linux/autoconf.h
145 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) $(CONFIGMODE)
147 .PHONY: clean
148 clean::
149 [ ! -d $(LINUX_DIR) ] || \
150 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
152 .PHONY: delete
153 delete:
154 rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) $(LINUX_SRCDIR)
156 .PHONY: mrproper
157 mrproper:
158 rm -rf $(LINUX_SRCDIR)
159 rm -f linux-$(LINUX_VER).tar.bz2
161 .PHONY: $(LINUX_SRCDIR)/.force-update
162 $(LINUX_SRCDIR)/.force-update:
163 @ :