]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/qemu/qemu.mk
qemu: drop obsolete "--disable-uuid" configuration parameter
[coffee/buildroot.git] / package / qemu / qemu.mk
1 ################################################################################
2 #
3 # qemu
4 #
5 ################################################################################
6
7 QEMU_VERSION = 2.8.0
8 QEMU_SOURCE = qemu-$(QEMU_VERSION).tar.bz2
9 QEMU_SITE = http://wiki.qemu.org/download
10 QEMU_LICENSE = GPL-2.0, LGPL-2.1, MIT, BSD-3-Clause, BSD-2-Clause, Others/BSD-1c
11 QEMU_LICENSE_FILES = COPYING COPYING.LIB
12 # NOTE: there is no top-level license file for non-(L)GPL licenses;
13 #       the non-(L)GPL license texts are specified in the affected
14 #       individual source files.
15
16 #-------------------------------------------------------------
17 # Host-qemu
18
19 HOST_QEMU_DEPENDENCIES = host-pkgconf host-python host-zlib host-libglib2 host-pixman
20
21 #       BR ARCH         qemu
22 #       -------         ----
23 #       arm             arm
24 #       armeb           armeb
25 #       bfin            not supported
26 #       i486            i386
27 #       i586            i386
28 #       i686            i386
29 #       x86_64          x86_64
30 #       m68k            m68k
31 #       microblaze      microblaze
32 #       mips            mips
33 #       mipsel          mipsel
34 #       mips64          mips64
35 #       mips64el        mips64el
36 #       powerpc         ppc
37 #       powerpc64       ppc64
38 #       powerpc64le     ppc64 (system) / ppc64le (usermode)
39 #       sh2a            not supported
40 #       sh4             sh4
41 #       sh4eb           sh4eb
42 #       sh4a            sh4
43 #       sh4aeb          sh4eb
44 #       sh64            not supported
45 #       sparc           sparc
46
47 HOST_QEMU_ARCH = $(ARCH)
48 ifeq ($(HOST_QEMU_ARCH),i486)
49 HOST_QEMU_ARCH = i386
50 endif
51 ifeq ($(HOST_QEMU_ARCH),i586)
52 HOST_QEMU_ARCH = i386
53 endif
54 ifeq ($(HOST_QEMU_ARCH),i686)
55 HOST_QEMU_ARCH = i386
56 endif
57 ifeq ($(HOST_QEMU_ARCH),powerpc)
58 HOST_QEMU_ARCH = ppc
59 endif
60 ifeq ($(HOST_QEMU_ARCH),powerpc64)
61 HOST_QEMU_ARCH = ppc64
62 endif
63 ifeq ($(HOST_QEMU_ARCH),powerpc64le)
64 HOST_QEMU_ARCH = ppc64le
65 HOST_QEMU_SYS_ARCH = ppc64
66 endif
67 ifeq ($(HOST_QEMU_ARCH),sh4a)
68 HOST_QEMU_ARCH = sh4
69 endif
70 ifeq ($(HOST_QEMU_ARCH),sh4aeb)
71 HOST_QEMU_ARCH = sh4eb
72 endif
73 HOST_QEMU_SYS_ARCH ?= $(HOST_QEMU_ARCH)
74
75 ifeq ($(BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE),y)
76 HOST_QEMU_TARGETS += $(HOST_QEMU_SYS_ARCH)-softmmu
77 HOST_QEMU_OPTS += --enable-system --enable-fdt
78 HOST_QEMU_DEPENDENCIES += host-dtc
79 else
80 HOST_QEMU_OPTS += --disable-system
81 endif
82
83 ifeq ($(BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE),y)
84 HOST_QEMU_TARGETS += $(HOST_QEMU_ARCH)-linux-user
85 HOST_QEMU_OPTS += --enable-linux-user
86
87 HOST_QEMU_HOST_SYSTEM_TYPE = $(shell uname -s)
88 ifneq ($(HOST_QEMU_HOST_SYSTEM_TYPE),Linux)
89 $(error "qemu-user can only be used on Linux hosts")
90 endif
91
92 # kernel version as major*256 + minor
93 HOST_QEMU_HOST_SYSTEM_VERSION = $(shell uname -r | awk -F. '{ print $$1 * 256 + $$2 }')
94 HOST_QEMU_TARGET_SYSTEM_VERSION = $(shell echo $(BR2_TOOLCHAIN_HEADERS_AT_LEAST) | awk -F. '{ print $$1 * 256 + $$2 }')
95 HOST_QEMU_COMPARE_VERSION = $(shell test $(HOST_QEMU_HOST_SYSTEM_VERSION) -ge $(HOST_QEMU_TARGET_SYSTEM_VERSION) && echo OK)
96
97 #
98 # The principle of qemu-user is that it emulates the instructions of
99 # the target architecture when running the binary, and then when this
100 # binary does a system call, it converts this system call into a
101 # system call on the host machine. This mechanism makes an assumption:
102 # that the target binary will not do system calls that do not exist on
103 # the host. This basically requires that the target binary should be
104 # built with kernel headers that are older or the same as the kernel
105 # version running on the host machine.
106 #
107
108 ifeq ($(BR_BUILDING),y)
109 ifneq ($(HOST_QEMU_COMPARE_VERSION),OK)
110 $(error "Refusing to build qemu-user: target Linux version newer than host's.")
111 endif
112 endif # BR_BUILDING
113
114 else # BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
115 HOST_QEMU_OPTS += --disable-linux-user
116 endif # BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
117
118 ifeq ($(BR2_PACKAGE_HOST_QEMU_VDE2),y)
119 HOST_QEMU_OPTS += --enable-vde
120 HOST_QEMU_DEPENDENCIES += host-vde2
121 endif
122
123 # Override CPP, as it expects to be able to call it like it'd
124 # call the compiler.
125 define HOST_QEMU_CONFIGURE_CMDS
126         cd $(@D); $(HOST_CONFIGURE_OPTS) CPP="$(HOSTCC) -E" \
127                 ./configure \
128                 --target-list="$(HOST_QEMU_TARGETS)" \
129                 --prefix="$(HOST_DIR)" \
130                 --interp-prefix=$(STAGING_DIR) \
131                 --cc="$(HOSTCC)" \
132                 --host-cc="$(HOSTCC)" \
133                 --python=$(HOST_DIR)/bin/python2 \
134                 --extra-cflags="$(HOST_CFLAGS)" \
135                 --extra-ldflags="$(HOST_LDFLAGS)" \
136                 $(HOST_QEMU_OPTS)
137 endef
138
139 define HOST_QEMU_BUILD_CMDS
140         $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
141 endef
142
143 define HOST_QEMU_INSTALL_CMDS
144         $(HOST_MAKE_ENV) $(MAKE) -C $(@D) install
145 endef
146
147 $(eval $(host-generic-package))
148
149 # variable used by other packages
150 QEMU_USER = $(HOST_DIR)/bin/qemu-$(HOST_QEMU_ARCH)
151
152 #-------------------------------------------------------------
153 # Target-qemu
154
155 QEMU_DEPENDENCIES = host-pkgconf host-python libglib2 zlib pixman
156
157 # Need the LIBS variable because librt and libm are
158 # not automatically pulled. :-(
159 QEMU_LIBS = -lrt -lm
160
161 QEMU_OPTS =
162
163 QEMU_VARS = \
164         LIBTOOL=$(HOST_DIR)/bin/libtool \
165         PYTHON=$(HOST_DIR)/bin/python2 \
166         PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages
167
168 # If we want to specify only a subset of targets, we must still enable all
169 # of them, so that QEMU properly builds its list of default targets, from
170 # which it then checks if the specified sub-set is valid. That's what we
171 # do in the first part of the if-clause.
172 # Otherwise, if we do not want to pass a sub-set of targets, we then need
173 # to either enable or disable -user and/or -system emulation appropriately.
174 # That's what we do in the else-clause.
175 ifneq ($(call qstrip,$(BR2_PACKAGE_QEMU_CUSTOM_TARGETS)),)
176 QEMU_OPTS += --enable-system --enable-linux-user
177 QEMU_OPTS += --target-list="$(call qstrip,$(BR2_PACKAGE_QEMU_CUSTOM_TARGETS))"
178 else
179
180 ifeq ($(BR2_PACKAGE_QEMU_SYSTEM),y)
181 QEMU_OPTS += --enable-system
182 else
183 QEMU_OPTS += --disable-system
184 endif
185
186 ifeq ($(BR2_PACKAGE_QEMU_LINUX_USER),y)
187 QEMU_OPTS += --enable-linux-user
188 else
189 QEMU_OPTS += --disable-linux-user
190 endif
191
192 endif
193
194 ifeq ($(BR2_PACKAGE_QEMU_SDL),y)
195 QEMU_OPTS += --enable-sdl
196 QEMU_DEPENDENCIES += sdl
197 QEMU_VARS += SDL_CONFIG=$(BR2_STAGING_DIR)/usr/bin/sdl-config
198 else
199 QEMU_OPTS += --disable-sdl
200 endif
201
202 ifeq ($(BR2_PACKAGE_QEMU_FDT),y)
203 QEMU_OPTS += --enable-fdt
204 QEMU_DEPENDENCIES += dtc
205 else
206 QEMU_OPTS += --disable-fdt
207 endif
208
209 ifeq ($(BR2_PACKAGE_QEMU_TOOLS),y)
210 QEMU_OPTS += --enable-tools
211 else
212 QEMU_OPTS += --disable-tools
213 endif
214
215 # Override CPP, as it expects to be able to call it like it'd
216 # call the compiler.
217 define QEMU_CONFIGURE_CMDS
218         ( cd $(@D); \
219                 LIBS='$(QEMU_LIBS)' \
220                 $(TARGET_CONFIGURE_OPTS) \
221                 $(TARGET_CONFIGURE_ARGS) \
222                 CPP="$(TARGET_CC) -E" \
223                 $(QEMU_VARS) \
224                 ./configure \
225                         --prefix=/usr \
226                         --cross-prefix=$(TARGET_CROSS) \
227                         --with-system-pixman \
228                         --audio-drv-list= \
229                         --enable-kvm \
230                         --enable-attr \
231                         --enable-vhost-net \
232                         --disable-bsd-user \
233                         --disable-xen \
234                         --disable-slirp \
235                         --disable-vnc \
236                         --disable-virtfs \
237                         --disable-brlapi \
238                         --disable-curses \
239                         --disable-curl \
240                         --disable-bluez \
241                         --disable-vde \
242                         --disable-linux-aio \
243                         --disable-cap-ng \
244                         --disable-docs \
245                         --disable-spice \
246                         --disable-rbd \
247                         --disable-libiscsi \
248                         --disable-usb-redir \
249                         --disable-strip \
250                         --disable-seccomp \
251                         --disable-sparse \
252                         $(QEMU_OPTS) \
253         )
254 endef
255
256 define QEMU_BUILD_CMDS
257         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)
258 endef
259
260 define QEMU_INSTALL_TARGET_CMDS
261         $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(QEMU_MAKE_ENV) DESTDIR=$(TARGET_DIR) install
262 endef
263
264 $(eval $(generic-package))