1 | LINUX_SERIES = 2.6 |
---|
2 | LINUX_VER = 2.6.18 |
---|
3 | |
---|
4 | EXTRAVERSION ?= xen |
---|
5 | |
---|
6 | LINUX_SRCDIR = linux-$(LINUX_VER)-xen |
---|
7 | LINUX_DIR = build-linux-$(LINUX_VER)-$(EXTRAVERSION)_$(XEN_TARGET_ARCH) |
---|
8 | |
---|
9 | IMAGE_TARGET ?= vmlinuz |
---|
10 | INSTALL_BOOT_PATH ?= $(DESTDIR) |
---|
11 | |
---|
12 | ifeq ($(XEN_TARGET_ARCH),ia64) |
---|
13 | INSTALL_BOOT_PATH := $(DESTDIR)/boot |
---|
14 | endif |
---|
15 | |
---|
16 | LINUX_VER3 := $(LINUX_SERIES).$(word 3, $(subst ., ,$(LINUX_VER))) |
---|
17 | |
---|
18 | include buildconfigs/Rules.mk |
---|
19 | |
---|
20 | # The real action starts here! |
---|
21 | .PHONY: build |
---|
22 | build: $(LINUX_DIR)/include/linux/autoconf.h |
---|
23 | if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \ |
---|
24 | $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) modules ; \ |
---|
25 | $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_MOD_PATH=$(DESTDIR) modules_install ; \ |
---|
26 | fi |
---|
27 | $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(DESTDIR) $(IMAGE_TARGET) |
---|
28 | mkdir -p $(INSTALL_BOOT_PATH) |
---|
29 | $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(INSTALL_BOOT_PATH) install |
---|
30 | |
---|
31 | $(LINUX_SRCDIR)/.valid-src: ref-linux-$(LINUX_VER)/.valid-ref |
---|
32 | rm -rf $(LINUX_SRCDIR) |
---|
33 | cp -al $(<D) $(LINUX_SRCDIR) |
---|
34 | # Apply arch-xen patches |
---|
35 | ( cd linux-$(LINUX_SERIES)-xen-sparse && \ |
---|
36 | LINUX_ARCH=$(LINUX_ARCH) bash ./mkbuildtree ../$(LINUX_SRCDIR) ) |
---|
37 | # Patch kernel Makefile to set EXTRAVERSION |
---|
38 | ( cd $(LINUX_SRCDIR) ; \ |
---|
39 | sed -e 's,^EXTRAVERSION.*,&$$(XENGUEST),' \ |
---|
40 | -e 's,^KERNELRELEASE,XENGUEST := $$(shell [ -r $$(objtree)/.xenguest ] \&\& cat $$(objtree)/.xenguest)\n&,' Makefile >Mk.tmp ; \ |
---|
41 | rm -f Makefile ; mv Mk.tmp Makefile ) |
---|
42 | touch $@ |
---|
43 | |
---|
44 | $(LINUX_DIR)/include/linux/autoconf.h: $(LINUX_SRCDIR)/.valid-src |
---|
45 | rm -rf $(LINUX_DIR) |
---|
46 | mkdir -p $(LINUX_DIR) |
---|
47 | # Re-use config from install dir if one exits else use default config |
---|
48 | CONFIG_VERSION=$$(sed -ne 's/$$(XENGUEST)//; s/^EXTRAVERSION = //p' $(LINUX_SRCDIR)/Makefile); \ |
---|
49 | [ -r $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) ] && \ |
---|
50 | cp $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) $(LINUX_DIR)/.config \ |
---|
51 | || sh buildconfigs/create_config.sh $(LINUX_DIR)/.config $(EXTRAVERSION) $(XEN_TARGET_ARCH) $(XEN_SYSTYPE) |
---|
52 | # See if we need to munge config to enable PAE |
---|
53 | $(MAKE) CONFIG_FILE=$(LINUX_DIR)/.config -f buildconfigs/Rules.mk config-update-pae |
---|
54 | echo "-$(EXTRAVERSION)" >$(LINUX_DIR)/.xenguest |
---|
55 | $(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) oldconfig O=$$(/bin/pwd)/$(LINUX_DIR) |
---|
56 | |
---|
57 | .PHONY: prep |
---|
58 | prep: $(LINUX_DIR)/include/linux/autoconf.h |
---|
59 | |
---|
60 | .PHONY: config |
---|
61 | config: CONFIGMODE = menuconfig |
---|
62 | config: $(LINUX_DIR)/include/linux/autoconf.h |
---|
63 | $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) $(CONFIGMODE) |
---|
64 | |
---|
65 | .PHONY: clean |
---|
66 | clean:: |
---|
67 | [ ! -d $(LINUX_DIR) ] || \ |
---|
68 | $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean |
---|
69 | |
---|
70 | |
---|
71 | .PHONY: delete |
---|
72 | delete: |
---|
73 | rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) |
---|
74 | |
---|
75 | .PHONY: mrpropper |
---|
76 | mrpropper: |
---|
77 | rm -rf $(LINUX_SRCDIR) |
---|
78 | rm -f linux-$(LINUX_VER).tar.bz2 |
---|