[meta-xilinx] [PATCH V2 1/5] qemu: Include Xilinx's QEMU

Nathan Rossi nathan at nathanrossi.com
Sun Jul 31 07:48:03 PDT 2016


On Thu, Jul 28, 2016 at 7:26 AM, Alistair Francis
<alistair.francis at xilinx.com> wrote:
> Pull and build Xilinx's QEMU tree and use that instead of the standard
> Yocto QEMU build.
>
> To use this the user must set the prefered provider.
>
> Signed-off-by: Alistair Francis <alistair.francis at xilinx.com>
> ---
>  recipes-devtools/qemu/qemu-targets.inc | 22 +++++++++++
>  recipes-devtools/qemu/qemu.inc         | 71 ++++++++++++++++++++++++++++++++++
>  recipes-devtools/qemu/qemu_2.2.5.bb    | 13 +++++++
>  3 files changed, 106 insertions(+)
>  create mode 100644 recipes-devtools/qemu/qemu-targets.inc
>  create mode 100644 recipes-devtools/qemu/qemu.inc
>  create mode 100644 recipes-devtools/qemu/qemu_2.2.5.bb
>
> diff --git a/recipes-devtools/qemu/qemu-targets.inc b/recipes-devtools/qemu/qemu-targets.inc
> new file mode 100644
> index 0000000..a3e46a8
> --- /dev/null
> +++ b/recipes-devtools/qemu/qemu-targets.inc
> @@ -0,0 +1,22 @@
> +# possible arch values are arm aarch64 mips mipsel mips64 mips64el ppc ppc64 ppc64abi32
> +# ppcemb armeb alpha sparc32plus i386 x86_64 cris m68k microblaze sparc sparc32
> +# sparc32plus
> +
> +def get_qemu_target_list(d):
> +    import bb
> +    archs = d.getVar('QEMU_TARGETS', True).split()
> +    tos = d.getVar('HOST_OS', True)
> +    softmmuonly = ""
> +    for arch in ['ppcemb']:
> +        if arch in archs:
> +            softmmuonly += arch + "-softmmu,"
> +            archs.remove(arch)
> +    linuxuseronly = ""
> +    for arch in ['armeb', 'alpha', 'ppc64abi32', 'sparc32plus']:
> +        if arch in archs:
> +            linuxuseronly += arch + "-linux-user,"
> +            archs.remove(arch)
> +    if 'linux' not in tos:
> +        return softmmuonly + ''.join([arch + "-softmmu" + "," for arch in archs]).rstrip(',')
> +    return softmmuonly + linuxuseronly + ''.join([arch + "-linux-user" + "," + arch + "-softmmu" + "," for arch in archs]).rstrip(',')
> +

This is a exact copy of qemu-targets.inc from meta/, you can include
this instead of copying with the following in the recipe:

require recipes-devtools/qemu/qemu-targets.inc

