Skip to contentSkip to conversation

Make qemu.inc useful for generic use

PATCH Superseded Nathan Rossi 2 participants 6 messages Feb 21, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Make qemu.inc useful for generic use

This series is intended to make the qemu.inc more generic and useful for other recipes to use. This is achieved by moving version specific patches, task steps and ptest support into the qemu_*.bb recipe, additionally improvements are made to the PACKAGECONFIG options and changes to the configure step are made to allow for the configuration to be more complete as well as easier to override/modify.
---
Changes in v2:
* Rebased on top of current master
* Updated changes for QEMU 2.8.0 recipe

Nathan Rossi (4):
qemu: Improve and add PACKAGECONFIG options
qemu: Consolidate EXTRA_OECONF
qemu: Convert KVMOPTS to PACKAGECONFIG
qemu: Move recipe version specific patches and features to recipe

 meta/recipes-devtools/qemu/qemu.inc      | 84 +++++++++++++-------------------
 meta/recipes-devtools/qemu/qemu_2.8.0.bb | 33 ++++++++++++-
 2 files changed, 65 insertions(+), 52 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/4 qemu: Improve and add PACKAGECONFIG options

Move the '--disable-bluez' and '--disable-iscsi' options to PACKAGECONFIG. And added the ${BLUEZ} dependency.

Fix up the 'gcrypt' option to depend on 'libgcrypt' instead of gcrypt. This is the expected dependency as noted in the QEMU configure help.

Handle the '--audio-drv-list' option inside the PACKAGECONFIG[alsa] args. The previous setting uses a ',' to denote the options for the arg however a space inside quotes is also acceptable and allows the arg to be used into the PACKAGECONFIG flag.

---
 meta/recipes-devtools/qemu/qemu.inc | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +6 -6
index ef5d75c450..6f350f9345 100644
@@ -6,7 +6,7 @@ RDEPENDS_${PN}_class-target += "bash"
 RDEPENDS_${PN}-ptest = "bash make"
 
 require qemu-targets.inc
-inherit autotools pkgconfig ptest
+inherit autotools pkgconfig ptest bluetooth
 BBCLASSEXTEND = "native nativesdk"
 
 # QEMU_TARGETS is overridable variable
@@ -26,7 +26,7 @@ SRC_URI_append_class-native = "\
     file://cpus.c-qemu_cpu_kick_thread_debugging.patch \
     "
 
-EXTRA_OECONF += "--target-list=${@get_qemu_target_list(d)} --disable-werror  --disable-bluez --disable-libiscsi --with-system-pixman --extra-cflags='${CFLAGS}'"
+EXTRA_OECONF += "--target-list=${@get_qemu_target_list(d)} --disable-werror  --with-system-pixman --extra-cflags='${CFLAGS}'"
 
 EXTRA_OECONF_class-nativesdk = "--target-list=${@get_qemu_target_list(d)} --disable-werror"
 
@@ -120,17 +120,17 @@ PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
 PACKAGECONFIG[gtk+] = "--enable-gtk --with-gtkabi=3.0 --enable-vte,--disable-gtk --disable-vte,gtk+3 vte"
 PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
 PACKAGECONFIG[ssh2] = "--enable-libssh2,--disable-libssh2,libssh2,"
-PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,gcrypt,"
+PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
 PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle"
 PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
 PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
-PACKAGECONFIG[alsa] = ",,alsa-lib"
+PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,alsa-lib"
 PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,mesa"
 PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
 PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
 PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
 PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
-
-EXTRA_OECONF += "${@bb.utils.contains('PACKAGECONFIG', 'alsa', '--audio-drv-list=oss,alsa', '', d)}"
+PACKAGECONFIG[bluez] = "--enable-bluez,--disable-bluez,${BLUEZ}"
+PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
 
 INSANE_SKIP_${PN} = "arch"
Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 2/4 qemu: Consolidate EXTRA_OECONF

In reply to Nathan Rossi

Consolidate the configure options into the EXTRA_OECONF variable, including merging any native(sdk) specific options.

This consolidation also makes the use of 'system' pixman in the nativesdk case, this is desirable as the QEMU internal pixman may not be available (using QEMU git as opposed to tarball) and pixman is already in DEPENDS. Additionally the QEMU configure recommends to use the system pixman if available.

