diff options
Diffstat (limited to 'meta-xilinx-core/recipes-devtools/qemu/qemu-8.1.inc')
-rw-r--r-- | meta-xilinx-core/recipes-devtools/qemu/qemu-8.1.inc | 280 |
1 files changed, 280 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-devtools/qemu/qemu-8.1.inc b/meta-xilinx-core/recipes-devtools/qemu/qemu-8.1.inc new file mode 100644 index 00000000..a6920fec --- /dev/null +++ b/meta-xilinx-core/recipes-devtools/qemu/qemu-8.1.inc | |||
@@ -0,0 +1,280 @@ | |||
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 = "GPL-2.0-only & LGPL-2.1-only" | ||
8 | |||
9 | RDEPENDS:${PN}-ptest = "bash" | ||
10 | |||
11 | require qemu-targets-8.1.inc | ||
12 | # https://gitlab.com/qemu-project/qemu/-/commit/81e2b198a8cb4ee5fdf108bd438f44b193ee3a36 means | ||
13 | # we need a full python3-native setup | ||
14 | inherit pkgconfig ptest update-rc.d systemd python3native | ||
15 | |||
16 | LIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \ | ||
17 | file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f" | ||
18 | |||
19 | SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ | ||
20 | file://powerpc_rom.bin \ | ||
21 | file://run-ptest \ | ||
22 | file://0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch \ | ||
23 | file://0003-apic-fixup-fallthrough-to-PIC.patch \ | ||
24 | file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \ | ||
25 | file://0005-qemu-Do-not-include-file-if-not-exists.patch \ | ||
26 | file://0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch \ | ||
27 | file://0007-qemu-Determinism-fixes.patch \ | ||
28 | file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \ | ||
29 | file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \ | ||
30 | file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \ | ||
31 | file://0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch \ | ||
32 | file://fixedmeson.patch \ | ||
33 | file://fixmips.patch \ | ||
34 | file://qemu-guest-agent.init \ | ||
35 | file://qemu-guest-agent.udev \ | ||
36 | " | ||
37 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" | ||
38 | |||
39 | |||
40 | SRC_URI[sha256sum] = "541526a764576eb494d2ff5ec46aeb253e62ea29035d1c23c0a8af4e6cd4f087" | ||
41 | |||
42 | SRC_URI:append:class-target = " file://cross.patch" | ||
43 | SRC_URI:append:class-nativesdk = " file://cross.patch" | ||
44 | |||
45 | CVE_STATUS[CVE-2017-5957] = "cpe-incorrect: Applies against virglrender < 0.6.0 and not qemu itself" | ||
46 | |||
47 | CVE_STATUS[CVE-2007-0998] = "not-applicable-config: The VNC server can expose host files uder some circumstances. We don't enable it by default." | ||
48 | |||
49 | # https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11 | ||
50 | CVE_STATUS[CVE-2018-18438] = "disputed: The issues identified by this CVE were determined to not constitute a vulnerability." | ||
51 | |||
52 | # As per https://nvd.nist.gov/vuln/detail/CVE-2023-0664 | ||
53 | # https://bugzilla.redhat.com/show_bug.cgi?id=2167423 | ||
54 | CVE_STATUS[CVE-2023-0664] = "not-applicable-platform: Issue only applies on Windows" | ||
55 | |||
56 | # As per https://bugzilla.redhat.com/show_bug.cgi?id=2203387 | ||
57 | CVE_STATUS[CVE-2023-2680] = "not-applicable-platform: RHEL specific issue." | ||
58 | |||
59 | COMPATIBLE_HOST:mipsarchn32 = "null" | ||
60 | COMPATIBLE_HOST:mipsarchn64 = "null" | ||
61 | COMPATIBLE_HOST:riscv32 = "null" | ||
62 | |||
63 | # Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html | ||
64 | # upstream states qemu doesn't work without optimization | ||
65 | DEBUG_BUILD = "0" | ||
66 | |||
67 | do_install:append() { | ||
68 | # Prevent QA warnings about installed ${localstatedir}/run | ||
69 | if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi | ||
70 | } | ||
71 | |||
72 | do_install_ptest() { | ||
73 | cp -rL ${B}/tests ${D}${PTEST_PATH} | ||
74 | find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {} | ||
75 | |||
76 | # Don't check the file genreated by configure | ||
77 | sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh | ||
78 | |||
79 | # Strip the paths from the QEMU variable, we can use PATH | ||
80 | makfiles=$(find ${D}${PTEST_PATH} -name "*.mak") | ||
81 | sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" $makfiles | ||
82 | |||
83 | # Strip compiler flags as they break reproducibility | ||
84 | sed -i -e "s,^CC=.*,CC=gcc," \ | ||
85 | -e "s,^CCAS=.*,CCAS=gcc," \ | ||
86 | -e "s,^LD=.*,LD=ld," $makfiles | ||
87 | |||
88 | # Update SRC_PATH variable to the right place on target | ||
89 | sed -i -e "s#^SRC_PATH=.*#SRC_PATH=${PTEST_PATH}#g" $makfiles | ||
90 | |||
91 | # https://gitlab.com/qemu-project/qemu/-/issues/1403 | ||
92 | rm ${D}${PTEST_PATH}/tests/unit/test-io-channel-command | ||
93 | } | ||
94 | |||
95 | # QEMU_TARGETS is overridable variable | ||
96 | QEMU_TARGETS ?= "arm aarch64 i386 loongarch64 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64" | ||
97 | |||
98 | EXTRA_OECONF = " \ | ||
99 | --prefix=${prefix} \ | ||
100 | --bindir=${bindir} \ | ||
101 | --includedir=${includedir} \ | ||
102 | --libdir=${libdir} \ | ||
103 | --mandir=${mandir} \ | ||
104 | --datadir=${datadir} \ | ||
105 | --docdir=${docdir}/${BPN} \ | ||
106 | --sysconfdir=${sysconfdir} \ | ||
107 | --libexecdir=${libexecdir} \ | ||
108 | --localstatedir=${localstatedir} \ | ||
109 | --with-suffix=${BPN} \ | ||
110 | --disable-strip \ | ||
111 | --disable-werror \ | ||
112 | --extra-cflags='${CFLAGS}' \ | ||
113 | --extra-ldflags='${LDFLAGS}' \ | ||
114 | --disable-download \ | ||
115 | --disable-docs \ | ||
116 | ${PACKAGECONFIG_CONFARGS} \ | ||
117 | " | ||
118 | |||
119 | B = "${WORKDIR}/build" | ||
120 | |||
121 | #EXTRA_OECONF:append = " --python=${HOSTTOOLS_DIR}/python3" | ||
122 | |||
123 | do_configure:prepend:class-native() { | ||
124 | # Append build host pkg-config paths for native target since the host may provide sdl | ||
125 | BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "") | ||
126 | if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then | ||
127 | export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH | ||
128 | fi | ||
129 | } | ||
130 | |||
131 | do_configure() { | ||
132 | ${S}/configure ${EXTRA_OECONF} | ||
133 | } | ||
134 | do_configure[cleandirs] += "${B}" | ||
135 | |||
136 | do_install () { | ||
137 | export STRIP="" | ||
138 | oe_runmake 'DESTDIR=${D}' install | ||
139 | |||
140 | # If we built the guest agent, also install startup/udev rules | ||
141 | if [ -e "${D}${bindir}/qemu-ga" ]; then | ||
142 | install -d ${D}${sysconfdir}/init.d/ | ||
143 | install -m 0755 ${WORKDIR}/qemu-guest-agent.init ${D}${sysconfdir}/init.d/qemu-guest-agent | ||
144 | sed -i 's:@bindir@:${bindir}:' ${D}${sysconfdir}/init.d/qemu-guest-agent | ||
145 | |||
146 | install -d ${D}${sysconfdir}/udev/rules.d/ | ||
147 | install -m 0644 ${WORKDIR}/qemu-guest-agent.udev ${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules | ||
148 | |||
149 | install -d ${D}${systemd_unitdir}/system/ | ||
150 | install -m 0644 ${S}/contrib/systemd/qemu-guest-agent.service ${D}${systemd_unitdir}/system | ||
151 | sed -i -e 's,-/usr/bin/,-${bindir}/,g' ${D}${systemd_unitdir}/system/qemu-guest-agent.service | ||
152 | fi | ||
153 | # ELF binary /usr/share/qemu/s390-netboot.img has relocations in .text | ||
154 | rm ${D}${datadir}/qemu/s390-netboot.img -f | ||
155 | # ELF binary /usr/share/qemu/s390-ccw.img has relocations in .text [textrel] | ||
156 | rm ${D}${datadir}/qemu/s390-ccw.img -f | ||
157 | } | ||
158 | |||
159 | # The following fragment will create a wrapper for qemu-mips user emulation | ||
160 | # binary in order to work around a segmentation fault issue. Basically, by | ||
161 | # default, the reserved virtual address space for 32-on-64 bit is set to 4GB. | ||
162 | # This will trigger a MMU access fault in the virtual CPU. With this change, | ||
163 | # the qemu-mips works fine. | ||
164 | # IMPORTANT: This piece needs to be removed once the root cause is fixed! | ||
165 | do_install:append() { | ||
166 | if [ -e "${D}/${bindir}/qemu-mips" ]; then | ||
167 | create_wrapper ${D}/${bindir}/qemu-mips \ | ||
168 | QEMU_RESERVED_VA=0x0 | ||
169 | fi | ||
170 | } | ||
171 | # END of qemu-mips workaround | ||
172 | |||
173 | # Disable kvm/virgl/mesa on targets that do not support it | ||
174 | PACKAGECONFIG:remove:darwin = "kvm virglrenderer epoxy gtk+" | ||
175 | PACKAGECONFIG:remove:mingw32 = "kvm virglrenderer epoxy gtk+" | ||
176 | |||
177 | PACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2" | ||
178 | PACKAGECONFIG[png] = "--enable-png,--disable-png,libpng" | ||
179 | PACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr," | ||
180 | PACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio," | ||
181 | PACKAGECONFIG[uring] = "--enable-linux-io-uring,--disable-linux-io-uring,liburing" | ||
182 | PACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest" | ||
183 | PACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl," | ||
184 | PACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg," | ||
185 | PACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl," | ||
186 | PACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss," | ||
187 | PACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses," | ||
188 | PACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native" | ||
189 | PACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native" | ||
190 | PACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng," | ||
191 | PACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh," | ||
192 | PACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt," | ||
193 | PACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle" | ||
194 | PACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1" | ||
195 | PACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc" | ||
196 | PACKAGECONFIG[alsa] = "--audio-drv-list=default,,alsa-lib" | ||
197 | PACKAGECONFIG[epoxy] = "--enable-opengl,--disable-opengl,libepoxy" | ||
198 | PACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo" | ||
199 | PACKAGECONFIG[dax] = "--enable-libdaxctl,--disable-libdaxctl,ndctl" | ||
200 | PACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl" | ||
201 | PACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls" | ||
202 | PACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2" | ||
203 | PACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi" | ||
204 | PACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm" | ||
205 | PACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer" | ||
206 | # spice will be in meta-networking layer | ||
207 | PACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice" | ||
208 | # usbredir will be in meta-networking layer | ||
209 | PACKAGECONFIG[dbus-display] = "--enable-dbus-display,--disable-dbus-display,glib-2.0-native,dbus" | ||
210 | PACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir" | ||
211 | PACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy" | ||
212 | PACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs" | ||
213 | PACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon" | ||
214 | PACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,udev" | ||
215 | PACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr," | ||
216 | PACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph" | ||
217 | PACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,," | ||
218 | PACKAGECONFIG[ust] = "--enable-trace-backends=ust,,lttng-ust," | ||
219 | PACKAGECONFIG[pie] = "--enable-pie,--disable-pie,," | ||
220 | PACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp" | ||
221 | # libnfs is currently provided by meta-kodi | ||
222 | PACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs" | ||
223 | PACKAGECONFIG[pmem] = "--enable-libpmem,--disable-libpmem,pmdk" | ||
224 | PACKAGECONFIG[pulseaudio] = "--enable-pa,--disable-pa,pulseaudio" | ||
225 | PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux" | ||
226 | PACKAGECONFIG[bpf] = "--enable-bpf,--disable-bpf,libbpf" | ||
227 | PACKAGECONFIG[capstone] = "--enable-capstone,--disable-capstone" | ||
228 | PACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma" | ||
229 | PACKAGECONFIG[vde] = "--enable-vde,--disable-vde" | ||
230 | PACKAGECONFIG[fuse] = "--enable-fuse --enable-fuse-lseek,--disable-fuse --disable-fuse-lseek,fuse3" | ||
231 | PACKAGECONFIG[slirp] = "--enable-slirp,--disable-slirp,libslirp" | ||
232 | PACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi" | ||
233 | PACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack," | ||
234 | PACKAGECONFIG[debuginfo] = "--enable-libdw,--disable-libdw,elfutils" | ||
235 | |||
236 | INSANE_SKIP:${PN}-common = "arch" | ||
237 | |||
238 | FILES:${PN} += "${datadir}/icons" | ||
239 | |||
240 | # For user who want to install all arch packages | ||
241 | PACKAGES =+ "${PN}-common" | ||
242 | RDEPENDS:${PN} += "${PN}-common" | ||
243 | |||
244 | ALLOW_EMPTY:${PN} = "1" | ||
245 | FILES:${PN} = "" | ||
246 | |||
247 | FILES:${PN}-common = "${bindir}/* ${includedir}/* ${libexecdir}/* ${datadir}/* ${localstatedir}" | ||
248 | |||
249 | PACKAGES_DYNAMIC += "^${PN}-user-.* ^${PN}-system-.*" | ||
250 | |||
251 | PACKAGESPLITFUNCS =+ "split_qemu_packages" | ||
252 | |||
253 | python split_qemu_packages () { | ||
254 | archdir = d.expand('${bindir}/') | ||
255 | subpackages = do_split_packages(d, archdir, r'^qemu-system-(.*)$', '${PN}-system-%s', 'QEMU full system emulation binaries(%s)' , prepend=True, extra_depends='${PN}-common') | ||
256 | |||
257 | subpackages += do_split_packages(d, archdir, r'^qemu-((?!system|edid|ga|img|io|nbd|pr-helper|storage-daemon).*)$', '${PN}-user-%s', 'QEMU full user emulation binaries(%s)' , prepend=True, extra_depends='${PN}-common') | ||
258 | if subpackages: | ||
259 | d.appendVar('RDEPENDS:' + d.getVar('PN'), ' ' + ' '.join(subpackages)) | ||
260 | mipspackage = d.getVar('PN') + "-user-mips" | ||
261 | if mipspackage in ' '.join(subpackages): | ||
262 | d.appendVar('RDEPENDS:' + mipspackage, ' ' + d.getVar("MLPREFIX") + 'bash') | ||
263 | } | ||
264 | |||
265 | # Put the guest agent in a separate package | ||
266 | PACKAGES =+ "${PN}-guest-agent" | ||
267 | SUMMARY:${PN}-guest-agent = "QEMU guest agent" | ||
268 | FILES:${PN}-guest-agent += " \ | ||
269 | ${bindir}/qemu-ga \ | ||
270 | ${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \ | ||
271 | ${sysconfdir}/init.d/qemu-guest-agent \ | ||
272 | ${systemd_unitdir}/system/qemu-guest-agent.service \ | ||
273 | " | ||
274 | |||
275 | INITSCRIPT_PACKAGES = "${PN}-guest-agent" | ||
276 | INITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent" | ||
277 | INITSCRIPT_PARAMS:${PN}-guest-agent = "defaults" | ||
278 | |||
279 | SYSTEMD_PACKAGES = "${PN}-guest-agent" | ||
280 | SYSTEMD_SERVICE:${PN}-guest-agent = "qemu-guest-agent.service" | ||