> diff --git a/recipes-devtools/qemu/qemu.inc b/recipes-devtools/qemu/qemu.inc
> new file mode 100644
> index 0000000..6909f44
> --- /dev/null
> +++ b/recipes-devtools/qemu/qemu.inc
> @@ -0,0 +1,71 @@
> +SUMMARY = "Xilinx's fork of a fast open source processor emulator"
> +HOMEPAGE = "https://github.com/xilinx/qemu/"
> +LICENSE = "GPLv2 & LGPLv2.1"
> +DEPENDS = "glib-2.0 zlib pixman qemu-helper-native"
> +RDEPENDS_${PN}_class-target += "bash python"
> +
> +require qemu-targets.inc
> +inherit autotools
> +BBCLASSEXTEND = "native nativesdk"
> +
> +S = "${WORKDIR}/git"
> +
> +QEMU_TARGETS = "aarch64"
> +
> +EXTRA_OECONF += "--target-list=${@get_qemu_target_list(d)} --disable-werror  --disable-bluez --disable-libiscsi --with-system-pixman --extra-cflags='${CFLAGS}'"
> +
> +EXTRA_OECONF_class-nativesdk = "--target-list=${@get_qemu_target_list(d)} --disable-werror \
> +                               "
> +export LIBTOOL="${HOST_SYS}-libtool"
> +
> +do_configure_prepend_class-native() {
> +       # Append build host pkg-config paths for native target since the host may provide sdl
> +       BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "")
> +       if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
> +               export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
> +       fi
> +}
> +
> +do_configure() {
> +    ${S}/configure --prefix=${prefix} --sysconfdir=${sysconfdir} --libexecdir=${libexecdir} --localstatedir=${localstatedir} --disable-strip ${EXTRA_OECONF} --disable-kvm
> +}
> +
> +do_install () {
> +       export STRIP="true"
> +       autotools_do_install
> +}
> +
> +PACKAGECONFIG ??= " \
> +       fdt sdl \
> +       ${@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[sdl] = "--enable-sdl,--disable-sdl,libsdl"
> +PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr,--disable-virtfs,libcap attr,"
> +PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio,"
> +PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen,xen-libxenstore xen-libxenctrl xen-libxenguest"
> +PACKAGECONFIG[quorum] = "--enable-quorum, --disable-quorum, gnutls,"
> +PACKAGECONFIG[vnc-tls] = "--enable-vnc --enable-vnc-tls,--disable-vnc-tls, gnutls,"
> +PACKAGECONFIG[vnc-ws] = "--enable-vnc --enable-vnc-ws,--disable-vnc-ws, gnutls,"
> +PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl,"
> +PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg,"
> +PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng,"
> +PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,libcurl,"
> +PACKAGECONFIG[uuid] = "--enable-uuid,--disable-uuid,util-linux,"
> +PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
> +PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+,"
> +PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
> +PACKAGECONFIG[ssh2] = "--enable-libssh2,--disable-libssh2,libssh2,"
> +PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
> +PACKAGECONFIG[gcrypt] = "--enable-libgcrypt,--disable-libgcrypt,libgcrypt,"
> +PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
> +PACKAGECONFIG[alsa] = ",,alsa-lib"
> +PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
> +PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
> +
> +EXTRA_OECONF += "${@bb.utils.contains('PACKAGECONFIG', 'alsa', '--audio-drv-list=oss,alsa', '', d)}"
> +
> +INSANE_SKIP_${PN} = "arch"

Most of this include is common with the qemu.inc from meta/. I think
it is probably worth using it and overriding what needs to be
removed/skipped.

The tasks can be overridden where is makes sense (e.g. do_install).

PACKAGECONFIG[<foo>] = "" can be used to null the configuration.
Same for KVMENABLE = "--disable-kvm" (putting it before the require
qemu.inc will give it precidence).

Something like this might work (this would be the qemu_2.2.5.bb):
-----
QEMU_TARGETS ?= "aarch64"

require recipes-devtools/qemu/qemu.inc

SUMMARY = "Xilinx's fork of a fast open source processor emulator"
HOMEPAGE = "https://github.com/xilinx/qemu/"

KVMENABLE = "--disable-kvm"

# strip all qemu.inc appends
SRC_URI[_append] = ""
SRC_URI = "git://github.com/Xilinx/qemu.git;protocol=https"

PACKAGECONFIG[quorum] = "--enable-quorum, --disable-quorum, gnutls,"
PACKAGECONFIG[vnc-tls] = "--enable-vnc
--enable-vnc-tls,--disable-vnc-tls, gnutls,"
PACKAGECONFIG[vnc-ws] = "--enable-vnc --enable-vnc-ws,--disable-vnc-ws, gnutls,"
PACKAGECONFIG[nss] = ""
PACKAGECONFIG[nettle] = ""
PACKAGECONFIG[glx] = ""
PACKAGECONFIG[gnutls] = ""
PACKAGECONFIG[bzip2] = ""
-----

> diff --git a/recipes-devtools/qemu/qemu_2.2.5.bb b/recipes-devtools/qemu/qemu_2.2.5.bb
> new file mode 100644
> index 0000000..3f442d5
> --- /dev/null
> +++ b/recipes-devtools/qemu/qemu_2.2.5.bb
> @@ -0,0 +1,13 @@
> +require qemu.inc
> +
> +LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
> +                    file://COPYING.LIB;endline=24;md5=c04def7ae38850e7d3ef548588159913"
> +
> +SRCREV = "b51f8df1a851c93d40b2ba1e4601677810b93990"
> +SRC_URI = "git://github.com/Xilinx/qemu.git \

protocol=https is the default in meta-xilinx for the Xilinx repos due
to proxy setup issues and general recommendations for github repos.

Also consider nobranch=1 if you intend to point at tags, like other
Xilinx repos.

Regards,
Nathan

> +"
> +
> +do_install_append() {
> +    # Prevent QA warnings about installed ${localstatedir}/run
> +    if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
> +}
> --
> 2.7.4
>



More information about the meta-xilinx mailing list