Additionally move the options specified in the do_configure into the EXTRA_OECONF variable. And flesh out all the target directories.

---
 meta/recipes-devtools/qemu/qemu.inc | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +19 -4
index 6f350f9345..485638b62d 100644
@@ -26,9 +26,24 @@ SRC_URI_append_class-native = "\
     file://cpus.c-qemu_cpu_kick_thread_debugging.patch \
     "
 
-EXTRA_OECONF += "--target-list=${@get_qemu_target_list(d)} --disable-werror  --with-system-pixman --extra-cflags='${CFLAGS}'"
-
-EXTRA_OECONF_class-nativesdk = "--target-list=${@get_qemu_target_list(d)} --disable-werror"
+EXTRA_OECONF = " \
+    --prefix=${prefix} \
+    --bindir=${bindir} \
+    --includedir=${includedir} \
+    --libdir=${libdir} \
+    --mandir=${mandir} \
+    --datadir=${datadir} \
+    --docdir=${docdir}/${BPN} \
+    --sysconfdir=${sysconfdir} \
+    --libexecdir=${libexecdir} \
+    --localstatedir=${localstatedir} \
+    --with-confsuffix=/${BPN} \
+    --disable-strip \
+    --disable-werror \
+    --target-list=${@get_qemu_target_list(d)} \
+    --with-system-pixman \
+    --extra-cflags='${CFLAGS}' \
+    "
 
 EXTRA_OEMAKE_append_class-native = " LD='${LD}' AR='${AR}' OBJCOPY='${OBJCOPY}' LDFLAGS='${LDFLAGS}'"
 
@@ -61,7 +76,7 @@ do_configure() {
        KVMOPTS="${KVMENABLE}"
     fi
 
-    ${S}/configure --prefix=${prefix} --sysconfdir=${sysconfdir} --libexecdir=${libexecdir} --localstatedir=${localstatedir} --disable-strip ${EXTRA_OECONF} $KVMOPTS
+    ${S}/configure ${EXTRA_OECONF} $KVMOPTS
     test ! -e ${S}/target-i386/beginend_funcs.sh || chmod a+x ${S}/target-i386/beginend_funcs.sh
 }
 
Signature · 1 line
2.11.0
#3 lore raw

PATCH v2 3/4 qemu: Convert KVMOPTS to PACKAGECONFIG

In reply to Nathan Rossi

Move the KVMOPTS configuration checks and option setting to a PACKAGECONFIG option.

This also changes the checking of KVM support on the host build machine so that it is processed as a PACKAGECONFIG _remove for class-native only. The darwin/mingw32 overrides are kept and applied as _remove overrides.

---
 meta/recipes-devtools/qemu/qemu.inc | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +12 -15
index 485638b62d..e78cfb367b 100644
@@ -64,19 +64,8 @@ do_configure_prepend_class-native() {
 		"${S}"/Makefile "${S}"/Makefile.target
 }
 
-KVMENABLE = "--enable-kvm"
-KVMENABLE_darwin = "--disable-kvm"
-KVMENABLE_mingw32 = "--disable-kvm"
-
 do_configure() {
-    # Handle distros such as CentOS 5 32-bit that do not have kvm support
-    KVMOPTS="--disable-kvm"
-    if [ "${PN}" != "qemu-native" -a "${PN}" != "nativesdk-qemu" ] \
-       || [ -f /usr/include/linux/kvm.h ] ; then
-       KVMOPTS="${KVMENABLE}"
-    fi
-
-    ${S}/configure ${EXTRA_OECONF} $KVMOPTS
+    ${S}/configure ${EXTRA_OECONF}
     test ! -e ${S}/target-i386/beginend_funcs.sh || chmod a+x ${S}/target-i386/beginend_funcs.sh
 }
 
