pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

qemu-guest-agent: add an rc.d script (untested)



Module Name:	pkgsrc-wip
Committed By:	Benny Siegert <bsiegert%gmail.com@localhost>
Pushed By:	bsiegert
Date:		Tue Apr 9 22:43:46 2024 +0200
Changeset:	f20cf94c0b7a94794a401da5688672a6feb91e88

Modified Files:
	qemu-guest-agent/Makefile
Added Files:
	qemu-guest-agent/files/qemu-guest-agent.sh
Removed Files:
	qemu-guest-agent/files/Makefile.multinode-NetBSD
	qemu-guest-agent/files/README.NetBSD
	qemu-guest-agent/files/hw-mips-mipssim_virtio.c
	qemu-guest-agent/files/linux-user-test.h

Log Message:
qemu-guest-agent: add an rc.d script (untested)

Also delete some more cruft from FILESDIR.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=f20cf94c0b7a94794a401da5688672a6feb91e88

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 qemu-guest-agent/Makefile                        |   1 +
 qemu-guest-agent/files/Makefile.multinode-NetBSD |  59 ------------
 qemu-guest-agent/files/README.NetBSD             |  19 ----
 qemu-guest-agent/files/hw-mips-mipssim_virtio.c  | 113 -----------------------
 qemu-guest-agent/files/linux-user-test.h         |   7 --
 qemu-guest-agent/files/qemu-guest-agent.sh       |  20 ++++
 6 files changed, 21 insertions(+), 198 deletions(-)

diffs:
diff --git a/qemu-guest-agent/Makefile b/qemu-guest-agent/Makefile
index c78cca919a..0cc086d376 100644
--- a/qemu-guest-agent/Makefile
+++ b/qemu-guest-agent/Makefile
@@ -21,6 +21,7 @@ UNLIMIT_RESOURCES=	datasize
 HAS_CONFIGURE=		yes
 
 PATCHDIR=		${.CURDIR}/../../emulators/qemu/patches
+RCD_SCRIPTS=		qemu-guest-agent
 
 # https://github.com/qemu/qemu/commit/56208a0d473c6db263cc333c787ca48b502d72ab
 GCC_REQD+=		7
