ia64/xen-unstable

view buildconfigs/mk.linux-2.6-common @ 18836:ab0c1bdede53

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