@@ -113,12 +102,19 @@ do_install_append() {
 # END of qemu-mips workaround
 
 PACKAGECONFIG ??= " \
-	fdt sdl \
+	fdt sdl kvm \
 	${@bb.utils.contains('DISTRO_FEATURES', 'alsa', 'alsa', '', d)} \
 	${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen', '', d)} \
 	"
-PACKAGECONFIG_class-native ??= "fdt alsa uuid"
-PACKAGECONFIG_class-nativesdk ??= "fdt sdl"
+PACKAGECONFIG_class-native ??= "fdt alsa uuid kvm"
+PACKAGECONFIG_class-nativesdk ??= "fdt sdl kvm"
+
+# Handle distros such as CentOS 5 32-bit that do not have kvm support
+PACKAGECONFIG_class-native_remove = "${@'kvm' if not os.path.exists('/usr/include/linux/kvm.h') else ''}"
+
+# Disable kvm on targets that do not support it
+PACKAGECONFIG_remove_darwin = "kvm"
+PACKAGECONFIG_remove_mingw32 = "kvm"
 
 PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl"
 PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr,--disable-virtfs,libcap attr,"
@@ -147,5 +143,6 @@ PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
 PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
 PACKAGECONFIG[bluez] = "--enable-bluez,--disable-bluez,${BLUEZ}"
 PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
+PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
 
 INSANE_SKIP_${PN} = "arch"
Signature · 1 line
2.11.0
#4 lore raw

PATCH v2 4/4 qemu: Move recipe version specific patches and features to recipe

In reply to Nathan Rossi

Move all the version specific patches, overrides and configuration that are in qemu.inc to the versioned QEMU recipe.

This includes moving patches that target the versioned recipe, ptest configuration (which is not available in QEMU by default) and the installing of the powerpc_rom.bin. All these patches/files are also only located in the FILESEXTRAPATHS that is valid from the recipe file and not from qemu.inc itself.

The purpose of this change is to make the qemu.inc re-usable for multiple versions of QEMU as well as forks and recipes that intend to provide custom patches.

---
 meta/recipes-devtools/qemu/qemu.inc      | 30 +----------------------------
 meta/recipes-devtools/qemu/qemu_2.8.0.bb | 33 ++++++++++++++++++++++++++++++--
 2 files changed, 32 insertions(+), 31 deletions(-)
meta/recipes-devtools/qemu/qemu.inc +1 -29
index e78cfb367b..a023551a31 100644
@@ -3,29 +3,14 @@ HOMEPAGE = "http://qemu.org"
 LICENSE = "GPLv2 & LGPLv2.1"
 DEPENDS = "glib-2.0 zlib pixman"
 RDEPENDS_${PN}_class-target += "bash"
-RDEPENDS_${PN}-ptest = "bash make"
 
 require qemu-targets.inc
-inherit autotools pkgconfig ptest bluetooth
+inherit autotools pkgconfig bluetooth
 BBCLASSEXTEND = "native nativesdk"
 
 # QEMU_TARGETS is overridable variable
 QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc sh4 x86_64"
 
-SRC_URI = "\
-    file://powerpc_rom.bin \
-    file://disable-grabs.patch \
-    file://exclude-some-arm-EABI-obsolete-syscalls.patch \
-    file://wacom.patch \
-    file://add-ptest-in-makefile.patch \
-    file://run-ptest \
-    "
-
-SRC_URI_append_class-native = "\
-    file://fix-libcap-header-issue-on-some-distro.patch \
-    file://cpus.c-qemu_cpu_kick_thread_debugging.patch \
-    "
-
 EXTRA_OECONF = " \
     --prefix=${prefix} \
     --bindir=${bindir} \
@@ -69,22 +54,9 @@ do_configure() {
     test ! -e ${S}/target-i386/beginend_funcs.sh || chmod a+x ${S}/target-i386/beginend_funcs.sh
 }
 
-do_compile_ptest() {
-	make buildtest-TESTS
-}
-
-do_install_ptest() {
-	cp -rL ${B}/tests ${D}${PTEST_PATH}
-	find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcod]" | xargs -i rm -rf {}
-
-	cp ${S}/tests/Makefile.include ${D}${PTEST_PATH}/tests
-}
-
 do_install () {
 	export STRIP="true"
 	autotools_do_install
-	install -d ${D}${datadir}/qemu
-	install -m 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu
 }
 
 # The following fragment will create a wrapper for qemu-mips user emulation
meta/recipes-devtools/qemu/qemu_2.8.0.bb +31 -2
index e0527a8fd9..2fb9647370 100644
@@ -1,15 +1,31 @@
 require qemu.inc
 
+inherit ptest
+
+RDEPENDS_${PN}-ptest = "bash make"
+
 LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
                     file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
 
