1 XEN_ROOT
= $(CURDIR
)/..
5 LINUX_STUBDOM_GIT_URL ?
= git
://git.kernel.org
/pub
/scm
/linux
/kernel
/git
/jeremy
/xen.git
6 LINUX_SRCDIR
= linux-src-
$(STUBDOM_ARCH
).git
8 XEN_LINUX_GIT_REMOTEBRANCH ?
= xen
/stable-2.6
.32.x
9 XEN_LINUX_GIT_LOCALBRANCH ?
= $(XEN_LINUX_GIT_REMOTEBRANCH
)
10 XEN_LINUX_GITREV ?
= $(XEN_GIT_ORIGIN
)/$(XEN_LINUX_GIT_REMOTEBRANCH
)
12 #build linux-stubdom kernel
13 IMAGE_TARGET ?
= bzImage
14 LINUX_DIR
= build-linux-
$(STUBDOM_ARCH
)
15 INSTALL_PATH
= install-stubdom-
$(STUBDOM_ARCH
)
16 LINUX_ARCH
= $$(sh
$(CURDIR
)/select-linux-arch
$(LINUX_SRCDIR
) $(STUBDOM_ARCH
))
18 #download upstream qemu
19 IOEMU_GIT_URL ?
= git
://xenbits.xen.org
/people
/aperard
/qemu-dm.git
20 IOEMU_SRCDIR
= ioemu-src-
$(STUBDOM_ARCH
).git
21 IOEMU_GIT_ORIGIN ?
= origin
22 IOEMU_GIT_REMOTEBRANCH ?
= qemu-dm-v15
23 IOEMU_GIT_LOCALBRANCH ?
= $(IOEMU_GIT_REMOTEBRANCH
)
24 IOEMU_GITREV ?
= $(IOEMU_GIT_ORIGIN
)/$(IOEMU_GIT_REMOTEBRANCH
)
27 LIBXL_DIR
= libxl-
$(STUBDOM_ARCH
)
28 LIBXL_SRCDIR
= $(XEN_ROOT
)/tools
/libxl
31 UDEV_URL?
= http
://www.us.kernel.org
/pub
/linux
/utils
/kernel
/hotplug
35 IOEMU_DIR
= build-ioemu-
$(STUBDOM_ARCH
)
38 QEMU_WRAPPER_DIR
= qemu-wrapper
39 QEMU_WRAPPER
= qemu-wrapper
50 ######################
51 # download source code
52 ######################
54 .PHONY
: download-linux-src
56 if
! [ -d
$(LINUX_SRCDIR
) ]; then \
57 rm -rf
$(LINUX_SRCDIR
) $(LINUX_SRCDIR
).tmp
; \
58 mkdir
$(LINUX_SRCDIR
).tmp
; rmdir
$(LINUX_SRCDIR
).tmp
; \
59 $(GIT
) clone
-o
$(XEN_GIT_ORIGIN
) -n
$(LINUX_STUBDOM_GIT_URL
) $(LINUX_SRCDIR
).tmp
; \
60 (cd
$(LINUX_SRCDIR
).tmp
; git checkout
-b
$(XEN_LINUX_GIT_LOCALBRANCH
) $(XEN_LINUX_GITREV
); git checkout
); \
61 mv
$(LINUX_SRCDIR
).tmp
$(LINUX_SRCDIR
); \
62 patch
-d
$(LINUX_SRCDIR
) -p1
< linux-src.patch
; \
65 .PHONY
: download-ioemu-src
67 if
! [ -d
$(IOEMU_SRCDIR
) ]; then \
68 rm -rf
$(IOEMU_SRCDIR
) $(IOEMU_SRCDIR
).tmp
; \
69 mkdir
$(IOEMU_SRCDIR
).tmp
; rmdir
$(IOEMU_SRCDIR
).tmp
; \
70 $(GIT
) clone
-o
$(IOEMU_GIT_ORIGIN
) -n
$(IOEMU_GIT_URL
) $(IOEMU_SRCDIR
).tmp
; \
71 (cd
$(IOEMU_SRCDIR
).tmp
; git checkout
-b
$(IOEMU_GIT_LOCALBRANCH
) $(IOEMU_GITREV
); git checkout
);\
72 mv
$(IOEMU_SRCDIR
).tmp
$(IOEMU_SRCDIR
);\
79 TARGETS_LINUX
=$(addprefix linux-stubdom-
$(STUBDOM_ARCH
)-,$(TARGETS
))
80 LINUX_STUBDOM_CONFIG
=$(addprefix linux-config-
,$(TARGETS
))
81 MAKE_RAMDISK_SCRIPT
=$(addprefix mk-ramdisk-
,$(TARGETS
))
82 $(TARGETS_LINUX
):download-linux-src
84 mkdir
-p
$@
/$(LINUX_DIR
)
85 mkdir
-p
$@
/$(INSTALL_PATH
)
86 if
[ ! -f
$@
/$(LINUX_DIR
)/.config
]; then \
87 cp
$(LINUX_STUBDOM_CONFIG
) $@
/$(LINUX_DIR
)/.config
;\
88 $(MAKE
) -C
$(LINUX_SRCDIR
) ARCH
=$(LINUX_ARCH
) oldconfig O
=$$(/bin
/pwd
)/$@
/$(LINUX_DIR
);\
89 $(MAKE
) -C
$@
/$(LINUX_DIR
) ARCH
=$(LINUX_ARCH
) prepare
;\
91 if grep
"^CONFIG_MODULES=" $@
/$(LINUX_DIR
)/.config
; then \
92 $(MAKE
) -C
$@
/$(LINUX_DIR
) ARCH
=$(LINUX_ARCH
) modules || exit
1 ; \
93 $(MAKE
) -C
$@
/$(LINUX_DIR
) ARCH
=$(LINUX_ARCH
) INSTALL_MOD_PATH
=$(CURDIR
)/$@
/$(INSTALL_PATH
) modules_install
; \
95 $(MAKE
) -C
$@
/$(LINUX_DIR
) ARCH
=$(LINUX_ARCH
) INSTALL_PATH
=$@
/$(INSTALL_PATH
) $(IMAGE_TARGET
)
96 @cp
-v
$@
/$(LINUX_DIR
)/arch
/$(LINUX_ARCH
)/boot
/bzImage
$@
/$(INSTALL_PATH
)/vmlinuz-
$(TARGETS
)
97 @cp
-v
$@
/$(LINUX_DIR
)/.config
$@
/$(INSTALL_PATH
)/config-
$(TARGETS
)
98 @cp
-v
$@
/$(LINUX_DIR
)/System.map
$@
/$(INSTALL_PATH
)/System.map-
$(TARGETS
)
104 linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/.link-ioemu-dir
:
105 mkdir
-p linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(IOEMU_DIR
)
107 cd linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(IOEMU_DIR
); \
108 (cd
$(CURDIR
)/$(IOEMU_SRCDIR
) && find
* -type d
-print) | xargs mkdir
-p
; \
109 (cd
$(CURDIR
)/$(IOEMU_SRCDIR
) && find
* ! -type l
-type f
$(addprefix ! -name
, \
110 '*.[oda1]' 'config-*' config.mak \
113 while read f
; do
rm -f
"$$f"; ln
-s
"$(CURDIR)/$(IOEMU_SRCDIR)/$$f" "$$f"; done
114 patch
-d linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(IOEMU_DIR
) -p1
< ioemu-stubdom.patch
115 patch
-d linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(IOEMU_DIR
) -p1
< ioemu-fbdev.patch
116 touch linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/.link-ioemu-dir
119 ioemu
: download-ioemu-src linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/.link-ioemu-dir
120 $(warning
"build upstream qemu")
121 (cd linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(IOEMU_DIR
); \
122 sh configure
--target-list
=i386-softmmu
--enable-xen
--enable-stubdom \
123 --extra-cflags
=-I
$(XEN_ROOT
)/dist/install/usr
/include --extra-ldflags
=-L
$(XEN_ROOT
)/dist/install/usr
/lib
; \
125 cp
-af i386-softmmu
/qemu ..
/$(INSTALL_PATH
))
132 mkdir
-p
$(LIBXL_DIR
)
135 (cd
$(LIBXL_SRCDIR
) && $(MAKE
) clean);\
136 (cd
$(LIBXL_SRCDIR
) && find
* ! -type l
-type f
$(addprefix ! -name
, \
137 '*.[oda1]' 'config-*' config.mak \
140 while read f
; do
rm -f
"$$f"; ln
-s
"$(LIBXL_SRCDIR)/$$f" "$$f"; done
141 patch
-d
$(LIBXL_DIR
) -p3
< libxl.patch
142 touch .link-libxl-dir
145 libxl
: .link-libxl-dir
146 (cd
$(LIBXL_DIR
);$(MAKE
) install;)
152 udev-
$(UDEV_VERSION
).
tar.bz2
:
153 $(WGET
) $(UDEV_URL
)/$@
156 udev
: udev-
$(UDEV_VERSION
).
tar.bz2
158 ( cd udev-
$(UDEV_VERSION
); \
160 cp
-af udevd ..
/linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(INSTALL_PATH
);\
161 cp
-af udevstart ..
/linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(INSTALL_PATH
))
169 ( cd
$(QEMU_WRAPPER_DIR
); \
170 $(MAKE
) XEN_ROOT
=$(XEN_ROOT
);\
171 cp
-af
$(QEMU_WRAPPER
) ..
/linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(INSTALL_PATH
))
174 ###########################
175 # functional-linux-stubdoms
176 ###########################
178 .PHONY
: ioemu-stubdom
179 ioemu-stubdom
: libxl linux-stubdom-
$(STUBDOM_ARCH
)-ioemu ioemu qemu-wrapper udev
180 $(warning
"ioemu-linux-stubdom")
181 sh
$(MAKE_RAMDISK_SCRIPT
) linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(INSTALL_PATH
) ramdisk-
$(TARGETS
) ioemu
183 .PHONY
: xenstore-stubdom
184 xenstore-linux-stubdom
:
185 $(warning
"xenstore-linux-stubdom")
191 include $(XEN_ROOT
)/config
/StdGNU.mk
194 install: install-ioemu
196 install-ioemu
: ioemu-stubdom
197 $(INSTALL_DIR
) "$(XENFIRMWAREDIR)"
198 $(INSTALL_DATA
) linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(INSTALL_PATH
)/vmlinuz-ioemu
"$(XENFIRMWAREDIR)/vmlinuz-ioemu"
199 $(INSTALL_DATA
) linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
/$(INSTALL_PATH
)/ramdisk-ioemu
"$(XENFIRMWAREDIR)/ramdisk-ioemu"
205 # Only clean the build stuff
208 rm -fr linux-stubdom-
$(STUBDOM_ARCH
)-ioemu
209 rm -fr udev-
$(UDEV_VERSION
)
210 rm -fr
$(LIBXL_DIR
) .link-libxl-dir
211 (cd
$(QEMU_WRAPPER_DIR
); $(MAKE
) clean)
213 .PHONY
: downloadclean
215 rm -fr
$(LINUX_SRCDIR
)
216 rm -fr
$(IOEMU_SRCDIR
)
217 rm -fr udev-
$(UDEV_VERSION
).
tar.bz2