diff options
| -rw-r--r-- | recipes-devtools/qemu/qemu-qoriq_4.1.0.bb | 2 | ||||
| -rw-r--r-- | recipes-devtools/qemu/qemu-targets.inc | 28 | ||||
| -rw-r--r-- | recipes-devtools/qemu/qemu.inc | 198 | 
3 files changed, 227 insertions, 1 deletions
| diff --git a/recipes-devtools/qemu/qemu-qoriq_4.1.0.bb b/recipes-devtools/qemu/qemu-qoriq_4.1.0.bb index 2c5a5fd4d..dfd7fdcfc 100644 --- a/recipes-devtools/qemu/qemu-qoriq_4.1.0.bb +++ b/recipes-devtools/qemu/qemu-qoriq_4.1.0.bb | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | BBCLASSEXTEND = "" | 1 | BBCLASSEXTEND = "" | 
| 2 | 2 | ||
| 3 | require recipes-devtools/qemu/qemu.inc | 3 | require qemu.inc | 
| 4 | 4 | ||
| 5 | COMPATIBLE_MACHINE = "(qoriq)" | 5 | COMPATIBLE_MACHINE = "(qoriq)" | 
| 6 | 6 | ||
| diff --git a/recipes-devtools/qemu/qemu-targets.inc b/recipes-devtools/qemu/qemu-targets.inc new file mode 100644 index 000000000..24f9a0394 --- /dev/null +++ b/recipes-devtools/qemu/qemu-targets.inc | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | # possible arch values are: | ||
| 2 | # aarch64 arm armeb alpha cris i386 x86_64 m68k microblaze | ||
| 3 | # mips mipsel mips64 mips64el ppc ppc64 ppc64abi32 ppcemb | ||
| 4 | # riscv32 riscv64 sparc sparc32 sparc32plus | ||
| 5 | |||
| 6 | def get_qemu_target_list(d): | ||
| 7 | import bb | ||
| 8 | archs = d.getVar('QEMU_TARGETS').split() | ||
| 9 | tos = d.getVar('HOST_OS') | ||
| 10 | softmmuonly = "" | ||
| 11 | for arch in ['ppcemb', 'lm32']: | ||
| 12 | if arch in archs: | ||
| 13 | softmmuonly += arch + "-softmmu," | ||
| 14 | archs.remove(arch) | ||
| 15 | linuxuseronly = "" | ||
| 16 | for arch in ['armeb', 'alpha', 'ppc64abi32', 'ppc64le', 'sparc32plus', 'aarch64_be']: | ||
| 17 | if arch in archs: | ||
| 18 | linuxuseronly += arch + "-linux-user," | ||
| 19 | archs.remove(arch) | ||
| 20 | if 'linux' not in tos: | ||
| 21 | return softmmuonly + ''.join([arch + "-softmmu" + "," for arch in archs]).rstrip(',') | ||
| 22 | return softmmuonly + linuxuseronly + ''.join([arch + "-linux-user" + "," + arch + "-softmmu" + "," for arch in archs]).rstrip(',') | ||
| 23 | |||
| 24 | def get_qemu_usermode_target_list(d): | ||
| 25 | return ",".join(filter(lambda i: "-linux-user" in i, get_qemu_target_list(d).split(','))) | ||
| 26 | |||
| 27 | def get_qemu_system_target_list(d): | ||
| 28 | return ",".join(filter(lambda i: "-linux-user" not in i, get_qemu_target_list(d).split(','))) | ||
| diff --git a/recipes-devtools/qemu/qemu.inc b/recipes-devtools/qemu/qemu.inc new file mode 100644 index 000000000..bf05da9a4 --- /dev/null +++ b/recipes-devtools/qemu/qemu.inc | |||
| @@ -0,0 +1,198 @@ | |||
| 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 | |||
| 9 | RDEPENDS_${PN}-ptest = "bash make" | ||
| 10 | |||
| 11 | require qemu-targets.inc | ||
| 12 | inherit pkgconfig ptest | ||
| 13 | |||
| 14 | LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ | ||
| 15 | file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f" | ||
| 16 | |||
| 17 | SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ | ||
| 18 | file://powerpc_rom.bin \ | ||
| 19 | file://run-ptest \ | ||
| 20 | file://0001-qemu-Add-missing-wacom-HID-descriptor.patch \ | ||
| 21 | file://0002-Add-subpackage-ptest-which-runs-all-unit-test-cases-.patch \ | ||
| 22 | file://0003-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ | ||
| 23 | file://0004-qemu-disable-Valgrind.patch \ | ||
| 24 | file://0005-qemu-native-set-ld.bfd-fix-cflags-and-set-some-envir.patch \ | ||
| 25 | file://0006-chardev-connect-socket-to-a-spawned-command.patch \ | ||
| 26 | file://0007-apic-fixup-fallthrough-to-PIC.patch \ | ||
| 27 | file://0008-linux-user-Fix-webkitgtk-hangs-on-32-bit-x86-target.patch \ | ||
| 28 | file://0009-Fix-webkitgtk-builds.patch \ | ||
| 29 | file://0010-configure-Add-pkg-config-handling-for-libgcrypt.patch \ | ||
| 30 | file://0001-Add-enable-disable-udev.patch \ | ||
| 31 | file://0001-qemu-Do-not-include-file-if-not-exists.patch \ | ||
| 32 | file://find_datadir.patch \ | ||
| 33 | file://usb-fix-setup_len-init.patch \ | ||
| 34 | file://0001-target-mips-Increase-number-of-TLB-entries-on-the-34.patch \ | ||
| 35 | file://CVE-2020-24352.patch \ | ||
| 36 | file://CVE-2020-29129-CVE-2020-29130.patch \ | ||
| 37 | file://CVE-2020-25624.patch \ | ||
| 38 | file://CVE-2020-25723.patch \ | ||
| 39 | file://CVE-2020-28916.patch \ | ||
| 40 | file://CVE-2020-35517.patch \ | ||
| 41 | file://CVE-2020-29443.patch \ | ||
| 42 | file://CVE-2021-20203.patch \ | ||
| 43 | " | ||
| 44 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" | ||
| 45 | |||
| 46 | SRC_URI[sha256sum] = "c9174eb5933d9eb5e61f541cd6d1184cd3118dfe4c5c4955bc1bdc4d390fa4e5" | ||
| 47 | |||
| 48 | COMPATIBLE_HOST_mipsarchn32 = "null" | ||
| 49 | COMPATIBLE_HOST_mipsarchn64 = "null" | ||
| 50 | |||
| 51 | # Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html | ||
| 52 | # upstream states qemu doesn't work without optimization | ||
| 53 | DEBUG_BUILD = "0" | ||
| 54 | |||
| 55 | do_install_append() { | ||
| 56 | # Prevent QA warnings about installed ${localstatedir}/run | ||
| 57 | if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi | ||
| 58 | } | ||
| 59 | |||
| 60 | do_compile_ptest() { | ||
| 61 | make buildtest-TESTS | ||
| 62 | } | ||
| 63 | |||
| 64 | do_install_ptest() { | ||
| 65 | cp -rL ${B}/tests ${D}${PTEST_PATH} | ||
| 66 | find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcod]" | xargs -i rm -rf {} | ||
| 67 | |||
| 68 | cp ${S}/tests/Makefile.include ${D}${PTEST_PATH}/tests | ||
| 69 | # Don't check the file genreated by configure | ||
| 70 | sed -i -e '/wildcard config-host.mak/d' \ | ||
| 71 | -e '$ {/endif/d}' ${D}${PTEST_PATH}/tests/Makefile.include | ||
| 72 | sed -i -e 's,${HOSTTOOLS_DIR}/python3,${bindir}/python3,' \ | ||
| 73 | ${D}/${PTEST_PATH}/tests/qemu-iotests/common.env | ||
| 74 | } | ||
| 75 | |||
| 76 | # QEMU_TARGETS is overridable variable | ||
| 77 | QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64" | ||
| 78 | |||
| 79 | EXTRA_OECONF = " \ | ||
| 80 | --prefix=${prefix} \ | ||
| 81 | --bindir=${bindir} \ | ||
| 82 | --includedir=${includedir} \ | ||
| 83 | --libdir=${libdir} \ | ||
| 84 | --mandir=${mandir} \ | ||
| 85 | --datadir=${datadir} \ | ||
| 86 | --docdir=${docdir}/${BPN} \ | ||
| 87 | --sysconfdir=${sysconfdir} \ | ||
| 88 | --libexecdir=${libexecdir} \ | ||
| 89 | --localstatedir=${localstatedir} \ | ||
| 90 | --with-confsuffix=/${BPN} \ | ||
| 91 | --disable-strip \ | ||
| 92 | --disable-werror \ | ||
| 93 | --extra-cflags='${CFLAGS}' \ | ||
| 94 | --extra-ldflags='${LDFLAGS}' \ | ||
| 95 | --with-git=/bin/false \ | ||
| 96 | --disable-git-update \ | ||
| 97 | ${PACKAGECONFIG_CONFARGS} \ | ||
| 98 | " | ||
| 99 | |||
| 100 | export LIBTOOL="${HOST_SYS}-libtool" | ||
| 101 | |||
| 102 | B = "${WORKDIR}/build" | ||
| 103 | |||
| 104 | EXTRA_OECONF_append = " --python=${HOSTTOOLS_DIR}/python3" | ||
| 105 | |||
| 106 | do_configure_prepend_class-native() { | ||
| 107 | # Append build host pkg-config paths for native target since the host may provide sdl | ||
| 108 | BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "") | ||
| 109 | if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then | ||
| 110 | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH | ||
| 111 | fi | ||
| 112 | } | ||
| 113 | |||
| 114 | do_configure() { | ||
| 115 | ${S}/configure ${EXTRA_OECONF} | ||
| 116 | } | ||
| 117 | do_configure[cleandirs] += "${B}" | ||
| 118 | |||
| 119 | do_install () { | ||
| 120 | export STRIP="" | ||
| 121 | oe_runmake 'DESTDIR=${D}' install | ||
| 122 | } | ||
| 123 | |||
| 124 | # The following fragment will create a wrapper for qemu-mips user emulation | ||
| 125 | # binary in order to work around a segmentation fault issue. Basically, by | ||
| 126 | # default, the reserved virtual address space for 32-on-64 bit is set to 4GB. | ||
| 127 | # This will trigger a MMU access fault in the virtual CPU. With this change, | ||
| 128 | # the qemu-mips works fine. | ||
| 129 | # IMPORTANT: This piece needs to be removed once the root cause is fixed! | ||
| 130 | do_install_append() { | ||
| 131 | if [ -e "${D}/${bindir}/qemu-mips" ]; then | ||
| 132 | create_wrapper ${D}/${bindir}/qemu-mips \ | ||
| 133 | QEMU_RESERVED_VA=0x0 | ||
| 134 | fi | ||
| 135 | } | ||
| 136 | # END of qemu-mips workaround | ||
| 137 | |||
| 138 | make_qemu_wrapper() { | ||
| 139 | gdk_pixbuf_module_file=`pkg-config --variable=gdk_pixbuf_cache_file gdk-pixbuf-2.0` | ||
| 140 | |||
| 141 | for tool in `ls ${D}${bindir}/qemu-system-*`; do | ||
| 142 | create_wrapper $tool \ | ||
| 143 | GDK_PIXBUF_MODULE_FILE=$gdk_pixbuf_module_file \ | ||
| 144 | FONTCONFIG_PATH=/etc/fonts \ | ||
| 145 | GTK_THEME=Adwaita | ||
| 146 | done | ||
| 147 | } | ||
| 148 | |||
| 149 | # Disable kvm/virgl/mesa on targets that do not support it | ||
| 150 | PACKAGECONFIG_remove_darwin = "kvm virglrenderer glx gtk+" | ||
| 151 | PACKAGECONFIG_remove_mingw32 = "kvm virglrenderer glx gtk+" | ||
| 152 | |||
| 153 | PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" | ||
| 154 | PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr," | ||
| 155 | PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," | ||
| 156 | PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs," | ||
| 157 | PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest" | ||
| 158 | PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl," | ||
| 159 | PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg," | ||
| 160 | PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng," | ||
| 161 | PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl," | ||
| 162 | PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss," | ||
| 163 | PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," | ||
| 164 | PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native" | ||
| 165 | PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native" | ||
| 166 | PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng," | ||
| 167 | PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh," | ||
| 168 | PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt," | ||
| 169 | PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle" | ||
| 170 | PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1" | ||
| 171 | PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc" | ||
| 172 | PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,alsa-lib" | ||
| 173 | PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,virtual/libgl" | ||
| 174 | PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" | ||
| 175 | PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl" | ||
| 176 | PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls" | ||
| 177 | PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" | ||
| 178 | PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi" | ||
| 179 | PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm" | ||
| 180 | PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer" | ||
| 181 | # spice will be in meta-networking layer | ||
| 182 | PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice" | ||
| 183 | # usbredir will be in meta-networking layer | ||
| 184 | PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir" | ||
| 185 | PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy" | ||
| 186 | PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs" | ||
| 187 | PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" | ||
| 188 | PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev" | ||
| 189 | PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2" | ||
| 190 | PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr," | ||
| 191 | PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph" | ||
| 192 | PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,," | ||
| 193 | PACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust," | ||
| 194 | PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,," | ||
| 195 | |||
| 196 | INSANE_SKIP_${PN} = "arch" | ||
| 197 | |||
| 198 | FILES_${PN} += "${datadir}/icons" | ||