diff --git a/qemu-guest-agent/files/Makefile.multinode-NetBSD b/qemu-guest-agent/files/Makefile.multinode-NetBSD
deleted file mode 100644
index f4313832eb..0000000000
--- a/qemu-guest-agent/files/Makefile.multinode-NetBSD
+++ /dev/null
@@ -1,59 +0,0 @@
-# $Id: Makefile.multinode-NetBSD,v 1.4 2012/06/07 21:23:46 ryoon Exp $
-# Source: http://mail-index.NetBSD.org/netbsd-help/2005/03/25/0005.html
-#
-# Starts up two qemu instances and networks bridges them to the local
-# ethernet (ETHER_IF}.  Works best with NetBSD configured to use serial
-# consoles in DISK[12]
-#
-# Usage:
-#	sudo make netbsd1
-#	sudo make netbsd2
-#
-#  - Hubert Feyrer <hubert%feyrer.de@localhost>
-#
-
-#NETBSD_NOGFX=
-NETBSD_NOGFX=		-nographic
-
-ETHER_IF=	tlp0
-QEMU_RAM=	20
-DISK1=		harddisk.netbsd1
-DISK2=		harddisk.netbsd2
-
-
-all: netbsd1 netbsd2
-
-netbsd1: bridge 
-	ifconfig tap1 create up	     || echo tap1: already there
-	brconfig bridge0 add tap1 up || echo tap1: already on bridge0
-	brconfig bridge0 -learn tap1 # real hub mode, step 1b
-	brconfig bridge0 flush	# real hub more, step 2
-	qemu \	
-		-m ${QEMU_RAM} \
-		${NETBSD_NOGFX} \
-		-boot c \
-		-net tap,fd=3,ifname=tap1 3<>/dev/tap1 \
-		-net nic,macaddr=de:ad:be:ef:00:01 \
-		${DISK1}
-	brconfig bridge0 delete tap1 
-	ifconfig tap1 destroy
-
-netbsd2: bridge
-	ifconfig tap2 create up	     || echo tap2: already there
-	brconfig bridge0 add tap2 up || echo tap2: already on bridge0
-	brconfig bridge0 -learn tap2 # real hub mode, step 1c
-	brconfig bridge0 flush	     # real hub mode, step 2
-	qemu \
-		-m ${QEMU_RAM} \
-		${NETBSD_NOGFX} \
-		-boot c \
-		-net tap,fd=3,ifname=tap2 3<>/dev/tap2 \
-		-net nic,macaddr=de:ad:be:ef:00:02 \
-		${DISK2}
-	brconfig bridge0 delete tap2
-	ifconfig tap2 destroy
-	
-bridge:
-	ifconfig bridge0 create	  || echo bridge0: already there
-	brconfig bridge0 add ${ETHER_IF} || echo bridge0: ${ETHER_IF} already there
-	brconfig bridge0 -learn ${ETHER_IF} # real hub mode, step 1a
diff --git a/qemu-guest-agent/files/README.NetBSD b/qemu-guest-agent/files/README.NetBSD
deleted file mode 100644
index ba0fee0d44..0000000000
--- a/qemu-guest-agent/files/README.NetBSD
+++ /dev/null
@@ -1,19 +0,0 @@
-$NetBSD: README.NetBSD,v 1.1 2023/12/07 17:41:55 gdt Exp $
-
-To use the NetBSD/amd64 Virtual Memory Monitor (NVMM) for QEMU :
-
-Load the NVMM kernel driver if not already loaded
-# modload nvmm
-
-You may want to run the NVMM tests to confirm that your setup is correct:
-# cd /usr/tests/lib/libnvmm/
-# atf-run | atf-report
-
-Configure the permissions once either by adding the username(s) of its users
-to the nvmm group in /etc/groups.
-
-Append "-accel nvmm" to your usual Qemu command line
-$ qemu-system-x86_64 -smp 4 -m 8G -cdrom Win10_2004_English_x64.iso -accel nvmm
-
-See nvmm(4) and nvmmctl(8) or visit
-   https://m00nbsd.net/4e0798b7f2620c965d0dd9d6a7a2f296.html for more info.
diff --git a/qemu-guest-agent/files/hw-mips-mipssim_virtio.c b/qemu-guest-agent/files/hw-mips-mipssim_virtio.c
deleted file mode 100644
index 047fea4130..0000000000
--- a/qemu-guest-agent/files/hw-mips-mipssim_virtio.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * QEMU/mipssim-virtio extension emulation
- *
- * Emulates a very simple machine model similar to the one used by the
- * proprietary MIPS emulator extended by a virtio device. The purpose is to
- * have a better virt platform in anticipation to a readl `virt' platform for
- * MIPS.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Reinoud Zandijk.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "qemu/osdep.h"
-#include "qapi/error.h"
-#include "cpu.h"
-#include "hw/mips/mips.h"
-#include "hw/char/serial.h"
-#include "hw/isa/isa.h"
-#include "net/net.h"
-#include "sysemu/sysemu.h"
-#include "hw/boards.h"
-#include "hw/mips/bios.h"
-#include "hw/loader.h"
-#include "hw/or-irq.h"
-#include "elf.h"
-#include "hw/sysbus.h"
-#include "hw/qdev-properties.h"
-#include "exec/address-spaces.h"
-#include "qemu/error-report.h"
-#include "sysemu/qtest.h"
-#include "sysemu/reset.h"
-#include "hw/virtio/virtio-mmio.h"
-
-#define NUM_VIRTIO_TRANSPORTS   32
-#define VIRTIO_STRIDE           512
-
-#define DEV_SPACING             0x10000		/* space devices every 64k */
-#define ISA_BASE                0x1fd00000
-#define	VIRTIO_MMIO_BASE        (ISA_BASE + DEV_SPACING)
-
-extern void mips_mipssim_init(MachineState *machine);
-
-static void
-mips_mipssim_virtio_init(MachineState *machine)
-{
-    DeviceState *virtio_orgate;
-    MIPSCPU *cpu;
-    CPUMIPSState *env;
-
-    /* initialise parent */
-    mips_mipssim_init(machine);
-
-    cpu = MIPS_CPU(qemu_get_cpu(0));
-    env = &cpu->env;
-
-    /*
-     * TODO: in newer versions, we might need to adjust the cpu clock when its
-     * set in mips_mipssim_init()
-     */
-
-    /*
-     * virtio extention; register 32 virtio devices just after the ISA space
-     * at 0x1fd10000 with stride of 512 bytes as per i386s microvm target.
-     * register these devices in reverse order (see comments in hw/arm/virt.c)
-     */
-    virtio_orgate = DEVICE(object_new(TYPE_OR_IRQ));
-    object_property_set_int(OBJECT(virtio_orgate),
-         "num-lines", NUM_VIRTIO_TRANSPORTS, &error_fatal);
-    qdev_realize_and_unref(virtio_orgate, NULL, &error_fatal);
-
-    for (int i = NUM_VIRTIO_TRANSPORTS - 1; i >= 0; i--) {
-        sysbus_create_simple("virtio-mmio",
-            VIRTIO_MMIO_BASE + i * VIRTIO_STRIDE,
-            qdev_get_gpio_in(virtio_orgate, i));
-    }
-    qdev_connect_gpio_out(DEVICE(virtio_orgate), 0, env->irq[3]);
-}
-
-static void mips_mipssim_virtio_machine_init(MachineClass *mc)
-{
-    mc->desc = "MIPS MIPSsim platform with virtio";
-    mc->init = mips_mipssim_virtio_init;
-#ifdef TARGET_MIPS64
-    mc->default_cpu_type = MIPS_CPU_TYPE_NAME("5Kf");
-#else
-    mc->default_cpu_type = MIPS_CPU_TYPE_NAME("24Kf");
-#endif
-    mc->default_ram_id = "mips_mipssim.ram";
-}
-
-DEFINE_MACHINE("mipssim-virtio", mips_mipssim_virtio_machine_init)
-
diff --git a/qemu-guest-agent/files/linux-user-test.h b/qemu-guest-agent/files/linux-user-test.h
deleted file mode 100644
index 3f9f919b63..0000000000
--- a/qemu-guest-agent/files/linux-user-test.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Qemu 8+ needs MAP_FIXED_NOREPLACE for linux user-mode emulation.
-   They offically do not support systems that are too old (glibc
-   version), but we're trying to build the rest, anyway. */
-#include <sys/mman.h>
-#ifndef MAP_FIXED_NOREPLACE
-#error "Your libc is too old."
-#endif
diff --git a/qemu-guest-agent/files/qemu-guest-agent.sh b/qemu-guest-agent/files/qemu-guest-agent.sh
new file mode 100755
index 0000000000..4d2ae74104
--- /dev/null
+++ b/qemu-guest-agent/files/qemu-guest-agent.sh
@@ -0,0 +1,20 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD$
+#
+# PROVIDE: qemu_guest_agent
+# REQUIRE: DAEMON
+#
+
+if [ -f /etc/rc.subr ]; then
+	. /etc/rc.subr
+fi
+
+name="qemu_guest_agent"
+rcvar="${name}"
+command="@PREFIX@/bin/qemu-ga"
+command_args="-d"
+
+
+load_rc_config $name
+run_rc_command "$1"


Home | Main Index | Thread Index | Old Index