qemu.inc 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. SUMMARY = "Fast open source processor emulator"
  2. DESCRIPTION = "QEMU is a hosted virtual machine monitor: it emulates the \
  3. machine's processor through dynamic binary translation and provides a set \
  4. of different hardware and device models for the machine, enabling it to run \
  5. a variety of guest operating systems"
  6. HOMEPAGE = "http://qemu.org"
  7. LICENSE = "GPLv2 & LGPLv2.1"
  8. RDEPENDS:${PN}-ptest = "bash"
  9. require qemu-targets.inc
  10. inherit pkgconfig ptest python3-dir
  11. LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
  12. file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
  13. SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
  14. file://powerpc_rom.bin \
  15. file://run-ptest \
  16. file://0001-qemu-Add-missing-wacom-HID-descriptor.patch \
  17. file://0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch \
  18. file://0004-qemu-disable-Valgrind.patch \
  19. file://0006-chardev-connect-socket-to-a-spawned-command.patch \
  20. file://0007-apic-fixup-fallthrough-to-PIC.patch \
  21. file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \
  22. file://0001-Add-enable-disable-udev.patch \
  23. file://0001-qemu-Do-not-include-file-if-not-exists.patch \
  24. file://mmap2.patch \
  25. file://determinism.patch \
  26. file://0001-tests-meson.build-use-relative-path-to-refer-to-file.patch \
  27. file://0001-configure-fix-detection-of-gdbus-codegen.patch \
  28. file://0001-vhost-user-gpu-fix-memory-disclosure-in-virgl_cmd_ge.patch \
  29. file://0002-vhost-user-gpu-fix-resource-leak-in-vg_resource_crea.patch \
  30. file://0003-vhost-user-gpu-fix-memory-leak-in-vg_resource_attach.patch \
  31. file://0004-vhost-user-gpu-fix-memory-leak-while-calling-vg_reso.patch \
  32. file://0005-vhost-user-gpu-fix-memory-leak-in-virgl_cmd_resource.patch \
  33. file://0006-vhost-user-gpu-fix-memory-leak-in-virgl_resource_att.patch \
  34. file://0007-vhost-user-gpu-fix-OOB-write-in-virgl_cmd_get_capset.patch \
  35. file://0001-linux-user-Tag-vsx-with-ieee128-fpbits.patch \
  36. file://CVE-2021-3527-1.patch \
  37. file://CVE-2021-3527-2.patch \
  38. file://CVE-2021-3682.patch \
  39. "
  40. UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
  41. SRC_URI[sha256sum] = "87bc1a471ca24b97e7005711066007d443423d19aacda3d442558ae032fa30b9"
  42. SRC_URI:append:class-target = " file://cross.patch"
  43. SRC_URI:append:class-nativesdk = " file://cross.patch"
  44. # Applies against virglrender < 0.6.0 and not qemu itself
  45. CVE_CHECK_IGNORE += "CVE-2017-5957"
  46. # The VNC server can expose host files uder some circumstances. We don't
  47. # enable it by default.
  48. CVE_CHECK_IGNORE += "CVE-2007-0998"
  49. # 'The issues identified by this CVE were determined to not constitute a vulnerability.'
  50. # https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11
  51. CVE_CHECK_IGNORE += "CVE-2018-18438"
  52. COMPATIBLE_HOST:mipsarchn32 = "null"
  53. COMPATIBLE_HOST:mipsarchn64 = "null"
  54. # Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html
  55. # upstream states qemu doesn't work without optimization
  56. DEBUG_BUILD = "0"
  57. do_install:append() {
  58. # Prevent QA warnings about installed ${localstatedir}/run
  59. if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
  60. }
  61. do_install_ptest() {
  62. cp -rL ${B}/tests ${D}${PTEST_PATH}
  63. find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {}
  64. # Don't check the file genreated by configure
  65. sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh
  66. # Strip the paths from the QEMU variable, we can use PATH
  67. sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" ${D}${PTEST_PATH}/tests/tcg/*.mak
  68. }
  69. # QEMU_TARGETS is overridable variable
  70. QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
  71. EXTRA_OECONF = " \
  72. --prefix=${prefix} \
  73. --bindir=${bindir} \
  74. --includedir=${includedir} \
  75. --libdir=${libdir} \
  76. --mandir=${mandir} \
  77. --datadir=${datadir} \
  78. --docdir=${docdir}/${BPN} \
  79. --sysconfdir=${sysconfdir} \
  80. --libexecdir=${libexecdir} \
  81. --localstatedir=${localstatedir} \
  82. --with-suffix=${BPN} \
  83. --disable-strip \
  84. --disable-werror \
  85. --extra-cflags='${CFLAGS}' \
  86. --extra-ldflags='${LDFLAGS}' \
  87. --with-git=/bin/false \
  88. --with-git-submodules=ignore \
  89. --meson=meson \
  90. ${PACKAGECONFIG_CONFARGS} \
  91. "
  92. export LIBTOOL="${HOST_SYS}-libtool"
  93. B = "${WORKDIR}/build"
  94. #EXTRA_OECONF:append = " --python=${HOSTTOOLS_DIR}/python3"
  95. do_configure:prepend:class-native() {
  96. # Append build host pkg-config paths for native target since the host may provide sdl
  97. BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "")
  98. if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
  99. export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
  100. fi
  101. }
  102. do_configure() {
  103. # This is taken from meson.bbclass to avoid errors when updating to a
  104. # new version of meson.
  105. rmdir ${STAGING_LIBDIR_NATIVE}/${PYTHON_DIR}/site-packages/*.egg-info 2>/dev/null || :
  106. ${S}/configure ${EXTRA_OECONF}
  107. }
  108. do_configure[cleandirs] += "${B}"
  109. do_install () {
  110. export STRIP=""
  111. oe_runmake 'DESTDIR=${D}' install
  112. }
  113. # The following fragment will create a wrapper for qemu-mips user emulation
  114. # binary in order to work around a segmentation fault issue. Basically, by
  115. # default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
  116. # This will trigger a MMU access fault in the virtual CPU. With this change,
  117. # the qemu-mips works fine.
  118. # IMPORTANT: This piece needs to be removed once the root cause is fixed!
  119. do_install:append() {
  120. if [ -e "${D}/${bindir}/qemu-mips" ]; then
  121. create_wrapper ${D}/${bindir}/qemu-mips \
  122. QEMU_RESERVED_VA=0x0
  123. fi
  124. }
  125. # END of qemu-mips workaround
  126. make_qemu_wrapper() {
  127. gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0`
  128. for tool in `ls ${D}${bindir}/qemu-system-*`; do
  129. create_wrapper $tool \
  130. GDK_PIXBUF_MODULE_FILE=$gdk_pixbuf_module_file \
  131. FONTCONFIG_PATH=/etc/fonts \
  132. GTK_THEME=Adwaita
  133. done
  134. }
  135. # Disable kvm/virgl/mesa on targets that do not support it
  136. PACKAGECONFIG:remove:darwin = "kvm virglrenderer glx gtk+"
  137. PACKAGECONFIG:remove:mingw32 = "kvm virglrenderer glx gtk+"
  138. PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2"
  139. PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr,"
  140. PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio,"
  141. PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs,"
  142. PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest"
  143. PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl,"
  144. PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg,"
  145. PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng,"
  146. PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl,"
  147. PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss,"
  148. PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
  149. PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native"
  150. PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native"
  151. PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
  152. PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh,"
  153. PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
  154. PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle"
  155. PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
  156. PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
  157. PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,alsa-lib"
  158. PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,virtual/libgl"
  159. PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
  160. PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
  161. PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
  162. PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
  163. PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
  164. PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
  165. PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer"
  166. # spice will be in meta-networking layer
  167. PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice"
  168. # usbredir will be in meta-networking layer
  169. PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir"
  170. PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy"
  171. PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs"
  172. PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
  173. PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev"
  174. PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2"
  175. PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr,"
  176. PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph"
  177. PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,,"
  178. PACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust,"
  179. PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,,"
  180. PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
  181. # libnfs is currently provided by meta-kodi
  182. PACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs"
  183. INSANE_SKIP:${PN} = "arch"
  184. FILES:${PN} += "${datadir}/icons"