qemu.inc 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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
  11. LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
  12. file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
  13. S = "${WORKDIR}/git"
  14. SRCREV = "711c0418c8c1ce3a24346f058b001c4c5a2f0f81"
  15. SRC_URI = "gitsm://github.com/qemu/qemu.git; \
  16. file://powerpc_rom.bin \
  17. file://run-ptest \
  18. file://0001-target-riscv-rvb-Carry-less-multiply-instruction.patch \
  19. file://0002-target-riscv-rvb-add-cmix-cmov-instruction.patch \
  20. file://0003-target-riscv-rvb-add-funnel-shfit-instruction.patch \
  21. file://0004-target-riscv-rvb-add-generalized-shuffle.patch \
  22. file://0005-target-riscv-rvb-add-crossbar-permutation-instructio.patch \
  23. file://0006-target-riscv-rvb-add-bfp-bfpw-instructions.patch \
  24. file://0007-target-riscv-rvb-modified-some-errors-on-some-rv64-o.patch \
  25. file://0008-target-riscv-rvb-add-bcompress-bdecompress-instructi.patch \
  26. file://0009-target-riscv-rvb-add-CRC-bit-matrix-instructions.patch \
  27. file://0010-target-riscv-rvb-modified-srow-error.patch \
  28. file://0011-support-b-extention-on-default-config.patch \
  29. "
  30. UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
  31. SRC_URI[sha256sum] = "87bc1a471ca24b97e7005711066007d443423d19aacda3d442558ae032fa30b9"
  32. SRC_URI[sha256sum] = "610c6063177fd3cb9aaa9bd9863df02cf822fa305daefe9166df86b5d90c36d9"
  33. SRC_URI_append_class-target = " file://cross.patch"
  34. SRC_URI_append_class-nativesdk = " file://cross.patch"
  35. # Applies against virglrender < 0.6.0 and not qemu itself
  36. CVE_CHECK_WHITELIST += "CVE-2017-5957"
  37. # The VNC server can expose host files uder some circumstances. We don't
  38. # enable it by default.
  39. CVE_CHECK_WHITELIST += "CVE-2007-0998"
  40. # 'The issues identified by this CVE were determined to not constitute a vulnerability.'
  41. # https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11
  42. CVE_CHECK_WHITELIST += "CVE-2018-18438"
  43. COMPATIBLE_HOST_mipsarchn32 = "null"
  44. COMPATIBLE_HOST_mipsarchn64 = "null"
  45. # Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html
  46. # upstream states qemu doesn't work without optimization
  47. DEBUG_BUILD = "0"
  48. do_install_append() {
  49. # Prevent QA warnings about installed ${localstatedir}/run
  50. if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
  51. }
  52. do_install_ptest() {
  53. cp -rL ${B}/tests ${D}${PTEST_PATH}
  54. find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {}
  55. # Don't check the file genreated by configure
  56. sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh
  57. # Strip the paths from the QEMU variable, we can use PATH
  58. sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" ${D}${PTEST_PATH}/tests/tcg/*.mak
  59. }
  60. # QEMU_TARGETS is overridable variable
  61. QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
  62. EXTRA_OECONF = " \
  63. --prefix=${prefix} \
  64. --bindir=${bindir} \
  65. --includedir=${includedir} \
  66. --libdir=${libdir} \
  67. --mandir=${mandir} \
  68. --datadir=${datadir} \
  69. --docdir=${docdir}/${BPN} \
  70. --sysconfdir=${sysconfdir} \
  71. --libexecdir=${libexecdir} \
  72. --localstatedir=${localstatedir} \
  73. --with-suffix=${BPN} \
  74. --disable-strip \
  75. --disable-werror \
  76. --extra-cflags='${CFLAGS}' \
  77. --extra-ldflags='${LDFLAGS}' \
  78. --with-git=/bin/false \
  79. --with-git-submodules=ignore \
  80. --meson=meson \
  81. ${PACKAGECONFIG_CONFARGS} \
  82. "
  83. export LIBTOOL="${HOST_SYS}-libtool"
  84. B = "${WORKDIR}/build"
  85. #EXTRA_OECONF_append = " --python=${HOSTTOOLS_DIR}/python3"
  86. do_configure_prepend_class-native() {
  87. # Append build host pkg-config paths for native target since the host may provide sdl
  88. BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "")
  89. if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
  90. export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
  91. fi
  92. }
  93. do_configure() {
  94. ${S}/configure ${EXTRA_OECONF}
  95. }
  96. do_configure[cleandirs] += "${B}"
  97. do_install () {
  98. export STRIP=""
  99. oe_runmake 'DESTDIR=${D}' install
  100. }
  101. # The following fragment will create a wrapper for qemu-mips user emulation
  102. # binary in order to work around a segmentation fault issue. Basically, by
  103. # default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
  104. # This will trigger a MMU access fault in the virtual CPU. With this change,
  105. # the qemu-mips works fine.
  106. # IMPORTANT: This piece needs to be removed once the root cause is fixed!
  107. do_install_append() {
  108. if [ -e "${D}/${bindir}/qemu-mips" ]; then
  109. create_wrapper ${D}/${bindir}/qemu-mips \
  110. QEMU_RESERVED_VA=0x0
  111. fi
  112. }
  113. # END of qemu-mips workaround
  114. make_qemu_wrapper() {
  115. gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0`
  116. for tool in `ls ${D}${bindir}/qemu-system-*`; do
  117. create_wrapper $tool \
  118. GDK_PIXBUF_MODULE_FILE=$gdk_pixbuf_module_file \
  119. FONTCONFIG_PATH=/etc/fonts \
  120. GTK_THEME=Adwaita
  121. done
  122. }
  123. # Disable kvm/virgl/mesa on targets that do not support it
  124. PACKAGECONFIG_remove_darwin = "kvm virglrenderer glx gtk+"
  125. PACKAGECONFIG_remove_mingw32 = "kvm virglrenderer glx gtk+"
  126. PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2"
  127. PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr,"
  128. PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio,"
  129. PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs,"
  130. PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest"
  131. PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl,"
  132. PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg,"
  133. PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng,"
  134. PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl,"
  135. PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss,"
  136. PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
  137. PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native"
  138. PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native"
  139. PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
  140. PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh,"
  141. PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
  142. PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle"
  143. PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
  144. PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
  145. PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,alsa-lib"
  146. PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,virtual/libgl"
  147. PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
  148. PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
  149. PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
  150. PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
  151. PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
  152. PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
  153. PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer"
  154. # spice will be in meta-networking layer
  155. PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice"
  156. # usbredir will be in meta-networking layer
  157. PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir"
  158. PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy"
  159. PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs"
  160. PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
  161. PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev"
  162. PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2"
  163. PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr,"
  164. PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph"
  165. PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,,"
  166. PACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust,"
  167. PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,,"
  168. PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
  169. INSANE_SKIP_${PN} = "arch"
  170. FILES_${PN} += "${datadir}/icons"