summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu
diff options
context:
space:
mode:
authorZhai Edwin <edwin.zhai@intel.com>2012-05-29 16:30:33 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-30 12:04:48 +0100
commitd63298e566324cf4cc4fa457348fdce56615ecf6 (patch)
treef30baf14775837eb2d2c3113c3fc5d9793fa1de7 /meta/recipes-devtools/qemu
parent7a619c235f17a2e55b25d7e12984bfb61ec964fb (diff)
downloadpoky-d63298e566324cf4cc4fa457348fdce56615ecf6.tar.gz
qemu: Add an option to remove host sdl/gl checking
Add an PACKAGECONFIG in qemu to disable GL acceleration: * By default configure try best to enable GL acceleration and fail when missing host dependency(libSDL and libGL). * End user can also choose to turn off GL capability, thus remove the host dependence in building. [YOCTO #2407] got fixed. (From OE-Core rev: cfa93553e17057a1ea9d81e3a415fc8260c54067) Signed-off-by: Zhai Edwin <edwin.zhai@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/qemu')
-rw-r--r--meta/recipes-devtools/qemu/qemu-0.15.1/dummy-gl-config.patch31
-rw-r--r--meta/recipes-devtools/qemu/qemu-0.15.1/glflags.patch40
-rw-r--r--meta/recipes-devtools/qemu/qemu-0.15.1/opengl-disable-option.patch137
-rw-r--r--meta/recipes-devtools/qemu/qemu.inc23
-rw-r--r--meta/recipes-devtools/qemu/qemu_0.15.1.bb4
5 files changed, 203 insertions, 32 deletions
diff --git a/meta/recipes-devtools/qemu/qemu-0.15.1/dummy-gl-config.patch b/meta/recipes-devtools/qemu/qemu-0.15.1/dummy-gl-config.patch
new file mode 100644
index 0000000000..8aa30aed03
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu-0.15.1/dummy-gl-config.patch
@@ -0,0 +1,31 @@
1Add a dummy option for GL acceleration to pass the configure when there is no
2GL acceleration patch. The parsing function will be filled by following
3opengl-disable-option.patch.
4
5Upstream-Status: Inappropriate [other] - depends on GL patch
6
7Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
8
9Index: qemu-0.15.1/configure
10===================================================================
11--- qemu-0.15.1.orig/configure 2012-05-14 21:23:34.000000000 +0800
12+++ qemu-0.15.1/configure 2012-05-14 21:23:36.000000000 +0800
13@@ -179,6 +179,7 @@
14 smartcard_nss=""
15 usb_redir=""
16 opengl=""
17+gl_accel="yes"
18 guest_agent="yes"
19
20 # parse CC options first
21@@ -739,6 +740,10 @@
22 ;;
23 --enable-opengl) opengl="yes"
24 ;;
25+ --disable-gl-accel) gl_accel="no"
26+ ;;
27+ --enable-gl-accel) gl_accel="yes"
28+ ;;
29 --*dir)
30 ;;
31 --disable-rbd) rbd="no"
diff --git a/meta/recipes-devtools/qemu/qemu-0.15.1/glflags.patch b/meta/recipes-devtools/qemu/qemu-0.15.1/glflags.patch
index 0ad5551d47..638d2622b6 100644
--- a/meta/recipes-devtools/qemu/qemu-0.15.1/glflags.patch
+++ b/meta/recipes-devtools/qemu/qemu-0.15.1/glflags.patch
@@ -1,15 +1,33 @@
1Considering relocation, qemu-nativesdk is independent of host library except
2libGL. Normal method like 'cat > $TMPC' doesn't work, so we check the library
3directly.
4
1Upstream-Status: Inappropriate [configuration] 5Upstream-Status: Inappropriate [configuration]
2 6
3Index: qemu-0.14.0/Makefile.target 7Index: qemu-0.15.1/configure
4=================================================================== 8===================================================================
5--- qemu-0.14.0.orig/Makefile.target 2011-04-04 12:12:19.142871742 +0100 9--- qemu-0.15.1.orig/configure 2012-05-25 18:26:05.000000000 +0800
6+++ qemu-0.14.0/Makefile.target 2011-04-04 12:12:21.772871742 +0100 10+++ qemu-0.15.1/configure 2012-05-29 09:43:27.000000000 +0800
7@@ -362,7 +362,7 @@ 11@@ -2032,15 +2032,13 @@
8 12 exit 1;
9 monitor.o: hmp-commands.h qmp-commands.h 13 fi
10
11-LIBS += -lGL -lGLU
12+LIBS += -lGL
13
14 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
15 14
15- gl_accel_libs="-lGL -lGLU"
16- cat > $TMPC << EOF
17-#include <X11/Xlib.h>
18-#include <GL/gl.h>
19-#include <GL/glx.h>
20-#include <GL/glu.h>
21-int main(void) { GL_VERSION; return 0; }
22-EOF
23- if compile_prog "" "-lGL -lGLU" ; then
24+ gl_accel_libs="-lGL"
25+ libgl='no'
26+ test -e /usr/lib/libGL.so && libgl='yes'
27+ test -e /usr/lib64/libGL.so && libgl='yes'
28+ test -e /usr/lib/*-linux-gnu/libGL.so && libgl='yes'
29+
30+ if test "$libgl" = "yes" ; then
31 gl_accel=yes
32 libs_softmmu="$gl_accel_libs $libs_softmmu"
33 else
diff --git a/meta/recipes-devtools/qemu/qemu-0.15.1/opengl-disable-option.patch b/meta/recipes-devtools/qemu/qemu-0.15.1/opengl-disable-option.patch
new file mode 100644
index 0000000000..8dc272a926
--- /dev/null
+++ b/meta/recipes-devtools/qemu/qemu-0.15.1/opengl-disable-option.patch
@@ -0,0 +1,137 @@
1Add an option gl-accel to disable GL acceleration:
2* When enabled, configure try best to enable GL acceleration and fail when
3 missing host dependency(libSDL and libGL), which is the default.
4* When disabled, end user choose to turn off GL capability, thus remove the
5 host dependence in building.
6
7Upstream-Status: Inappropriate [other] - depends on GL patch
8
9Signed-off-by: Zhai Edwin <edwin.zhai@intel.com>
10
11Index: qemu-0.15.1/Makefile.target
12===================================================================
13--- qemu-0.15.1.orig/Makefile.target 2012-05-29 11:20:04.000000000 +0800
14+++ qemu-0.15.1/Makefile.target 2012-05-29 11:20:04.000000000 +0800
15@@ -80,13 +80,16 @@
16 endif
17 libobj-$(CONFIG_NEED_MMU) += mmu.o
18 ifndef CONFIG_LINUX_USER
19+ifdef CONFIG_GL_ACCEL
20 libobj-$(TARGET_I386) += helper_opengl.o opengl_exec.o
21 libobj-$(TARGET_X86_64) += helper_opengl.o opengl_exec.o
22 else
23-ifdef CONFIG_SDL
24 libobj-$(TARGET_I386) += dummygl.o
25 libobj-$(TARGET_X86_64) += dummygl.o
26-endif
27+endif #CONFIG_GL_ACCEL
28+else
29+libobj-$(TARGET_I386) += dummygl.o
30+libobj-$(TARGET_X86_64) += dummygl.o
31 endif #CONFIG_LINUX_USER
32 libobj-$(TARGET_ARM) += dummygl.o
33 libobj-$(TARGET_MIPS) += dummygl.o
34@@ -262,8 +265,10 @@
35 obj-i386-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o
36
37 ifeq ($(TARGET_BASE_ARCH), i386)
38+ifdef CONFIG_GL_ACCEL
39 QEMU_CFLAGS += -DTARGET_OPENGL_OK
40 endif
41+endif
42
43 # shared objects
44 obj-ppc-y = ppc.o
45@@ -409,8 +414,6 @@
46
47 monitor.o: hmp-commands.h qmp-commands.h
48
49-LIBS += -lGL -lGLU
50-
51 $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y): $(GENERATED_HEADERS)
52
53 obj-y += $(addprefix ../, $(common-obj-y))
54Index: qemu-0.15.1/configure
55===================================================================
56--- qemu-0.15.1.orig/configure 2012-05-29 11:20:03.000000000 +0800
57+++ qemu-0.15.1/configure 2012-05-29 11:20:04.000000000 +0800
58@@ -2021,6 +2021,39 @@
59 fi
60 fi
61
62+#####################################################
63+# GL acceleration probe depending on gl, glu and sdl
64+if test "$gl_accel" != "no" ; then
65+ if test "$sdl" = "no" ; then
66+ gl_accel=no
67+ echo "libSDL and header no found to build opengl acceleration for qemu-native.
68+ Ubuntu package names are: libsdl1.2-dev.
69+ Fedora package names are: SDL-devel."
70+ exit 1;
71+ fi
72+
73+ gl_accel_libs="-lGL -lGLU"
74+ cat > $TMPC << EOF
75+#include <X11/Xlib.h>
76+#include <GL/gl.h>
77+#include <GL/glx.h>
78+#include <GL/glu.h>
79+int main(void) { GL_VERSION; return 0; }
80+EOF
81+ if compile_prog "" "-lGL -lGLU" ; then
82+ gl_accel=yes
83+ libs_softmmu="$gl_accel_libs $libs_softmmu"
84+ else
85+ feature_not_found "gl_accel"
86+ gl_accel=no
87+ gl_accel_libs=
88+ echo "libGL.so and libGLU.so not found to build opengl acceleration for qemu-native.
89+ Ubuntu package names are: libgl1-mesa-dev, libglu1-mesa-dev and libsdl1.2-dev.
90+ Fedora package names are: mesa-libGL mesa-libGLU SDL-devel."
91+ exit 1;
92+ fi
93+fi
94+
95 #
96 # Check for xxxat() functions when we are building linux-user
97 # emulator. This is done because older glibc versions don't
98@@ -2722,6 +2755,7 @@
99 echo "nss used $smartcard_nss"
100 echo "usb net redir $usb_redir"
101 echo "OpenGL support $opengl"
102+echo "GL acceleration support $gl_accel"
103 echo "build guest agent $guest_agent"
104
105 if test $sdl_too_old = "yes"; then
106@@ -3025,6 +3059,10 @@
107 echo "CONFIG_OPENGL=y" >> $config_host_mak
108 fi
109
110+if test "$gl_accel" = "yes" ; then
111+ echo "CONFIG_GL_ACCEL=y" >> $config_host_mak
112+fi
113+
114 # XXX: suppress that
115 if [ "$bsd" = "yes" ] ; then
116 echo "CONFIG_BSD=y" >> $config_host_mak
117Index: qemu-0.15.1/qemu-char.c
118===================================================================
119--- qemu-0.15.1.orig/qemu-char.c 2012-05-29 11:20:03.000000000 +0800
120+++ qemu-0.15.1/qemu-char.c 2012-05-29 11:20:04.000000000 +0800
121@@ -2387,7 +2387,6 @@
122 return d->outbuf_size;
123 }
124
125-#define TARGET_OPENGL_OK
126 #if defined(TARGET_OPENGL_OK)
127 static uint8_t buffer[32];
128 static int buffer_len;
129@@ -2447,7 +2446,7 @@
130 return chr;
131 }
132 #else
133-#define qemu_chr_open_opengl() 0
134+#define qemu_chr_open_opengl NULL
135 #endif
136
137 QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc
index 2038651cb7..e618c1d6e1 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -19,26 +19,6 @@ EXTRA_OECONF += "--target-list=${@get_qemu_target_list(d)} --disable-werror --di
19 19
20inherit autotools 20inherit autotools
21 21
22# For our gl powered QEMU you need libGL and SDL headers
23do_configure_prepend_virtclass-native() {
24 libgl='no'
25 libsdl='no'
26
27 test -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so && libgl='yes'
28 test -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so && libgl='yes'
29 test -e /usr/lib/*-linux-gnu/libGL.so -a -e /usr/lib/*-linux-gnu/libGLU.so && libgl='yes'
30
31 test -e /usr/lib/pkgconfig/sdl.pc -o -e /usr/lib64/pkgconfig/sdl.pc -o -e /usr/include/SDL/SDL.h && libsdl='yes'
32
33
34 if [ "$libsdl" != 'yes' -o "$libgl" != 'yes' ]; then
35 echo "You need libGL.so and libGLU.so to exist in your library path and the development headers for SDL installed to build qemu-native.
36 Ubuntu package names are: libgl1-mesa-dev, libglu1-mesa-dev and libsdl1.2-dev.
37 Fedora package names are: mesa-libGL mesa-libGLU SDL-devel."
38 exit 1;
39 fi
40}
41
42do_configure() { 22do_configure() {
43 # Handle distros such as CentOS 5 32-bit that do not have kvm support 23 # Handle distros such as CentOS 5 32-bit that do not have kvm support
44 KVMOPTS="--disable-kvm" 24 KVMOPTS="--disable-kvm"
@@ -57,6 +37,9 @@ do_install () {
57 install -m 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu 37 install -m 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu
58} 38}
59 39
40PACKAGECONFIG ??= "gl"
41PACKAGECONFIG[gl] = "--enable-gl-accel,--disable-gl-accel,,"
42
60DEPENDS_virtclass-native = "zlib-native alsa-lib-native glib-2.0-native" 43DEPENDS_virtclass-native = "zlib-native alsa-lib-native glib-2.0-native"
61DEPENDS_virtclass-nativesdk = "zlib-nativesdk libsdl-nativesdk glib-2.0-nativesdk \ 44DEPENDS_virtclass-nativesdk = "zlib-nativesdk libsdl-nativesdk glib-2.0-nativesdk \
62 ${@base_contains('DISTRO_FEATURES', 'x11', 'qemugl-nativesdk', '', d)}" 45 ${@base_contains('DISTRO_FEATURES', 'x11', 'qemugl-nativesdk', '', d)}"
diff --git a/meta/recipes-devtools/qemu/qemu_0.15.1.bb b/meta/recipes-devtools/qemu/qemu_0.15.1.bb
index d0cf15c3c8..bcff9f8d73 100644
--- a/meta/recipes-devtools/qemu/qemu_0.15.1.bb
+++ b/meta/recipes-devtools/qemu/qemu_0.15.1.bb
@@ -3,7 +3,7 @@ require qemu.inc
3LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ 3LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
4 file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913" 4 file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
5 5
6PR = "r7" 6PR = "r8"
7 7
8FILESPATH = "${FILE_DIRNAME}/qemu-${PV}" 8FILESPATH = "${FILE_DIRNAME}/qemu-${PV}"
9FILESDIR = "${WORKDIR}" 9FILESDIR = "${WORKDIR}"
@@ -19,6 +19,7 @@ SRC_URI = "\
19 file://larger_default_ram_size.patch \ 19 file://larger_default_ram_size.patch \
20 file://arm-bgr.patch \ 20 file://arm-bgr.patch \
21 file://a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch \ 21 file://a4d1f142542935b90d2eb30f3aead4edcf455fe6.patch \
22 file://dummy-gl-config.patch \
22 " 23 "
23 24
24# Only use the GL passthrough patches for native/nativesdk versions 25# Only use the GL passthrough patches for native/nativesdk versions
@@ -31,6 +32,7 @@ QEMUGLPATCHES = "\
31 file://qemugl-fix.patch \ 32 file://qemugl-fix.patch \
32 file://opengl-sdl-fix.patch \ 33 file://opengl-sdl-fix.patch \
33 file://opengl-args-copy-fix.patch \ 34 file://opengl-args-copy-fix.patch \
35 file://opengl-disable-option.patch \
34 " 36 "
35 37
36SRC_URI_append_virtclass-native = "\ 38SRC_URI_append_virtclass-native = "\