summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-devtools/qemu/qemu-qoriq_4.1.0.bb2
-rw-r--r--recipes-devtools/qemu/qemu-targets.inc28
-rw-r--r--recipes-devtools/qemu/qemu.inc198
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 2c5a5fd4..dfd7fdcf 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 @@
1BBCLASSEXTEND = "" 1BBCLASSEXTEND = ""
2 2
3require recipes-devtools/qemu/qemu.inc 3require qemu.inc
4 4
5COMPATIBLE_MACHINE = "(qoriq)" 5COMPATIBLE_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 00000000..24f9a039
--- /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
6def 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
24def get_qemu_usermode_target_list(d):
25 return ",".join(filter(lambda i: "-linux-user" in i, get_qemu_target_list(d).split(',')))
26
27def 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 00000000..bf05da9a
--- /dev/null
+++ b/recipes-devtools/qemu/qemu.inc
@@ -0,0 +1,198 @@
1SUMMARY = "Fast open source processor emulator"
2DESCRIPTION = "QEMU is a hosted virtual machine monitor: it emulates the \
3machine's processor through dynamic binary translation and provides a set \
4of different hardware and device models for the machine, enabling it to run \
5a variety of guest operating systems"
6HOMEPAGE = "http://qemu.org"
7LICENSE = "GPLv2 & LGPLv2.1"
8
9RDEPENDS_${PN}-ptest = "bash make"
10
11require qemu-targets.inc
12inherit pkgconfig ptest
13
14LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
15 file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
16
17SRC_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 "
44UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
45
46SRC_URI[sha256sum] = "c9174eb5933d9eb5e61f541cd6d1184cd3118dfe4c5c4955bc1bdc4d390fa4e5"
47
48COMPATIBLE_HOST_mipsarchn32 = "null"
49COMPATIBLE_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
53DEBUG_BUILD = "0"
54
55do_install_append() {
56 # Prevent QA warnings about installed ${localstatedir}/run
57 if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
58}
59
60do_compile_ptest() {
61 make buildtest-TESTS
62}
63
64do_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
77QEMU_TARGETS ?= "arm aarch64 i386 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
78
79EXTRA_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
100export LIBTOOL="${HOST_SYS}-libtool"
101
102B = "${WORKDIR}/build"
103
104EXTRA_OECONF_append = " --python=${HOSTTOOLS_DIR}/python3"
105
106do_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
114do_configure() {
115 ${S}/configure ${EXTRA_OECONF}
116}
117do_configure[cleandirs] += "${B}"
118
119do_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!
130do_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
138make_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
150PACKAGECONFIG_remove_darwin = "kvm virglrenderer glx gtk+"
151PACKAGECONFIG_remove_mingw32 = "kvm virglrenderer glx gtk+"
152
153PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2"
154PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr,"
155PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio,"
156PACKAGECONFIG[xfs] = "--enable-xfsctl,--disable-xfsctl,xfsprogs,"
157PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest"
158PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl,"
159PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg,"
160PACKAGECONFIG[vnc-png] = "--enable-vnc --enable-vnc-png,--disable-vnc-png,libpng,"
161PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl,"
162PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss,"
163PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
164PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native"
165PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native"
166PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
167PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh,"
168PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
169PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle"
170PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
171PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
172PACKAGECONFIG[alsa] = "--audio-drv-list='oss alsa',,alsa-lib"
173PACKAGECONFIG[glx] = "--enable-opengl,--disable-opengl,virtual/libgl"
174PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
175PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
176PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
177PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
178PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
179PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
180PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer"
181# spice will be in meta-networking layer
182PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice"
183# usbredir will be in meta-networking layer
184PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir"
185PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy"
186PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs"
187PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
188PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,eudev"
189PACKAGECONFIG[libxml2] = "--enable-libxml2,--disable-libxml2,libxml2"
190PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr,"
191PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph"
192PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,,"
193PACKAGECONFIG[ust] = "--enable-trace-backend=ust,--enable-trace-backend=nop,lttng-ust,"
194PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,,"
195
196INSANE_SKIP_${PN} = "arch"
197
198FILES_${PN} += "${datadir}/icons"