debuggers.hg

view Config.mk @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents 9dca60d88c63
children e429b133278b
line source
1 # -*- mode: Makefile; -*-
3 # A debug build of Xen and tools?
4 debug ?= y
6 XEN_COMPILE_ARCH ?= $(shell uname -m | sed -e s/i.86/x86_32/ \
7 -e s/i86pc/x86_32/ -e s/amd64/x86_64/)
8 XEN_TARGET_ARCH ?= $(XEN_COMPILE_ARCH)
9 XEN_OS ?= $(shell uname -s)
11 CONFIG_$(XEN_OS) := y
13 SHELL ?= /bin/sh
15 # Tools to run on system hosting the build
16 HOSTCC = gcc
17 HOSTCFLAGS = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
18 HOSTCFLAGS += -fno-strict-aliasing
20 DISTDIR ?= $(XEN_ROOT)/dist
21 DESTDIR ?= /
23 # Allow phony attribute to be listed as dependency rather than fake target
24 .PHONY: .phony
26 include $(XEN_ROOT)/config/$(XEN_OS).mk
27 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
29 SHAREDIR ?= $(PREFIX)/share
30 DOCDIR ?= $(SHAREDIR)/doc/xen
31 MANDIR ?= $(SHAREDIR)/man
32 BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d
34 # arguments: variable, common path part, path to test, if yes, if no
35 define setvar_dir
36 ifndef $(1)
37 ifneq (,$(wildcard $(2)$(3)))
38 $(1) ?= $(2)$(4)
39 else
40 $(1) ?= $(2)$(5)
41 endif
42 endif
43 endef
45 # See distro_mapping.txt for other options
46 $(eval $(call setvar_dir,CONFIG_LEAF_DIR,,/etc/sysconfig,sysconfig,default))
47 $(eval $(call setvar_dir,SUBSYS_DIR,/var/run,/subsys,/subsys,))
48 $(eval $(call setvar_dir,INITD_DIR,/etc,/rc.d/init.d,/rc.d/init.d,/init.d))
50 ifneq ($(EXTRA_PREFIX),)
51 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
52 EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
53 endif
55 BISON ?= bison
56 FLEX ?= flex
58 PYTHON ?= python
59 PYTHON_PREFIX_ARG ?= --prefix="$(PREFIX)"
60 # The above requires that PREFIX contains *no spaces*. This variable is here
61 # to permit the user to set PYTHON_PREFIX_ARG to '' to workaround this bug:
62 # https://bugs.launchpad.net/ubuntu/+bug/362570
64 # cc-option: Check if compiler supports first option, else fall back to second.
65 # Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
66 cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
67 /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
69 # cc-option-add: Add an option to compilation flags, but only if supported.
70 # Usage: $(call cc-option-add CFLAGS,CC,-march=winchip-c6)
71 cc-option-add = $(eval $(call cc-option-add-closure,$(1),$(2),$(3)))
72 define cc-option-add-closure
73 ifneq ($$(call cc-option,$$($(2)),$(3),n),n)
74 $(1) += $(3)
75 endif
76 endef
78 cc-options-add = $(foreach o,$(3),$(call cc-option-add,$(1),$(2),$(o)))
80 # cc-ver: Check compiler is at least specified version. Return boolean 'y'/'n'.
81 # Usage: ifeq ($(call cc-ver,$(CC),0x030400),y)
82 cc-ver = $(shell if [ $$((`$(1) -dumpversion | awk -F. \
83 '{ printf "0x%02x%02x%02x", $$1, $$2, $$3}'`)) -ge $$(($(2))) ]; \
84 then echo y; else echo n; fi ;)
86 # cc-ver-check: Check compiler is at least specified version, else fail.
87 # Usage: $(call cc-ver-check,CC,0x030400,"Require at least gcc-3.4")
88 cc-ver-check = $(eval $(call cc-ver-check-closure,$(1),$(2),$(3)))
89 define cc-ver-check-closure
90 ifeq ($$(call cc-ver,$$($(1)),$(2)),n)
91 override $(1) = echo "*** FATAL BUILD ERROR: "$(3) >&2; exit 1;
92 cc-option := n
93 endif
94 endef
96 define absolutify_xen_root
97 case "$(XEN_ROOT)" in \
98 /*) XEN_ROOT=$(XEN_ROOT) ;; \
99 *) xen_root_lhs=`pwd`; \
100 xen_root_rhs=$(XEN_ROOT)/; \
101 while [ "x$${xen_root_rhs#../}" != "x$$xen_root_rhs" ]; do \
102 xen_root_rhs="$${xen_root_rhs#../}"; \
103 xen_root_rhs="$${xen_root_rhs#/}"; \
104 xen_root_rhs="$${xen_root_rhs#/}"; \
105 xen_root_lhs="$${xen_root_lhs%/*}"; \
106 done; \
107 XEN_ROOT="$$xen_root_lhs/$$xen_root_rhs" ;; \
108 esac; \
109 export XEN_ROOT
110 endef
112 define buildmakevars2shellvars
113 PREFIX="$(PREFIX)"; \
114 XEN_SCRIPT_DIR="$(XEN_SCRIPT_DIR)"; \
115 export PREFIX; \
116 export XEN_SCRIPT_DIR
117 endef
119 buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1)))
120 define buildmakevars2file-closure
121 .PHONY: genpath
122 genpath:
123 rm -f $(1).tmp; \
124 echo "SBINDIR=\"$(SBINDIR)\"" >> $(1).tmp; \
125 echo "BINDIR=\"$(BINDIR)\"" >> $(1).tmp; \
126 echo "LIBEXEC=\"$(LIBEXEC)\"" >> $(1).tmp; \
127 echo "LIBDIR=\"$(LIBDIR)\"" >> $(1).tmp; \
128 echo "SHAREDIR=\"$(SHAREDIR)\"" >> $(1).tmp; \
129 echo "PRIVATE_BINDIR=\"$(PRIVATE_BINDIR)\"" >> $(1).tmp; \
130 echo "XENFIRMWAREDIR=\"$(XENFIRMWAREDIR)\"" >> $(1).tmp; \
131 echo "XEN_CONFIG_DIR=\"$(XEN_CONFIG_DIR)\"" >> $(1).tmp; \
132 echo "XEN_SCRIPT_DIR=\"$(XEN_SCRIPT_DIR)\"" >> $(1).tmp; \
133 echo "XEN_LOCK_DIR=\"$(XEN_LOCK_DIR)\"" >> $(1).tmp; \
134 if ! cmp $(1).tmp $(1); then mv -f $(1).tmp $(1); fi
135 endef
137 ifeq ($(debug),y)
138 CFLAGS += -g
139 endif
141 CFLAGS += -fno-strict-aliasing
143 CFLAGS += -std=gnu99
145 CFLAGS += -Wall -Wstrict-prototypes
147 # -Wunused-value makes GCC 4.x too aggressive for my taste: ignoring the
148 # result of any casted expression causes a warning.
149 CFLAGS += -Wno-unused-value
151 $(call cc-option-add,HOSTCFLAGS,HOSTCC,-Wdeclaration-after-statement)
152 $(call cc-option-add,CFLAGS,CC,-Wdeclaration-after-statement)
154 LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i))
155 CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
157 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
158 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
160 # Enable XSM security module. Enabling XSM requires selection of an
161 # XSM security module (FLASK_ENABLE or ACM_SECURITY).
162 XSM_ENABLE ?= n
163 FLASK_ENABLE ?= n
164 ACM_SECURITY ?= n
166 # Download GIT repositories via HTTP or GIT's own protocol?
167 # GIT's protocol is faster and more robust, when it works at all (firewalls
168 # may block it). We make it the default, but if your GIT repository downloads
169 # fail or hang, please specify GIT_HTTP=y in your environment.
170 GIT_HTTP ?= n
172 XEN_EXTFILES_URL=http://xenbits.xensource.com/xen-extfiles
173 # All the files at that location were downloaded from elsewhere on
174 # the internet. The original download URL is preserved as a comment
175 # near the place in the Xen Makefiles where the file is used.
177 ifeq ($(GIT_HTTP),y)
178 QEMU_REMOTE=http://xenbits.xensource.com/git-http/qemu-xen-unstable.git
179 else
180 QEMU_REMOTE=git://xenbits.xensource.com/qemu-xen-unstable.git
181 endif
183 # Specify which qemu-dm to use. This may be `ioemu' to use the old
184 # Mercurial in-tree version, or a local directory, or a git URL.
185 # CONFIG_QEMU ?= $(XEN_ROOT)/../qemu-xen.git
186 CONFIG_QEMU ?= $(QEMU_REMOTE)
188 QEMU_TAG := xen-4.1.0-rc2
189 #QEMU_TAG ?= 6a6ffc07f465d5abc94b45ce6fe389369d1395ab
190 # Fri Jan 21 18:01:53 2011 +0000
191 # qemu-xen: disable buffering on the save file for stubdoms
193 # Optional components
194 XENSTAT_XENTOP ?= y
195 VTPM_TOOLS ?= n
196 LIBXENAPI_BINDINGS ?= n
197 PYTHON_TOOLS ?= y
198 OCAML_TOOLS ?= y
199 CONFIG_MINITERM ?= n
200 CONFIG_LOMOUNT ?= n
202 ifeq ($(OCAML_TOOLS),y)
203 OCAML_TOOLS := $(shell ocamlopt -v > /dev/null 2>&1 && echo "y" || echo "n")
204 endif
206 -include $(XEN_ROOT)/.config