From 23b0901a77b549bbac769325d3e578b794561cbc Mon Sep 17 00:00:00 2001 From: hubertf Date: Sat, 1 Oct 2005 04:12:32 +0000 Subject: Install example procedure that shows how to setup and network several qemu nodes with the host's local ethernet using tap(4). --- emulators/qemu/Makefile | 7 ++- emulators/qemu/PLIST | 3 +- emulators/qemu/files/Makefile.multinode-NetBSD | 59 ++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 emulators/qemu/files/Makefile.multinode-NetBSD (limited to 'emulators') diff --git a/emulators/qemu/Makefile b/emulators/qemu/Makefile index 28da880811b..34ead297cba 100644 --- a/emulators/qemu/Makefile +++ b/emulators/qemu/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.17 2005/09/04 23:06:33 xtraeme Exp $ +# $NetBSD: Makefile,v 1.18 2005/10/01 04:12:32 hubertf Exp $ # DISTNAME= qemu-0.7.2 +PKGREVISION= 1 CATEGORIES= emulators MASTER_SITES= http://fabrice.bellard.free.fr/qemu/ @@ -30,6 +31,10 @@ SUBST_MESSAGE.snd= "Fixing hardcoded audio device." # to build in the SSE code. BUILDLINK_TRANSFORM+= rm-optarg:-march rm-optarg:-mcpu +post-install: + ${INSTALL_DATA} ${FILESDIR}/Makefile.multinode-NetBSD \ + ${PREFIX}/share/doc/qemu + .include "../../devel/SDL/buildlink3.mk" .include "../../mk/ossaudio.buildlink3.mk" .include "../../mk/pthread.buildlink3.mk" diff --git a/emulators/qemu/PLIST b/emulators/qemu/PLIST index f54075ecc00..37d206cc464 100644 --- a/emulators/qemu/PLIST +++ b/emulators/qemu/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.4 2005/07/29 16:38:15 xtraeme Exp $ +@comment $NetBSD: PLIST,v 1.5 2005/10/01 04:12:32 hubertf Exp $ bin/qemu bin/qemu-img bin/qemu-system-mips @@ -9,6 +9,7 @@ man/man1/qemu-img.1 man/man1/qemu.1 share/doc/qemu/qemu-doc.html share/doc/qemu/qemu-tech.html +share/doc/qemu/Makefile.multinode-NetBSD share/qemu/bios.bin share/qemu/keymaps/ar share/qemu/keymaps/common diff --git a/emulators/qemu/files/Makefile.multinode-NetBSD b/emulators/qemu/files/Makefile.multinode-NetBSD new file mode 100644 index 00000000000..54dafd9d315 --- /dev/null +++ b/emulators/qemu/files/Makefile.multinode-NetBSD @@ -0,0 +1,59 @@ +# $Id: Makefile.multinode-NetBSD,v 1.1 2005/10/01 04:12:32 hubertf 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 +# + +#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 \ + -tun-fd 3 3<>/dev/tap1 \ + -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 \ + -tun-fd 3 3<>/dev/tap2 \ + -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 -- cgit v1.2.3