MICROVM revision 1.2
1# $NetBSD: MICROVM,v 1.2 2025/03/27 12:22:44 riastradh Exp $
2#
3# MICROVM kernel configuration, for use with Qemu microvm machine type
4# or Firecracker.
5# Stripped-down configuration with no PCI, use VirtIO over MMIO virtual
6# bus instead. ACPI is disabled as Firecracker doesn't support it,
7# use legacy MP tables instead.
8#
9# Exemple qemu usage on a Linux host to boot a NetBSD guest:
10#
11# qemu-system-x86_64							\
12# 	-M microvm,x-option-roms=off,rtc=on,acpi=off,pic=off,accel=kvm	\
13# 	-m 256 -cpu host -kernel ${KERNEL} 				\
14# 	-append "root=ld0a console=com rw -z"				\
15# 	-display none -device virtio-blk-device,drive=hd0		\
16# 	-drive file=${IMG},format=raw,id=hd0				\
17# 	-device virtio-net-device,netdev=net0 				\
18# 	-netdev user,id=net0,ipv6=off,hostfwd=::2200-:22		\
19# 	-global virtio-mmio.force-legacy=false -serial stdio
20
21machine i386 x86 xen
22include         "conf/std"      # MI standard options
23include         "arch/xen/conf/std.xenversion"
24
25options         CPU_IN_CKSUM
26options         EXEC_ELF32      # exec ELF binaries
27options         EXEC_SCRIPT     # exec #! scripts
28options         MTRR
29options         MULTIPROCESSOR
30
31options         CHILD_MAX=1024  # 160 is too few
32options         OPEN_MAX=1024   # 128 is too few
33
34mainbus0 at root
35cpu* at mainbus?
36ioapic* at mainbus? apid ?
37
38options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
39maxusers	8		# estimated number of users
40
41options 	INSECURE	# disable kernel security levels - X needs this
42
43options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
44
45options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)
46
47# Xen PV support for PVH and HVM guests, needed for PVH boot
48options 	XENPVHVM
49options 	XEN
50hypervisor*	at mainbus?		# Xen hypervisor
51xenbus*	 	at hypervisor?		# Xen virtual bus
52xencons*	at hypervisor?		# Xen virtual console
53
54# Include NetBSD 10 compatibility
55options		COMPAT_100
56#
57# Because gcc omits the frame pointer for any -O level, the line below
58# is needed to make backtraces in DDB work.
59#
60makeoptions	COPTS="-O2 -fno-omit-frame-pointer"
61
62# File systems
63#include "conf/filesystems.config"
64file-system FFS
65file-system EXT2FS
66file-system KERNFS
67file-system MFS
68file-system TMPFS
69file-system PTYFS
70file-system MSDOSFS
71file-system PROCFS
72
73options		DKWEDGE_AUTODISCOVER
74options		DKWEDGE_METHOD_GPT
75# File system options
76# ffs
77options 	FFS_NO_SNAPSHOT	# No FFS snapshot support
78options 	WAPBL		# File system journaling support
79
80# Networking options
81#options 	GATEWAY		# packet forwarding
82options 	INET		# IP + ICMP + TCP + UDP
83options 	INET6		# IPV6
84
85# Kernel root file system and dump configuration.
86config		netbsd	root on ? type ?
87
88#
89# Device configuration
90#
91
92# ACPI will be used if present. If not it will fall back to MPBIOS
93options 	MPBIOS			# configure CPUs and APICs using MPBIOS
94# Provide bug-for-bug compatibility with Linux in MP Table searching
95# and parsing.  Firecracker relies on these bugs.
96options		MPTABLE_LINUX_BUG_COMPAT
97
98#pci*	at mainbus? bus ?
99#acpi0	at mainbus0
100
101# ISA bus support
102isa0	at mainbus?
103
104# ISA serial interfaces
105com0	at isa? port 0x3f8 irq 4	# Standard PC serial ports
106
107# Virtual bus for non-PCI devices
108pv* at pvbus?
109
110## Virtio devices
111# Use MMIO by default
112virtio* at pv?
113#virtio* at acpi?
114#virtio* at pci? dev ? function ?	# Virtio PCI device
115
116include "dev/virtio/virtio.config"
117no viomb* at virtio?			# XXX ?
118no vioscsi* at virtio?			# XXX ?
119
120pseudo-device	md			# memory disk device (ramdisk)
121#options 	MEMORY_DISK_HOOKS	# enable md specific hooks
122#options 	MEMORY_DISK_DYNAMIC	# enable dynamic resizing
123#
124pseudo-device	vnd			# disk-like interface to files
125#options 	VND_COMPRESSION		# compressed vnd(4)
126
127## network pseudo-devices
128pseudo-device	bpfilter		# Berkeley packet filter
129pseudo-device	loop			# network loopback
130
131## miscellaneous pseudo-devices
132pseudo-device	pty			# pseudo-terminals
133# userland interface to drivers, including autoconf and properties retrieval
134pseudo-device	drvctl
135
136file-system	PUFFS
137pseudo-device	putter
138