summaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
Diffstat (limited to 'emulators')
-rw-r--r--emulators/qemu-riscv/CVS/Entries5
-rw-r--r--emulators/qemu-riscv/CVS/Repository1
-rw-r--r--emulators/qemu-riscv/CVS/Root1
-rw-r--r--emulators/qemu-riscv/CVS/Tag1
-rw-r--r--emulators/qemu-riscv/Makefile130
-rw-r--r--emulators/qemu-riscv/distinfo2
-rw-r--r--emulators/qemu-riscv/files/CVS/Entries4
-rw-r--r--emulators/qemu-riscv/files/CVS/Repository1
-rw-r--r--emulators/qemu-riscv/files/CVS/Root1
-rw-r--r--emulators/qemu-riscv/files/CVS/Tag1
-rw-r--r--emulators/qemu-riscv/files/qemu-ga.conf3
-rw-r--r--emulators/qemu-riscv/files/qemu-ifdown14
-rw-r--r--emulators/qemu-riscv/files/qemu-ifup40
-rw-r--r--emulators/qemu-riscv/pkg/CVS/Entries9
-rw-r--r--emulators/qemu-riscv/pkg/CVS/Repository1
-rw-r--r--emulators/qemu-riscv/pkg/CVS/Root1
-rw-r--r--emulators/qemu-riscv/pkg/CVS/Tag1
-rw-r--r--emulators/qemu-riscv/pkg/DESCR6
-rw-r--r--emulators/qemu-riscv/pkg/PLIST97
-rw-r--r--emulators/qemu-riscv/pkg/README266
20 files changed, 0 insertions, 585 deletions
diff --git a/emulators/qemu-riscv/CVS/Entries b/emulators/qemu-riscv/CVS/Entries
deleted file mode 100644
index e40f1c4..0000000
--- a/emulators/qemu-riscv/CVS/Entries
+++ /dev/null
@@ -1,5 +0,0 @@
1D/files////
2D/patches////
3D/pkg////
4/Makefile/1.230/Tue Feb 21 23:06:55 2023//TOPENBSD_7_3
5/distinfo/1.68/Wed Jan 4 21:33:42 2023//TOPENBSD_7_3
diff --git a/emulators/qemu-riscv/CVS/Repository b/emulators/qemu-riscv/CVS/Repository
deleted file mode 100644
index 452518b..0000000
--- a/emulators/qemu-riscv/CVS/Repository
+++ /dev/null
@@ -1 +0,0 @@
1ports/emulators/qemu
diff --git a/emulators/qemu-riscv/CVS/Root b/emulators/qemu-riscv/CVS/Root
deleted file mode 100644
index 3811072..0000000
--- a/emulators/qemu-riscv/CVS/Root
+++ /dev/null
@@ -1 +0,0 @@
1/cvs
diff --git a/emulators/qemu-riscv/CVS/Tag b/emulators/qemu-riscv/CVS/Tag
deleted file mode 100644
index b1c2a73..0000000
--- a/emulators/qemu-riscv/CVS/Tag
+++ /dev/null
@@ -1 +0,0 @@
1TOPENBSD_7_3
diff --git a/emulators/qemu-riscv/Makefile b/emulators/qemu-riscv/Makefile
deleted file mode 100644
index b47052b..0000000
--- a/emulators/qemu-riscv/Makefile
+++ /dev/null
@@ -1,130 +0,0 @@
1DPB_PROPERTIES= parallel
2
3COMMENT= multi system emulator
4
5VERSION= 2.12.1
6PKGNAME= qemu-riscv-${VERSION}
7DISTNAME= qemu-${VERSION}
8REVISION= 0
9CATEGORIES= emulators
10MASTER_SITES= https://download.qemu.org/
11EXTRACT_SUFX= .tar.xz
12
13HOMEPAGE= https://www.qemu.org/
14
15MAINTAINER= Brad Smith <brad@comstyle.com>
16
17# GPLv2, LGPLv2 and BSD
18PERMIT_PACKAGE= Yes
19
20WANTLIB= c pthread fdt m util
21
22DEBUG_PACKAGES= ${BUILD_PACKAGES}
23
24# Using TLS emulation layer
25COMPILER= base-clang ports-gcc
26
27LIB_DEPENDS= devel/dtc
28
29MAKE_ENV= V=1
30FAKE_FLAGS= qemu_confdir=${PREFIX}/share/examples/qemu
31
32CFLAGS+= -I${LOCALBASE}/include -I${X11BASE}/include
33LDFLAGS+= -L${LOCALBASE}/lib -L${X11BASE}/lib
34
35# until the system headers are fixed properly.
36CFLAGS+= -Wno-redundant-decls
37
38MODULES= lang/python
39MODPY_RUN_DEPENDS= No
40
41SEPARATE_BUILD= Yes
42USE_GMAKE= Yes
43CONFIGURE_STYLE=simple
44CONFIGURE_ENV+= LDFLAGS="${LDFLAGS}"
45CONFIGURE_ARGS= --localstatedir=${LOCALSTATEDIR} \
46 --prefix=${PREFIX} \
47 --sysconfdir=${SYSCONFDIR} \
48 --mandir=${PREFIX}/man \
49 --cc="${CC}" \
50 --cxx=/dev/null \
51 --host-cc="${CC}" \
52 --target-list=riscv32-softmmu,riscv64-softmmu \
53 --audio-drv-list= \
54 --disable-user \
55 --disable-linux-user \
56 --disable-bsd-user \
57 --disable-docs \
58 --disable-guest-agent \
59 --disable-modules \
60 --disable-gnutls \
61 --disable-nettle \
62 --disable-gcrypt \
63 --disable-sdl \
64 --disable-gtk \
65 --disable-vte \
66 --disable-vnc \
67 --disable-virtfs \
68 --disable-mpath \
69 --disable-xen \
70 --disable-brlapi \
71 --disable-curl \
72 --disable-bluez \
73 --disable-rdma \
74 --disable-vde \
75 --disable-netmap \
76 --disable-cap-ng \
77 --disable-attr \
78 --disable-vhost-net \
79 --disable-vhost-crypto \
80 --disable-spice \
81 --disable-rbd \
82 --disable-libiscsi \
83 --disable-libnfs \
84 --disable-smartcard \
85 --disable-libusb \
86 --disable-live-block-migration \
87 --disable-usb-redir \
88 --disable-lzo \
89 --disable-snappy \
90 --disable-bzip2 \
91 --disable-glusterfs \
92 --disable-tpm \
93 --disable-libssh2 \
94 --disable-numa \
95 --disable-libxml2 \
96 --disable-replication \
97 --disable-vhost-vsock \
98 --disable-opengl \
99 --disable-virglrenderer \
100 --disable-xfsctl \
101 --disable-qom-cast-debug \
102 --disable-vxhs \
103 --disable-crypto-afalg \
104 --disable-vhost-user \
105 --disable-capstone
106
107FLAVORS= debug
108FLAVOR?=
109
110.if ${FLAVOR:Mdebug}
111CFLAGS+= -O0
112CONFIGURE_ARGS+=--enable-debug
113INSTALL_STRIP=
114.else
115CONFIGURE_ARGS+=--disable-debug-info
116.endif
117
118TEST_TARGET= check
119
120# XXX Optimizer bug, using -O2 causes segfaults, -O1 linking errors
121.if ${MACHINE_ARCH:Mpowerpc}
122CFLAGS+= -O0
123.endif
124
125.include <bsd.port.arch.mk>
126
127post-install:
128 ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/qemu
129
130.include <bsd.port.mk>
diff --git a/emulators/qemu-riscv/distinfo b/emulators/qemu-riscv/distinfo
deleted file mode 100644
index 828a566..0000000
--- a/emulators/qemu-riscv/distinfo
+++ /dev/null
@@ -1,2 +0,0 @@
1SHA256 (qemu-2.12.1.tar.xz) = M1g4AOAAbNALeCJrhb5aJ8jjsVa+0uYOg+y+t7m4Nk8=
2SIZE (qemu-2.12.1.tar.xz) = 35416404
diff --git a/emulators/qemu-riscv/files/CVS/Entries b/emulators/qemu-riscv/files/CVS/Entries
deleted file mode 100644
index 8a3bf7a..0000000
--- a/emulators/qemu-riscv/files/CVS/Entries
+++ /dev/null
@@ -1,4 +0,0 @@
1/qemu-ga.conf/1.1/Tue Mar 29 10:04:28 2022//TOPENBSD_7_3
2/qemu-ifdown/1.5/Wed Oct 28 09:17:31 2015//TOPENBSD_7_3
3/qemu-ifup/1.10/Wed Oct 28 09:17:31 2015//TOPENBSD_7_3
4D
diff --git a/emulators/qemu-riscv/files/CVS/Repository b/emulators/qemu-riscv/files/CVS/Repository
deleted file mode 100644
index a9a1732..0000000
--- a/emulators/qemu-riscv/files/CVS/Repository
+++ /dev/null
@@ -1 +0,0 @@
1ports/emulators/qemu/files
diff --git a/emulators/qemu-riscv/files/CVS/Root b/emulators/qemu-riscv/files/CVS/Root
deleted file mode 100644
index 3811072..0000000
--- a/emulators/qemu-riscv/files/CVS/Root
+++ /dev/null
@@ -1 +0,0 @@
1/cvs
diff --git a/emulators/qemu-riscv/files/CVS/Tag b/emulators/qemu-riscv/files/CVS/Tag
deleted file mode 100644
index b1c2a73..0000000
--- a/emulators/qemu-riscv/files/CVS/Tag
+++ /dev/null
@@ -1 +0,0 @@
1TOPENBSD_7_3
diff --git a/emulators/qemu-riscv/files/qemu-ga.conf b/emulators/qemu-riscv/files/qemu-ga.conf
deleted file mode 100644
index 184885a..0000000
--- a/emulators/qemu-riscv/files/qemu-ga.conf
+++ /dev/null
@@ -1,3 +0,0 @@
1[general]
2method=isa-serial
3path=/dev/cua01
diff --git a/emulators/qemu-riscv/files/qemu-ifdown b/emulators/qemu-riscv/files/qemu-ifdown
deleted file mode 100644
index fbd5789..0000000
--- a/emulators/qemu-riscv/files/qemu-ifdown
+++ /dev/null
@@ -1,14 +0,0 @@
1#! /bin/sh
2
3_ETHER=trunk0
4_BRIDGE=bridge0
5
6# Let the environment over-ride this
7[ "$BRIDGE" ] || BRIDGE=${_BRIDGE}
8[ "$ETHER" ] || ETHER=${_ETHER}
9
10if test `id -u` -ne 0; then
11 DOAS=doas
12fi
13
14$DOAS ifconfig $BRIDGE del $1 > /dev/null 2>&1
diff --git a/emulators/qemu-riscv/files/qemu-ifup b/emulators/qemu-riscv/files/qemu-ifup
deleted file mode 100644
index 1207696..0000000
--- a/emulators/qemu-riscv/files/qemu-ifup
+++ /dev/null
@@ -1,40 +0,0 @@
1#! /bin/sh
2
3_ETHER=`route -n get default 2>/dev/null |awk '/interface:/ {print $2}'`
4_ETHER=${_ETHER:=trunk0}
5_BRIDGE=bridge0
6
7# Let the environment over-ride this
8[ "$BRIDGE" ] || BRIDGE=${_BRIDGE}
9[ "$ETHER" ] || ETHER=${_ETHER}
10
11if test `id -u` -ne 0; then
12 DOAS=doas
13fi
14
15echo -n " {$1 ($BRIDGE <-> $ETHER)"
16
17# Set up our bridge
18$DOAS ifconfig $1 group tap > /dev/null 2>&1
19$DOAS ifconfig $BRIDGE create > /dev/null 2>&1 && {
20 # Only add rules if the bridge creation succeeds; otherwise
21 # duplicate rules get loaded each time qemu starts
22 # The following two block carp packets from wasting cpu cycles inside the
23 # qemu sessions, remove if testing carp inside qemu
24 $DOAS ifconfig $BRIDGE rule block in on $ETHER dst 33:33:0:0:0:12
25 $DOAS ifconfig $BRIDGE rule block in on $ETHER dst 01:00:5e:00:00:12
26}
27# Since we can specify ETHER and BRIDGE above, its possible that
28# this tap interface or this physical interface was setup as part of
29# a different bridge earlier, and that is never cleaned up, so we have
30# to cleanup here first before we set it up; a physical interface cannot
31# be member to more than one bridge, thankfully, or I never would have
32# caught this
33ifconfig bridge | sed -n '/^bridge[0-9]*/{s/:.*$//;p;}' | while read brif
34do
35 $DOAS ifconfig $brif del $ETHER > /dev/null 2>&1
36 $DOAS ifconfig $brif del $1 > /dev/null 2>&1
37done
38$DOAS ifconfig $BRIDGE add $ETHER up
39$DOAS ifconfig $BRIDGE add $1 up || true
40echo "}"
diff --git a/emulators/qemu-riscv/pkg/CVS/Entries b/emulators/qemu-riscv/pkg/CVS/Entries
deleted file mode 100644
index d41c45d..0000000
--- a/emulators/qemu-riscv/pkg/CVS/Entries
+++ /dev/null
@@ -1,9 +0,0 @@
1/DESCR-ga/1.1/Sun Feb 28 18:38:41 2021//TOPENBSD_7_3
2/DESCR-main/1.1/Sun Feb 28 18:38:41 2021//TOPENBSD_7_3
3/PFRAG.plugins-main/1.2/Fri Mar 11 18:59:40 2022//TOPENBSD_7_3
4/PLIST-ga/1.5/Sat Apr 23 10:30:24 2022//TOPENBSD_7_3
5/PLIST-main/1.13/Tue Feb 21 23:06:55 2023//TOPENBSD_7_3
6/README-ga/1.1/Tue Mar 29 10:04:28 2022//TOPENBSD_7_3
7/README-main/1.3/Fri Mar 11 18:59:40 2022//TOPENBSD_7_3
8/qemu_ga.rc/1.1/Tue Mar 29 10:04:28 2022//TOPENBSD_7_3
9D
diff --git a/emulators/qemu-riscv/pkg/CVS/Repository b/emulators/qemu-riscv/pkg/CVS/Repository
deleted file mode 100644
index 64f210f..0000000
--- a/emulators/qemu-riscv/pkg/CVS/Repository
+++ /dev/null
@@ -1 +0,0 @@
1ports/emulators/qemu/pkg
diff --git a/emulators/qemu-riscv/pkg/CVS/Root b/emulators/qemu-riscv/pkg/CVS/Root
deleted file mode 100644
index 3811072..0000000
--- a/emulators/qemu-riscv/pkg/CVS/Root
+++ /dev/null
@@ -1 +0,0 @@
1/cvs
diff --git a/emulators/qemu-riscv/pkg/CVS/Tag b/emulators/qemu-riscv/pkg/CVS/Tag
deleted file mode 100644
index b1c2a73..0000000
--- a/emulators/qemu-riscv/pkg/CVS/Tag
+++ /dev/null
@@ -1 +0,0 @@
1TOPENBSD_7_3
diff --git a/emulators/qemu-riscv/pkg/DESCR b/emulators/qemu-riscv/pkg/DESCR
deleted file mode 100644
index b0e0aad..0000000
--- a/emulators/qemu-riscv/pkg/DESCR
+++ /dev/null
@@ -1,6 +0,0 @@
1QEMU is an open source machine emulator. It can run OSes and programs
2made for one machine (e.g. an ARM board) on a different machine (e.g.
3your own PC). By using dynamic translation, it achieves very good
4performance.
5
6This is a minimal build for only the RISC-V 32bit and 64bit targets.
diff --git a/emulators/qemu-riscv/pkg/PLIST b/emulators/qemu-riscv/pkg/PLIST
deleted file mode 100644
index 6b66e86..0000000
--- a/emulators/qemu-riscv/pkg/PLIST
+++ /dev/null
@@ -1,97 +0,0 @@
1@bin bin/qemu-img
2@bin bin/qemu-io
3@bin bin/qemu-keymap
4@bin bin/qemu-nbd
5@bin bin/qemu-system-riscv32
6@bin bin/qemu-system-riscv64
7share/doc/pkg-readmes/${PKGSTEM}
8share/examples/qemu/
9share/qemu/
10share/qemu/QEMU,cgthree.bin
11share/qemu/QEMU,tcx.bin
12share/qemu/bamboo.dtb
13share/qemu/bios-256k.bin
14share/qemu/bios.bin
15share/qemu/canyonlands.dtb
16share/qemu/efi-e1000.rom
17share/qemu/efi-e1000e.rom
18share/qemu/efi-eepro100.rom
19share/qemu/efi-ne2k_pci.rom
20share/qemu/efi-pcnet.rom
21share/qemu/efi-rtl8139.rom
22share/qemu/efi-virtio.rom
23share/qemu/efi-vmxnet3.rom
24share/qemu/hppa-firmware.img
25share/qemu/keymaps/
26share/qemu/keymaps/ar
27share/qemu/keymaps/bepo
28share/qemu/keymaps/common
29share/qemu/keymaps/cz
30share/qemu/keymaps/da
31share/qemu/keymaps/de
32share/qemu/keymaps/de-ch
33share/qemu/keymaps/en-gb
34share/qemu/keymaps/en-us
35share/qemu/keymaps/es
36share/qemu/keymaps/et
37share/qemu/keymaps/fi
38share/qemu/keymaps/fo
39share/qemu/keymaps/fr
40share/qemu/keymaps/fr-be
41share/qemu/keymaps/fr-ca
42share/qemu/keymaps/fr-ch
43share/qemu/keymaps/hr
44share/qemu/keymaps/hu
45share/qemu/keymaps/is
46share/qemu/keymaps/it
47share/qemu/keymaps/ja
48share/qemu/keymaps/lt
49share/qemu/keymaps/lv
50share/qemu/keymaps/mk
51share/qemu/keymaps/modifiers
52share/qemu/keymaps/nl
53share/qemu/keymaps/nl-be
54share/qemu/keymaps/no
55share/qemu/keymaps/pl
56share/qemu/keymaps/pt
57share/qemu/keymaps/pt-br
58share/qemu/keymaps/ru
59share/qemu/keymaps/sl
60share/qemu/keymaps/sv
61share/qemu/keymaps/th
62share/qemu/keymaps/tr
63share/qemu/kvmvapic.bin
64share/qemu/linuxboot.bin
65share/qemu/linuxboot_dma.bin
66share/qemu/multiboot.bin
67share/qemu/openbios-ppc
68share/qemu/openbios-sparc32
69share/qemu/openbios-sparc64
70share/qemu/palcode-clipper
71share/qemu/petalogix-ml605.dtb
72share/qemu/petalogix-s3adsp1800.dtb
73share/qemu/ppc_rom.bin
74share/qemu/pxe-e1000.rom
75share/qemu/pxe-eepro100.rom
76share/qemu/pxe-ne2k_pci.rom
77share/qemu/pxe-pcnet.rom
78share/qemu/pxe-rtl8139.rom
79share/qemu/pxe-virtio.rom
80share/qemu/qemu-icon.bmp
81share/qemu/qemu_logo_no_text.svg
82share/qemu/qemu_vga.ndrv
83share/qemu/s390-ccw.img
84share/qemu/s390-netboot.img
85share/qemu/sgabios.bin
86share/qemu/skiboot.lid
87share/qemu/slof.bin
88share/qemu/spapr-rtas.bin
89share/qemu/trace-events-all
90share/qemu/u-boot-sam460-20100605.bin
91share/qemu/u-boot.e500
92share/qemu/vgabios-cirrus.bin
93share/qemu/vgabios-qxl.bin
94share/qemu/vgabios-stdvga.bin
95share/qemu/vgabios-virtio.bin
96share/qemu/vgabios-vmware.bin
97share/qemu/vgabios.bin
diff --git a/emulators/qemu-riscv/pkg/README b/emulators/qemu-riscv/pkg/README
deleted file mode 100644
index 09221d2..0000000
--- a/emulators/qemu-riscv/pkg/README
+++ /dev/null
@@ -1,266 +0,0 @@
1+-----------------------------------------------------------------------
2| Running ${PKGSTEM} on OpenBSD
3+-----------------------------------------------------------------------
4
5==> Quick Start
6
71. Get a bootable CDROM image:
8
9 $ ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/i386/cd70.iso
10
11 or to use a 64-bit client OS or SPARC, respectively:
12
13 $ ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/amd64/cd70.iso
14
15 $ ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/sparc/cd70.iso
16
172. Create a virtual disk image:
18
19 $ qemu-img create -f qcow2 virtual.img 10G
20
213. Install the OS:
22
23 $ qemu-system-i386 -m 32 -monitor stdio -no-fd-bootchk \
24 -hda virtual.img -cdrom cd70.iso -boot d
25
26 or:
27
28 $ qemu-system-x86_64 -m 32 -monitor stdio -no-fd-bootchk \
29 -hda virtual.img -cdrom cd70.iso -boot d
30
31 $ qemu-system-sparc -m 32 -monitor stdio \
32 -hda virtual.img -cdrom cd70.iso -boot d
33
34 NOTE: start this inside an xterm or equivalent.
35 NOTE: be sure to choose serial console during install.
36 NOTE: -no-fd-bootchk permits booting faster when no floppy is
37 in use, but is not supported for qemu-system-sparc.
38 NOTE: qemu-system-ppc* and qemu-system-sparc* currently fail with
39 J or S malloc flags
40
414. Compress the virtual disk:
42
43 $ qemu-img convert -c -O qcow2 virtual.img v.tmp && \
44 mv v.tmp virtual.img
45
46 NOTE: do not do this while QEMU is running / using this virtual
47 disk.
48
495. Boot normally from the virtual disk:
50
51 $ qemu-system-i386 -m 32 -nographic -no-fd-bootchk -hda virtual.img
52
53 or:
54
55 $ qemu-system-x86_64 -m 32 -nographic -no-fd-bootchk -hda virtual.img
56
57 $ qemu-system-sparc -m 32 -nographic -hda virtual.img
58
59==> Networking
60
611. Default Settings
62
63 By default, QEMU sets up the equivalent of the following networking:
64
65 -net nic,vlan=0,model=e1000,macaddr=52:54:00:12:34:56
66 -net user,vlan=0
67
68 Also, inside this virtual usermode network, it uses the 10.0.2.0/24
69 and serves DHCP from inside this virtual network. Static address
70 can be used if one cannot or does not want to do DHCP in the
71 guest OS:
72
73 Guest OS IP : 10.0.2.15
74 Default Gateway : 10.0.2.2
75 Nameserver : 10.0.2.3
76
77 It is sufficient for most operations, QEMU itself performs NAT
78 and then makes userland network calls for TCP/UDP operations.
79 ICMP and other things are not possible in this mode.
80
81 NOTE: If you use one '-net' cmdline argument, QEMU assumes you
82 know what you want and clears defaults for the rest of the
83 -net defaults.
84
85 NOTE: The guest mode networking does not currently support IPv6,
86 and QEMU will complain that it cannot find a DNS server
87 if /etc/resolv.conf contains only IPv6 DNS servers.
88
892. tap mode
90
91 Sometimes it is desirable to configure QEMU to access a network
92 via layer2 directly. One way of doing this without having to run
93 QEMU as root is to let root open /dev/tapN and pass the file
94 descriptor to QEMU. The tap(4) interface should preferrably be
95 configured before starting QEMU:
96
97 $ doas ifconfig tap0 192.168.0.254
98
99 The interface can also be configured as part of a bridge(4), in
100 which case the ip address can be omitted:
101
102 $ doas ifconfig bridge0 add tap0 add em0 up
103
104 The tunnel and bridge interfaces can also be configured at system
105 startup by editing /etc/hostname.tapN and /etc/hostname.bridgeN,
106 respectively (see hostname.if(5)).
107
108 After configuring the virtual network we can use doas to let
109 root open the tunnel device and then use doas again to drop
110 privileges and start QEMU:
111
112 $ doas sh -c "doas -u $USER qemu-system-i386 -nographic -net nic \
113 -net tap,fd=3 -no-fd-bootchk -hda virtual.img 3<>/dev/tap0"
114
115 NOTE: if you use sudo instead of doas, remember that sudo calls
116 closefrom(2). In order to have more than one fd passed tap
117 interface, a line to sudoers akin to:
118
119 Defaults closefrom_override
120
121 then calling sudo via 'sudo -C 5 -u $USER qemu-system-i386 ..'
122 is required. See sudoers(5) and sudo(8) for details.
123
124 An alternative to the procedure described above is to have QEMU
125 set up the network via ${SYSCONFDIR}/qemu-ifup. This is not
126 recommended however, since you would have to run QEMU as root,
127 and there is no way to drop from root privileges at this point.
128
129 ${SYSCONFDIR}/qemu-ifup contains some default settings that
130 permit one to do the following:
131
132 # qemu-system-i386 -net nic -net tap -no-fd-bootchk -hda virtual.img
133
134 It presumes you wish the tap(4) interface to talk to the interface
135 holding the default IPv4 route (falling back to trunk0 if no
136 route is found), and that you want 'bridge0' to be used to bridge
137 the two.
138
139 Setting the environment variables ETHER and BRIDGE will override
140 these settings, respectively.
141
142 When starting QEMU, the script attempts to output useful
143 information, but there are also error messages that occur as
144 well. On my laptop, I want to route / nat natively using PF and
145 also have layer2 access to the QEMU networks. I thus have this
146 as /etc/hostname.trunk101:
147
148 inet6 fe80::1c 64 lladdr 00:03:25:0d:7a:2c
149 inet 10.7.255.1 255.255.255.0
150 inet6 alias 2001:240:58a:45::1c
151
152 I have dhcpd configured to run on trunk101, and also run rad.
153 For QEMU, the startup looks like this:
154
155 # export ETHER=trunk101
156 # export BRIDGE=bridge101
157 # qemu-system-i386 -net nic,vlan=0,macaddr=52:54:00:12:35:00 \
158 -net tap,vlan=0 -vnc :0 -localtime -usb -usbdevice tablet \
159 -m 256 -no-fd-bootchk -hda virtual.img -monitor stdio
160 {tap0 (bridge101 <-> trunk101)ifconfig: bridge101: No such process
161 ifconfig: bridge101: No such process
162 }
163 (qemu)
164
165 The errors are normal and should be ignored. One can verify the
166 networking is properly configured by verifying the bridge
167 interface:
168
169 $ ifconfig bridge101
170 bridge101: flags=41<UP,RUNNING>
171 groups: bridge
172 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp
173 designated: id 00:00:00:00:00:00 priority 0
174 tap0 flags=3<LEARNING,DISCOVER>
175 port 16 ifpriority 0 ifcost 0
176 trunk101 flags=3<LEARNING,DISCOVER>
177 port 6 ifpriority 0 ifcost 0
178 Addresses (max cache: 100, timeout: 240):
179
180 NOTE: When running multiple QEMU sessions simultaneously on the
181 same bridge, care must be taken because the network MAC
182 address defaults to 52:54:00:12:34:56 for every QEMU
183 instance. To change this, observe the macaddr= syntax in
184 the above example and choose a unique lladdr per QEMU nic.
185
186==> Mice
187
188 NOTE: Certain OS's work much better with the USB tablet device
189 than the normal PS/2 mouse handling. See the above example
190 for usage.
191
192==> Serial Console
193
194 Installing OpenBSD via serial console is sometimes desirable.
195 X may not be available, and so on. There are two ways to
196 accomplish this, both in effect the same solution:
197
198 a. qemu-system-i386 -vnc :0 -serial stdio .. virtual.img \
199 -cdrom install52.iso -boot d
200
201 - this option permits you to use VNC from some system to
202 connect to the QEMU instance and 'set tty com0' at the
203 'boot>' prompt.
204 - you may then disconnect VNC and use the terminal from
205 which you started QEMU to do the install.
206
207 b. qemu-system-i386 -nographic .. virtual.img -fda floppy52.fs -boot a
208
209 - this maps both the serial port and the (qemu) monitor
210 prompt to the terminal QEMU was started on.
211 - to flip between them, Ctrl-a c; see the QEMU man page for
212 other commands that work in -nographic mode.
213 - preparation of the floppy image to force serial console
214 mode is straightforward:
215
216 vnconfig vnd0 floppy52.fs
217 mount /dev/vnd0c /mnt
218 mkdir /mnt/etc
219 echo set tty com0 > /mnt/etc/boot.conf
220 umount /mnt
221 vnconfig -u vnd0
222
223 .. be sure to choose 'yes' for setting com0 to be the serial
224 console.
225
226 NOTE: OpenBSD poweroff does work with QEMU, which actually causes
227 QEMU itself to exit. This is a good thing, as it is
228 currently not possible to set what block device is booted
229 from at runtime from QEMU. So if you start an installation
230 booting from a CD-ROM, you will always boot off a CD-ROM
231 every time you reboot that QEMU session until you exit and
232 start QEMU again booting off the virtual hard drive.
233
234==> daemonized QEMU
235
236 Sometimes you want QEMU to start as part of a system script.
237
238 Adding to some of the above, the -daemonize option comes in
239 handy, as well as the telnet: designator for -serial and monitor.
240 This is a complete example that may be cut-and-pasted into
241 rc.local:
242
243 hddir=/var/vm
244 USER=qemu
245 if [ -x ${TRUEPREFIX}/bin/qemu ]; then
246 echo -n 'Qemu: vmi386'
247 (
248 ifconfig bridge101 add trunk101 add tap0 up
249
250 sh -c "doas -u $USER \
251 ${TRUEPREFIX}/bin/qemu-system-i386 \
252 -daemonize \
253 -nographic \
254 -net nic,vlan=0,macaddr=52:54:00:4e:62:8f \
255 -net tap,vlan=0,fd=3 \
256 -m 128 \
257 -hda $hddir/virtual.img \
258 -serial telnet:127.0.0.1:1080,server,nowait \
259 -monitor telnet:127.0.0.1:1081,server,nowait \
260 -no-fd-bootchk 3<>/dev/tap0"
261 )
262 echo "."
263 fi
264
265 NOTE: this presumes the user `qemu' exists, create it or set
266 USER= to an existing user to use this example.