source: trunk/packages/xen-common/xen-common/buildconfigs/mk.linux-2.6-xen @ 77

Last change on this file since 77 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 2.7 KB
Line 
1LINUX_SERIES = 2.6
2LINUX_VER    = 2.6.18
3
4EXTRAVERSION ?= xen
5
6LINUX_SRCDIR = linux-$(LINUX_VER)-xen
7LINUX_DIR    = build-linux-$(LINUX_VER)-$(EXTRAVERSION)_$(XEN_TARGET_ARCH)
8
9IMAGE_TARGET ?= vmlinuz
10INSTALL_BOOT_PATH ?= $(DESTDIR)
11
12ifeq ($(XEN_TARGET_ARCH),ia64)
13INSTALL_BOOT_PATH := $(DESTDIR)/boot
14endif
15
16LINUX_VER3  := $(LINUX_SERIES).$(word 3, $(subst ., ,$(LINUX_VER)))
17
18include buildconfigs/Rules.mk
19
20# The real action starts here!
21.PHONY: build
22build: $(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
58prep: $(LINUX_DIR)/include/linux/autoconf.h
59
60.PHONY: config
61config: CONFIGMODE = menuconfig
62config: $(LINUX_DIR)/include/linux/autoconf.h
63        $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) $(CONFIGMODE)
64
65.PHONY: clean
66clean::
67        [ ! -d $(LINUX_DIR) ] || \
68                $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
69
70
71.PHONY: delete
72delete:
73        rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR)
74
75.PHONY: mrpropper
76mrpropper:
77        rm -rf $(LINUX_SRCDIR)
78        rm -f linux-$(LINUX_VER).tar.bz2
Note: See TracBrowser for help on using the repository browser.