-SRC_URI += "file://configure-fix-Darwin-target-detection.patch \
+SRC_URI += " \
+            file://powerpc_rom.bin \
+            file://disable-grabs.patch \
+            file://exclude-some-arm-EABI-obsolete-syscalls.patch \
+            file://wacom.patch \
+            file://add-ptest-in-makefile.patch \
+            file://run-ptest \
+            file://configure-fix-Darwin-target-detection.patch \
             file://qemu-enlarge-env-entry-size.patch \
             file://no-valgrind.patch \
             file://pathlimit.patch \
             file://qemu-2.5.0-cflags.patch \
             file://target-ppc-fix-user-mode.patch \
-"
+            "
+
+SRC_URI_append_class-native = " \
+            file://fix-libcap-header-issue-on-some-distro.patch \
+            file://cpus.c-qemu_cpu_kick_thread_debugging.patch \
+            "
 
 SRC_URI =+ "http://wiki.qemu-project.org/download/${BP}.tar.bz2"
 
@@ -22,4 +38,17 @@ COMPATIBLE_HOST_mipsarchn64 = "null"
 do_install_append() {
     # Prevent QA warnings about installed ${localstatedir}/run
     if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
+    install -Dm 0755 ${WORKDIR}/powerpc_rom.bin ${D}${datadir}/qemu
+}
+
+do_compile_ptest() {
+	make buildtest-TESTS
 }
+
+do_install_ptest() {
+	cp -rL ${B}/tests ${D}${PTEST_PATH}
+	find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcod]" | xargs -i rm -rf {}
+
+	cp ${S}/tests/Makefile.include ${D}${PTEST_PATH}/tests
+}
+
Signature · 1 line
2.11.0
#5 lore raw
In reply to Nathan Rossi

It's not caused by these changes, but also probably not fixed by these changes, so this is just FYI

Currently qemu-native fails to build on hosts with glibc-2.25:

| qga/commands-posix.o: In function `dev_major_minor':
| /OE/build/owpb/webos-ports/tmp-glibc/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/qga/commands-posix.c:656:
undefined reference to `major'
| /OE/build/owpb/webos-ports/tmp-glibc/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/qga/commands-posix.c:657:
undefined reference to `minor'
| collect2: error: ld returned 1 exit status
| make: *** [Makefile:322: qemu-ga] Error 1

linux-user/strace.o: In function `print_mknodat':
/OE/build/owpb/webos-ports/tmp-glibc/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/strace.c:2010:
undefined reference to `major' /OE/build/owpb/webos-ports/tmp-glibc/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/strace.c:2011:
undefined reference to `minor'
linux-user/strace.o: In function `print_mknod':
/OE/build/owpb/webos-ports/tmp-glibc/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/strace.c:1990:
undefined reference to `major' /OE/build/owpb/webos-ports/tmp-glibc/work/x86_64-linux/qemu-native/2.8.0-r0/qemu-2.8.0/linux-user/strace.c:1991:
undefined reference to `minor'
collect2: error: ld returned 1 exit status

Including sys/sysmacros in these files works, there is a patch in review upstream with proper fix:

https://lists.gnu.org/archive/html/qemu-devel/2016-12/msg03548.html

Quoted 31 lines · Nathan Rossi

This series is intended to make the qemu.inc more generic and useful for other recipes to use. This is achieved by moving version specific patches, task steps and ptest support into the qemu_*.bb recipe, additionally improvements are made to the PACKAGECONFIG options and changes to the configure step are made to allow for the configuration to be more complete as well as easier to override/modify.
---
Changes in v2:
* Rebased on top of current master
* Updated changes for QEMU 2.8.0 recipe

Nathan Rossi (4):
qemu: Improve and add PACKAGECONFIG options
qemu: Consolidate EXTRA_OECONF
qemu: Convert KVMOPTS to PACKAGECONFIG
qemu: Move recipe version specific patches and features to recipe

 meta/recipes-devtools/qemu/qemu.inc      | 84
+++++++++++++-------------------
 meta/recipes-devtools/qemu/qemu_2.8.0.bb | 33 ++++++++++++-
 2 files changed, 65 insertions(+), 52 deletions(-)

--
2.11.0
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core