1 | |
---|
2 | include Config.mk |
---|
3 | |
---|
4 | export DESTDIR |
---|
5 | |
---|
6 | # Choose the best mirror to download linux kernel |
---|
7 | KERNEL_REPO = http://www.kernel.org |
---|
8 | |
---|
9 | ALLKERNELS = $(patsubst buildconfigs/mk.%,%,$(wildcard buildconfigs/mk.*)) |
---|
10 | ALLSPARSETREES = $(patsubst %-xen-sparse,%,$(wildcard *-xen-sparse)) |
---|
11 | |
---|
12 | # Setup pristine search path |
---|
13 | PRISTINE_SRC_PATH ?= .:.. |
---|
14 | vpath pristine-% $(PRISTINE_SRC_PATH) |
---|
15 | |
---|
16 | # Let XEN_TARGET_ARCH override ARCH. |
---|
17 | ifeq ($(XEN_TARGET_ARCH),x86_32) |
---|
18 | LINUX_ARCH ?= i386 |
---|
19 | else |
---|
20 | LINUX_ARCH ?= $(XEN_TARGET_ARCH) |
---|
21 | endif |
---|
22 | |
---|
23 | # Expand Linux series to Linux version |
---|
24 | LINUX_SERIES ?= 2.6 |
---|
25 | LINUX_VER ?= $(shell grep "^LINUX_VER " buildconfigs/mk.linux-2.6-xen | sed -e 's/.*=[ ]*//') |
---|
26 | |
---|
27 | # Setup Linux search path |
---|
28 | LINUX_SRC_PATH ?= .:.. |
---|
29 | vpath linux-%.tar.bz2 $(LINUX_SRC_PATH) |
---|
30 | vpath patch-%.bz2 $(LINUX_SRC_PATH) |
---|
31 | |
---|
32 | # download a pristine Linux kernel tarball if there isn't one in LINUX_SRC_PATH |
---|
33 | linux-%.tar.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$*)).$(word 2,$(subst ., ,$*)) |
---|
34 | linux-%.tar.bz2: |
---|
35 | @echo "Cannot find $@ in path $(LINUX_SRC_PATH)" |
---|
36 | wget $(KERNEL_REPO)/pub/linux/kernel/v$(_LINUX_VDIR)/$@ -O./$@ |
---|
37 | |
---|
38 | patch-%.bz2: override _LINUX_VDIR = $(word 1,$(subst ., ,$(*F))).$(word 2,$(subst ., ,$(*F))) |
---|
39 | patch-%.bz2: override _LINUX_XDIR = $(if $(word 3,$(subst -, ,$(*F))),snapshots,testing) |
---|
40 | patch-%.bz2: |
---|
41 | @echo "Cannot find $(@F) in path $(LINUX_SRC_PATH)" |
---|
42 | wget $(KERNEL_REPO)/pub/linux/kernel/v$(_LINUX_VDIR)/$(_LINUX_XDIR)/$(@F) -O./$@ |
---|
43 | |
---|
44 | pristine-%: pristine-%/.valid-pristine |
---|
45 | @true |
---|
46 | |
---|
47 | pristine-%/.valid-pristine: %.tar.bz2 |
---|
48 | rm -rf tmp-pristine-$* $(@D) |
---|
49 | mkdir -p tmp-pristine-$* |
---|
50 | tar -C tmp-pristine-$* -jxf $< |
---|
51 | -@rm -f tmp-pristine-$*/pax_global_header |
---|
52 | mv tmp-pristine-$*/* $(@D) |
---|
53 | @rm -rf tmp-pristine-$* |
---|
54 | touch $(@D)/.hgskip |
---|
55 | touch $@ # update timestamp to avoid rebuild |
---|
56 | |
---|
57 | PATCHDIRS := $(wildcard patches/*-*) |
---|
58 | |
---|
59 | ifneq ($(PATCHDIRS),) |
---|
60 | -include $(patsubst %,%/.makedep,$(PATCHDIRS)) |
---|
61 | |
---|
62 | $(patsubst patches/%,patches/%/.makedep,$(PATCHDIRS)): patches/%/.makedep: |
---|
63 | @echo 'ref-$*/.valid-ref: $$(wildcard patches/$*/*.patch)' >$@ |
---|
64 | |
---|
65 | ref-%/.valid-ref: pristine-%/.valid-pristine |
---|
66 | set -e |
---|
67 | rm -rf $(@D) |
---|
68 | cp -al $(<D) $(@D) |
---|
69 | if [ -d patches/$* ] ; then \ |
---|
70 | echo Applying patches from patches/$*... ; \ |
---|
71 | for i in $$(cat patches/$*/series) ; do \ |
---|
72 | echo ... $$i ; \ |
---|
73 | patch -d $(@D) -p1 --quiet <patches/$*/$$i || exit 1 ; \ |
---|
74 | done ; \ |
---|
75 | fi |
---|
76 | touch $@ # update timestamp to avoid rebuild |
---|
77 | endif |
---|
78 | |
---|
79 | %-install: |
---|
80 | $(MAKE) -f buildconfigs/mk.$* build |
---|
81 | |
---|
82 | %-dist: DESTDIR=$(DISTDIR)/install |
---|
83 | %-dist: %-install |
---|
84 | @: # do nothing |
---|
85 | |
---|
86 | # Legacy dist target |
---|
87 | %-build: %-dist |
---|
88 | @: # do nothing |
---|
89 | |
---|
90 | %-prep: DESTDIR=$(DISTDIR)/install |
---|
91 | %-prep: |
---|
92 | $(MAKE) -f buildconfigs/mk.$* prep |
---|
93 | |
---|
94 | %-config: DESTDIR=$(DISTDIR)/install |
---|
95 | %-config: |
---|
96 | $(MAKE) -f buildconfigs/mk.$* config |
---|
97 | |
---|
98 | %-delete: |
---|
99 | $(MAKE) -f buildconfigs/mk.$* delete |
---|
100 | |
---|
101 | %-clean: |
---|
102 | $(MAKE) -f buildconfigs/mk.$* clean |
---|
103 | |
---|
104 | linux-2.6-xen.patch: ref-linux-$(LINUX_VER)/.valid-ref |
---|
105 | rm -rf tmp-$@ |
---|
106 | cp -al $(<D) tmp-$@ |
---|
107 | ( cd linux-2.6-xen-sparse && bash ./mkbuildtree ../tmp-$@ ) |
---|
108 | diff -Nurp $(patsubst ref%,pristine%,$(<D)) tmp-$@ > $@ || true |
---|
109 | rm -rf tmp-$@ |
---|
110 | |
---|
111 | %-xen.patch: ref-%/.valid-ref |
---|
112 | rm -rf tmp-$@ |
---|
113 | cp -al $(<D) tmp-$@ |
---|
114 | ( cd $*-xen-sparse && bash ./mkbuildtree ../tmp-$@ ) |
---|
115 | diff -Nurp $(patsubst ref%,pristine%,$(<D)) tmp-$@ > $@ || true |
---|
116 | rm -rf tmp-$@ |
---|
117 | |
---|
118 | %-mrproper: |
---|
119 | $(MAKE) -f buildconfigs/mk.$*-xen mrpropper |
---|
120 | rm -rf pristine-$(*)* ref-$(*)* |
---|
121 | rm -rf $*-xen.patch |
---|
122 | |
---|
123 | .PHONY: config-update-pae |
---|
124 | config-update-pae: |
---|
125 | ifeq ($(XEN_TARGET_X86_PAE),y) |
---|
126 | 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) |
---|
127 | else |
---|
128 | 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 |
---|
129 | endif |
---|
130 | |
---|
131 | # never delete any intermediate files. |
---|
132 | .SECONDARY: |
---|