summaryrefslogtreecommitdiff
path: root/emulators/qemu/files/Makefile.multinode-NetBSD
blob: 60a45a0bdaf6b94f61370f4b6c47f12c5c425f68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# $Id: Makefile.multinode-NetBSD,v 1.2 2006/01/01 13:48:45 xtraeme 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>
#

#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