1eb8dc403SDave CobbleySUMMARY = "Fast open source processor emulator"
2f3f93bb8SBrad BishopDESCRIPTION = "QEMU is a hosted virtual machine monitor: it emulates the \
3f3f93bb8SBrad Bishopmachine's processor through dynamic binary translation and provides a set \
4f3f93bb8SBrad Bishopof different hardware and device models for the machine, enabling it to run \
5f3f93bb8SBrad Bishopa variety of guest operating systems"
6eb8dc403SDave CobbleyHOMEPAGE = "http://qemu.org"
77e0e3c0cSAndrew GeisslerLICENSE = "GPL-2.0-only & LGPL-2.1-only"
819323693SBrad Bishop
9213cb269SPatrick WilliamsRDEPENDS:${PN}-ptest = "bash"
1019323693SBrad Bishop
1115ae2509SBrad Bishoprequire qemu-targets.inc
12*5082cc7fSAndrew Geissler# https://gitlab.com/qemu-project/qemu/-/commit/81e2b198a8cb4ee5fdf108bd438f44b193ee3a36 means
13*5082cc7fSAndrew Geissler# we need a full python3-native setup
14*5082cc7fSAndrew Geisslerinherit pkgconfig ptest update-rc.d systemd python3native
1515ae2509SBrad Bishop
1619323693SBrad BishopLIC_FILES_CHKSUM = "file://COPYING;md5=441c28d2cf86e15a37fa47e15a72fbac \
17c342db35SBrad Bishop                    file://COPYING.LIB;endline=24;md5=8c5efda6cf1e1b03dcfd0e6c0d271c7f"
1819323693SBrad Bishop
1919323693SBrad BishopSRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \
2019323693SBrad Bishop           file://powerpc_rom.bin \
2119323693SBrad Bishop           file://run-ptest \
22d583833aSAndrew Geissler           file://0001-qemu-Add-addition-environment-space-to-boot-loader-q.patch \
23d583833aSAndrew Geissler           file://0003-apic-fixup-fallthrough-to-PIC.patch \
24d583833aSAndrew Geissler           file://0004-configure-Add-pkg-config-handling-for-libgcrypt.patch \
25d583833aSAndrew Geissler           file://0005-qemu-Do-not-include-file-if-not-exists.patch \
26d583833aSAndrew Geissler           file://0006-qemu-Add-some-user-space-mmap-tweaks-to-address-musl.patch \
27d583833aSAndrew Geissler           file://0007-qemu-Determinism-fixes.patch \
28d583833aSAndrew Geissler           file://0008-tests-meson.build-use-relative-path-to-refer-to-file.patch \
29d583833aSAndrew Geissler           file://0009-Define-MAP_SYNC-and-MAP_SHARED_VALIDATE-on-needed-li.patch \
30d583833aSAndrew Geissler           file://0010-hw-pvrdma-Protect-against-buggy-or-malicious-guest-d.patch \
31517393d9SAndrew Geissler           file://0002-linux-user-Replace-use-of-lfs64-related-functions-an.patch \
32*5082cc7fSAndrew Geissler           file://0001-softmmu-Assert-data-in-bounds-in-iotlb_to_section.patch \
33*5082cc7fSAndrew Geissler           file://0001-softmmu-Use-async_run_on_cpu-in-tcg_commit.patch \
34*5082cc7fSAndrew Geissler           file://fixedmeson.patch \
35*5082cc7fSAndrew Geissler           file://fixmips.patch \
36fc113eadSAndrew Geissler           file://qemu-guest-agent.init \
37fc113eadSAndrew Geissler           file://qemu-guest-agent.udev \
3819323693SBrad Bishop           "
3919323693SBrad BishopUPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar"
4019323693SBrad Bishop
41*5082cc7fSAndrew Geissler
42*5082cc7fSAndrew GeisslerSRC_URI[sha256sum] = "710c101198e334d4762eef65f649bc43fa8a5dd75303554b8acfec3eb25f0e55"
43d1e89497SAndrew Geissler
44213cb269SPatrick WilliamsSRC_URI:append:class-target = " file://cross.patch"
45213cb269SPatrick WilliamsSRC_URI:append:class-nativesdk = " file://cross.patch"
4619323693SBrad Bishop
478f840685SAndrew GeisslerCVE_STATUS[CVE-2017-5957] = "cpe-incorrect: Applies against virglrender < 0.6.0 and not qemu itself"
48ac69b488SWilliam A. Kennington III
498f840685SAndrew GeisslerCVE_STATUS[CVE-2007-0998] = "not-applicable-config: The VNC server can expose host files uder some circumstances. We don't enable it by default."
50ac69b488SWilliam A. Kennington III
51ac69b488SWilliam A. Kennington III# https://bugzilla.redhat.com/show_bug.cgi?id=1609015#c11
528f840685SAndrew GeisslerCVE_STATUS[CVE-2018-18438] = "disputed: The issues identified by this CVE were determined to not constitute a vulnerability."
53ac69b488SWilliam A. Kennington III
54028142bdSAndrew Geissler# As per https://nvd.nist.gov/vuln/detail/CVE-2023-0664
55028142bdSAndrew Geissler# https://bugzilla.redhat.com/show_bug.cgi?id=2167423
568f840685SAndrew GeisslerCVE_STATUS[CVE-2023-0664] = "not-applicable-platform: Issue only applies on Windows"
57028142bdSAndrew Geissler
58213cb269SPatrick WilliamsCOMPATIBLE_HOST:mipsarchn32 = "null"
59213cb269SPatrick WilliamsCOMPATIBLE_HOST:mipsarchn64 = "null"
60595f6308SAndrew GeisslerCOMPATIBLE_HOST:riscv32 = "null"
6119323693SBrad Bishop
62c9f7865aSAndrew Geissler# Per https://lists.nongnu.org/archive/html/qemu-devel/2020-09/msg03873.html
63c9f7865aSAndrew Geissler# upstream states qemu doesn't work without optimization
64c9f7865aSAndrew GeisslerDEBUG_BUILD = "0"
65c9f7865aSAndrew Geissler
66213cb269SPatrick Williamsdo_install:append() {
6719323693SBrad Bishop    # Prevent QA warnings about installed ${localstatedir}/run
6819323693SBrad Bishop    if [ -d ${D}${localstatedir}/run ]; then rmdir ${D}${localstatedir}/run; fi
6919323693SBrad Bishop}
7019323693SBrad Bishop
7119323693SBrad Bishopdo_install_ptest() {
7219323693SBrad Bishop	cp -rL ${B}/tests ${D}${PTEST_PATH}
73d1e89497SAndrew Geissler	find ${D}${PTEST_PATH}/tests -type f -name "*.[Sshcodp]" | xargs -i rm -rf {}
7419323693SBrad Bishop
7519323693SBrad Bishop	# Don't check the file genreated by configure
76635e0e46SAndrew Geissler	sed -i -e "1s,#!/usr/bin/bash,#!${base_bindir}/bash," ${D}${PTEST_PATH}/tests/data/acpi/disassemle-aml.sh
7790fd73cbSAndrew Geissler
7890fd73cbSAndrew Geissler	# Strip the paths from the QEMU variable, we can use PATH
79517393d9SAndrew Geissler	makfiles=$(find ${D}${PTEST_PATH} -name "*.mak")
80517393d9SAndrew Geissler	sed -i -e "s#^QEMU=.*/qemu-#QEMU=qemu-#g" $makfiles
81eff27476SAndrew Geissler
82eff27476SAndrew Geissler	# Strip compiler flags as they break reproducibility
8387f5cff0SAndrew Geissler	sed -i -e "s,^CC=.*,CC=gcc," \
8487f5cff0SAndrew Geissler	       -e "s,^CCAS=.*,CCAS=gcc," \
85517393d9SAndrew Geissler	       -e "s,^LD=.*,LD=ld," $makfiles
8687f5cff0SAndrew Geissler
8787f5cff0SAndrew Geissler	# Update SRC_PATH variable to the right place on target
88517393d9SAndrew Geissler	sed -i -e "s#^SRC_PATH=.*#SRC_PATH=${PTEST_PATH}#g" $makfiles
8987f5cff0SAndrew Geissler
90517393d9SAndrew Geissler	# https://gitlab.com/qemu-project/qemu/-/issues/1403
91517393d9SAndrew Geissler	rm ${D}${PTEST_PATH}/tests/unit/test-io-channel-command
9219323693SBrad Bishop}
9319323693SBrad Bishop
94eb8dc403SDave Cobbley# QEMU_TARGETS is overridable variable
95864cc43bSPatrick WilliamsQEMU_TARGETS ?= "arm aarch64 i386 loongarch64 mips mipsel mips64 mips64el ppc ppc64 ppc64le riscv32 riscv64 sh4 x86_64"
96eb8dc403SDave Cobbley
97eb8dc403SDave CobbleyEXTRA_OECONF = " \
98eb8dc403SDave Cobbley    --prefix=${prefix} \
99eb8dc403SDave Cobbley    --bindir=${bindir} \
100eb8dc403SDave Cobbley    --includedir=${includedir} \
101eb8dc403SDave Cobbley    --libdir=${libdir} \
102eb8dc403SDave Cobbley    --mandir=${mandir} \
103eb8dc403SDave Cobbley    --datadir=${datadir} \
104eb8dc403SDave Cobbley    --docdir=${docdir}/${BPN} \
105eb8dc403SDave Cobbley    --sysconfdir=${sysconfdir} \
106eb8dc403SDave Cobbley    --libexecdir=${libexecdir} \
107eb8dc403SDave Cobbley    --localstatedir=${localstatedir} \
108d1e89497SAndrew Geissler    --with-suffix=${BPN} \
109eb8dc403SDave Cobbley    --disable-strip \
110eb8dc403SDave Cobbley    --disable-werror \
111eb8dc403SDave Cobbley    --extra-cflags='${CFLAGS}' \
112d25ed324SAndrew Geissler    --extra-ldflags='${LDFLAGS}' \
113*5082cc7fSAndrew Geissler    --disable-download \
114*5082cc7fSAndrew Geissler    --disable-docs \
1151a4b7ee2SBrad Bishop    ${PACKAGECONFIG_CONFARGS} \
116eb8dc403SDave Cobbley    "
117eb8dc403SDave Cobbley
1181a4b7ee2SBrad BishopB = "${WORKDIR}/build"
1191a4b7ee2SBrad Bishop
1200ca19ccfSPatrick Williams#EXTRA_OECONF:append = " --python=${HOSTTOOLS_DIR}/python3"
12196ff1984SBrad Bishop
122213cb269SPatrick Williamsdo_configure:prepend:class-native() {
123eb8dc403SDave Cobbley	# Append build host pkg-config paths for native target since the host may provide sdl
124eb8dc403SDave Cobbley	BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path pkg-config || echo "")
125eb8dc403SDave Cobbley	if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
126eb8dc403SDave Cobbley		export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
127eb8dc403SDave Cobbley	fi
128eb8dc403SDave Cobbley}
129eb8dc403SDave Cobbley
130eb8dc403SDave Cobbleydo_configure() {
131eb8dc403SDave Cobbley    ${S}/configure ${EXTRA_OECONF}
132eb8dc403SDave Cobbley}
13364c979e8SBrad Bishopdo_configure[cleandirs] += "${B}"
134eb8dc403SDave Cobbley
135eb8dc403SDave Cobbleydo_install () {
1361a4b7ee2SBrad Bishop	export STRIP=""
1371a4b7ee2SBrad Bishop	oe_runmake 'DESTDIR=${D}' install
138fc113eadSAndrew Geissler
139fc113eadSAndrew Geissler	# If we built the guest agent, also install startup/udev rules
140fc113eadSAndrew Geissler	if [ -e "${D}${bindir}/qemu-ga" ]; then
141fc113eadSAndrew Geissler		install -d ${D}${sysconfdir}/init.d/
142fc113eadSAndrew Geissler		install -m 0755 ${WORKDIR}/qemu-guest-agent.init ${D}${sysconfdir}/init.d/qemu-guest-agent
143fc113eadSAndrew Geissler		sed -i 's:@bindir@:${bindir}:' ${D}${sysconfdir}/init.d/qemu-guest-agent
144fc113eadSAndrew Geissler
145fc113eadSAndrew Geissler		install -d ${D}${sysconfdir}/udev/rules.d/
146fc113eadSAndrew Geissler		install -m 0644 ${WORKDIR}/qemu-guest-agent.udev ${D}${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules
147fc113eadSAndrew Geissler
148fc113eadSAndrew Geissler		install -d ${D}${systemd_unitdir}/system/
149fc113eadSAndrew Geissler		install -m 0644 ${S}/contrib/systemd/qemu-guest-agent.service ${D}${systemd_unitdir}/system
150fc113eadSAndrew Geissler		sed -i -e 's,-/usr/bin/,-${bindir}/,g' ${D}${systemd_unitdir}/system/qemu-guest-agent.service
151fc113eadSAndrew Geissler	fi
152*5082cc7fSAndrew Geissler	# ELF binary /usr/share/qemu/s390-netboot.img has relocations in .text
153*5082cc7fSAndrew Geissler	rm ${D}${datadir}/qemu/s390-netboot.img -f
154*5082cc7fSAndrew Geissler	# ELF binary /usr/share/qemu/s390-ccw.img has relocations in .text [textrel]
155*5082cc7fSAndrew Geissler	rm ${D}${datadir}/qemu/s390-ccw.img -f
156eb8dc403SDave Cobbley}
157eb8dc403SDave Cobbley
158eb8dc403SDave Cobbley# The following fragment will create a wrapper for qemu-mips user emulation
159eb8dc403SDave Cobbley# binary in order to work around a segmentation fault issue. Basically, by
160eb8dc403SDave Cobbley# default, the reserved virtual address space for 32-on-64 bit is set to 4GB.
161eb8dc403SDave Cobbley# This will trigger a MMU access fault in the virtual CPU. With this change,
162eb8dc403SDave Cobbley# the qemu-mips works fine.
163eb8dc403SDave Cobbley# IMPORTANT: This piece needs to be removed once the root cause is fixed!
164213cb269SPatrick Williamsdo_install:append() {
165eb8dc403SDave Cobbley	if [ -e "${D}/${bindir}/qemu-mips" ]; then
166eb8dc403SDave Cobbley		create_wrapper ${D}/${bindir}/qemu-mips \
167eb8dc403SDave Cobbley			QEMU_RESERVED_VA=0x0
168eb8dc403SDave Cobbley	fi
169eb8dc403SDave Cobbley}
170eb8dc403SDave Cobbley# END of qemu-mips workaround
171eb8dc403SDave Cobbley
17219323693SBrad Bishop# Disable kvm/virgl/mesa on targets that do not support it
1739aee5003SAndrew GeisslerPACKAGECONFIG:remove:darwin = "kvm virglrenderer epoxy gtk+"
1749aee5003SAndrew GeisslerPACKAGECONFIG:remove:mingw32 = "kvm virglrenderer epoxy gtk+"
175eb8dc403SDave Cobbley
176c342db35SBrad BishopPACKAGECONFIG[sdl] = "--enable-sdl,--disable-sdl,libsdl2"
177517393d9SAndrew GeisslerPACKAGECONFIG[png] = "--enable-png,--disable-png,libpng"
178b7d28619SAndrew GeisslerPACKAGECONFIG[virtfs] = "--enable-virtfs --enable-attr --enable-cap-ng,--disable-virtfs,libcap-ng attr,"
179eb8dc403SDave CobbleyPACKAGECONFIG[aio] = "--enable-linux-aio,--disable-linux-aio,libaio,"
180db4c27eeSPatrick WilliamsPACKAGECONFIG[uring] = "--enable-linux-io-uring,--disable-linux-io-uring,liburing"
18182c905dcSAndrew GeisslerPACKAGECONFIG[xen] = "--enable-xen,--disable-xen,xen-tools,xen-tools-libxenstore xen-tools-libxenctrl xen-tools-libxenguest"
182eb8dc403SDave CobbleyPACKAGECONFIG[vnc-sasl] = "--enable-vnc --enable-vnc-sasl,--disable-vnc-sasl,cyrus-sasl,"
183eb8dc403SDave CobbleyPACKAGECONFIG[vnc-jpeg] = "--enable-vnc --enable-vnc-jpeg,--disable-vnc-jpeg,jpeg,"
18479641f25SBrad BishopPACKAGECONFIG[libcurl] = "--enable-curl,--disable-curl,curl,"
185eb8dc403SDave CobbleyPACKAGECONFIG[nss] = "--enable-smartcard,--disable-smartcard,nss,"
186eb8dc403SDave CobbleyPACKAGECONFIG[curses] = "--enable-curses,--disable-curses,ncurses,"
187c342db35SBrad BishopPACKAGECONFIG[gtk+] = "--enable-gtk,--disable-gtk,gtk+3 gettext-native"
188c342db35SBrad BishopPACKAGECONFIG[vte] = "--enable-vte,--disable-vte,vte gettext-native"
189eb8dc403SDave CobbleyPACKAGECONFIG[libcap-ng] = "--enable-cap-ng,--disable-cap-ng,libcap-ng,"
190c68388fcSBrad BishopPACKAGECONFIG[ssh] = "--enable-libssh,--disable-libssh,libssh,"
191eb8dc403SDave CobbleyPACKAGECONFIG[gcrypt] = "--enable-gcrypt,--disable-gcrypt,libgcrypt,"
192eb8dc403SDave CobbleyPACKAGECONFIG[nettle] = "--enable-nettle,--disable-nettle,nettle"
193eb8dc403SDave CobbleyPACKAGECONFIG[libusb] = "--enable-libusb,--disable-libusb,libusb1"
194eb8dc403SDave CobbleyPACKAGECONFIG[fdt] = "--enable-fdt,--disable-fdt,dtc"
195595f6308SAndrew GeisslerPACKAGECONFIG[alsa] = "--audio-drv-list=default,,alsa-lib"
1969aee5003SAndrew GeisslerPACKAGECONFIG[epoxy] = "--enable-opengl,--disable-opengl,libepoxy"
197eb8dc403SDave CobbleyPACKAGECONFIG[lzo] = "--enable-lzo,--disable-lzo,lzo"
198eb8dc403SDave CobbleyPACKAGECONFIG[numa] = "--enable-numa,--disable-numa,numactl"
199eb8dc403SDave CobbleyPACKAGECONFIG[gnutls] = "--enable-gnutls,--disable-gnutls,gnutls"
200eb8dc403SDave CobbleyPACKAGECONFIG[bzip2] = "--enable-bzip2,--disable-bzip2,bzip2"
201eb8dc403SDave CobbleyPACKAGECONFIG[libiscsi] = "--enable-libiscsi,--disable-libiscsi"
202eb8dc403SDave CobbleyPACKAGECONFIG[kvm] = "--enable-kvm,--disable-kvm"
2031a4b7ee2SBrad BishopPACKAGECONFIG[virglrenderer] = "--enable-virglrenderer,--disable-virglrenderer,virglrenderer"
2041a4b7ee2SBrad Bishop# spice will be in meta-networking layer
2051a4b7ee2SBrad BishopPACKAGECONFIG[spice] = "--enable-spice,--disable-spice,spice"
2061a4b7ee2SBrad Bishop# usbredir will be in meta-networking layer
207*5082cc7fSAndrew GeisslerPACKAGECONFIG[dbus-display] = "--enable-dbus-display,--disable-dbus-display,glib-2.0-native,dbus"
2081a4b7ee2SBrad BishopPACKAGECONFIG[usb-redir] = "--enable-usb-redir,--disable-usb-redir,usbredir"
209c342db35SBrad BishopPACKAGECONFIG[snappy] = "--enable-snappy,--disable-snappy,snappy"
210d25ed324SAndrew GeisslerPACKAGECONFIG[glusterfs] = "--enable-glusterfs,--disable-glusterfs,glusterfs"
21182c905dcSAndrew GeisslerPACKAGECONFIG[xkbcommon] = "--enable-xkbcommon,--disable-xkbcommon,libxkbcommon"
212*5082cc7fSAndrew GeisslerPACKAGECONFIG[libudev] = "--enable-libudev,--disable-libudev,udev"
213d25ed324SAndrew GeisslerPACKAGECONFIG[attr] = "--enable-attr,--disable-attr,attr,"
214d25ed324SAndrew GeisslerPACKAGECONFIG[rbd] = "--enable-rbd,--disable-rbd,ceph,ceph"
215d25ed324SAndrew GeisslerPACKAGECONFIG[vhost] = "--enable-vhost-net,--disable-vhost-net,,"
2168e7b46e2SPatrick WilliamsPACKAGECONFIG[ust] = "--enable-trace-backends=ust,,lttng-ust,"
217d25ed324SAndrew GeisslerPACKAGECONFIG[pie] = "--enable-pie,--disable-pie,,"
218d1e89497SAndrew GeisslerPACKAGECONFIG[seccomp] = "--enable-seccomp,--disable-seccomp,libseccomp"
219eff27476SAndrew Geissler# libnfs is currently provided by meta-kodi
220eff27476SAndrew GeisslerPACKAGECONFIG[libnfs] = "--enable-libnfs,--disable-libnfs,libnfs"
221eff27476SAndrew GeisslerPACKAGECONFIG[pmem] = "--enable-libpmem,--disable-libpmem,pmdk"
2228f840685SAndrew GeisslerPACKAGECONFIG[pulseaudio] = "--enable-pa,--disable-pa,pulseaudio"
223595f6308SAndrew GeisslerPACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux"
224d583833aSAndrew GeisslerPACKAGECONFIG[bpf] = "--enable-bpf,--disable-bpf,libbpf"
225615f2f11SAndrew GeisslerPACKAGECONFIG[capstone] = "--enable-capstone,--disable-capstone"
226615f2f11SAndrew GeisslerPACKAGECONFIG[rdma] = "--enable-rdma,--disable-rdma"
227615f2f11SAndrew GeisslerPACKAGECONFIG[vde] = "--enable-vde,--disable-vde"
228*5082cc7fSAndrew GeisslerPACKAGECONFIG[fuse] = "--enable-fuse --enable-fuse-lseek,--disable-fuse --disable-fuse-lseek,fuse3"
229517393d9SAndrew GeisslerPACKAGECONFIG[slirp] = "--enable-slirp,--disable-slirp,libslirp"
230615f2f11SAndrew GeisslerPACKAGECONFIG[brlapi] = "--enable-brlapi,--disable-brlapi"
2312390b1b6SPatrick WilliamsPACKAGECONFIG[jack] = "--enable-jack,--disable-jack,jack,"
232e760df85SPatrick WilliamsPACKAGECONFIG[debuginfo] = "--enable-libdw,--disable-libdw,elfutils"
233eb8dc403SDave Cobbley
234*5082cc7fSAndrew GeisslerINSANE_SKIP:${PN}-common = "arch"
235c342db35SBrad Bishop
236213cb269SPatrick WilliamsFILES:${PN} += "${datadir}/icons"
237fc113eadSAndrew Geissler
238520786ccSPatrick Williams# For user who want to install all arch packages
239*5082cc7fSAndrew GeisslerPACKAGES =+ "${PN}-common"
240*5082cc7fSAndrew GeisslerRDEPENDS:${PN} += "${PN}-common"
241520786ccSPatrick Williams
242*5082cc7fSAndrew GeisslerALLOW_EMPTY:${PN} = "1"
243*5082cc7fSAndrew GeisslerFILES:${PN} = ""
244*5082cc7fSAndrew Geissler
245*5082cc7fSAndrew GeisslerFILES:${PN}-common = "${bindir}/* ${includedir}/* ${libexecdir}/* ${datadir}/* ${localstatedir}"
246520786ccSPatrick Williams
2478f840685SAndrew GeisslerPACKAGES_DYNAMIC += "^${PN}-user-.*  ^${PN}-system-.*"
2488f840685SAndrew Geissler
249520786ccSPatrick WilliamsPACKAGESPLITFUNCS =+ "split_qemu_packages"
250520786ccSPatrick Williams
251520786ccSPatrick Williamspython split_qemu_packages () {
252520786ccSPatrick Williams    archdir = d.expand('${bindir}/')
253*5082cc7fSAndrew Geissler    subpackages = do_split_packages(d, archdir, r'^qemu-system-(.*)$', '${PN}-system-%s', 'QEMU full system emulation binaries(%s)' , prepend=True, extra_depends='${PN}-common')
254520786ccSPatrick Williams
255*5082cc7fSAndrew Geissler    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')
256*5082cc7fSAndrew Geissler    if subpackages:
257*5082cc7fSAndrew Geissler        d.appendVar('RDEPENDS:' + d.getVar('PN'), ' ' + ' '.join(subpackages))
258520786ccSPatrick Williams    mipspackage = d.getVar('PN') + "-user-mips"
259*5082cc7fSAndrew Geissler    if mipspackage in ' '.join(subpackages):
260520786ccSPatrick Williams        d.appendVar('RDEPENDS:' + mipspackage, ' ' + d.getVar("MLPREFIX") + 'bash')
261520786ccSPatrick Williams}
262520786ccSPatrick Williams
263fc113eadSAndrew Geissler# Put the guest agent in a separate package
264fc113eadSAndrew GeisslerPACKAGES =+ "${PN}-guest-agent"
265fc113eadSAndrew GeisslerSUMMARY:${PN}-guest-agent = "QEMU guest agent"
266fc113eadSAndrew GeisslerFILES:${PN}-guest-agent += " \
267fc113eadSAndrew Geissler    ${bindir}/qemu-ga \
268fc113eadSAndrew Geissler    ${sysconfdir}/udev/rules.d/60-qemu-guest-agent.rules \
269fc113eadSAndrew Geissler    ${sysconfdir}/init.d/qemu-guest-agent \
270fc113eadSAndrew Geissler    ${systemd_unitdir}/system/qemu-guest-agent.service \
271fc113eadSAndrew Geissler"
272fc113eadSAndrew Geissler
273fc113eadSAndrew GeisslerINITSCRIPT_PACKAGES = "${PN}-guest-agent"
274fc113eadSAndrew GeisslerINITSCRIPT_NAME:${PN}-guest-agent = "qemu-guest-agent"
275fc113eadSAndrew GeisslerINITSCRIPT_PARAMS:${PN}-guest-agent = "defaults"
276fc113eadSAndrew Geissler
277fc113eadSAndrew GeisslerSYSTEMD_PACKAGES = "${PN}-guest-agent"
278fc113eadSAndrew GeisslerSYSTEMD_SERVICE:${PN}-guest-agent = "qemu-guest-agent.service"
279