# Bhyve: build kernel with vmm



## kakawkaization (May 15, 2016)

Hello, I'm build kernel with options for Bhyve:

```
device if_bridge 
device tap
device nmdm
```
It's ok and it works.

But, I can't find anywhere option for vmm(4) like: device vmm.
With this option kernel can't build. My configuration for bhyve works when I add to /boot/loader.conf

```
vmm_load="YES"
```
But I don't want to use loader.conf and want to build kernel for bhyve with vmm(4).

How to build kernel with vmm.ko?
Thank you, sorry for my bad English.


----------



## kakawkaization (May 16, 2016)

No one knows?


----------



## grehan@ (May 16, 2016)

Currently bhyve can only be built as a module. If you need it to be built into the kernel, the appropriate lines would have to be added to sys/conf/files.amd64

Any particular reason why the loader.conf solution won't work ?


----------



## kakawkaization (May 16, 2016)

loader.conf is works, but i want to compile kernel with same modules.
i compile kernel with modules
device if_bridge
device tap
device nmdm

But.. there is no instruction how to add vmm to kernel.


----------



## tOsYZYny (Jan 6, 2022)

I have this question too - I have a custom kernel (so that I can do traffic shaping) and need to determine how I can build vmm so that I can also run bhyve.  After installing


> vm-bhyve
> grub2-bhyve
> uefi-edk2-bhyve



I still cannot do kldload vmm.

Additionally, looking through /usr/src/sys/conf/NOTES as the kernel configuration instructs, I don't see anything about vmm.

That said, a quick find and I can see vmm in /usr/src/sys/amd64/vmm.  But, I don't know if that is what I want and if so, how to "enable" it .

Please help.


----------



## covacat (Jan 6, 2022)

your CPU may be lacking support (or must be enabled in BIOS)
man 4 vmm


----------



## tOsYZYny (Jan 6, 2022)

It certainly isn't the CPU because I swapped hard drives and that is running my workstation build (stock kernel) and I have bhyve working just fine there.  My router build requires a custom kernel just so I can do traffic shaping, otherwise, I'd use a stock kernel.


----------



## covacat (Jan 6, 2022)

do you have an error message from kldload vmm ?
check logs


----------



## tOsYZYny (Jan 6, 2022)

kldload: can't load vmm: No such file or directory

# find /boot | grep vmm
/boot/kernel.old/vmm.ko


I *think* kernel.old is the stock kernel.


----------



## covacat (Jan 6, 2022)

it needs do be in /boot/kernel
did you build with -DNO_MODULES ?


----------



## tOsYZYny (Jan 6, 2022)

No, I don't think so:

watered down shell script ...


> git clone -b releng/$_VERSION --depth 1 https://git.freebsd.org/src.git /usr/src
> cd /usr/src
> 
> make buildkernel KERNCONF=router
> make installkernel KERNCONF=router


Is that correct?


----------



## tOsYZYny (Jan 6, 2022)

Guilty:
# cat /etc/make.conf


> #MODULES_OVERRIDE =
> #MODULES_OVERRIDE=zfs opensolaris geom_eli aesni acpi_video acpi_wmi pf mac_ntpd
> #MODULES_OVERRIDE=zfs opensolaris geom_eli aesni acpi pf mac_ntpd
> MODULES_OVERRIDE=zfs opensolaris geom aesni acpi pf mac_ntpd



What should be in there? vmm?


----------



## covacat (Jan 6, 2022)

MODULES_OVERRIDE
                   (str) Set to a list of modules to build instead of all of
                   them.
so add vmm
but you can build them all and remove that line
i


----------



## tOsYZYny (Jan 6, 2022)

Yes, I forgot about that, so, I just need vmm as a module, and it *should* build .


----------



## covacat (Jan 6, 2022)

you can go to /sys/modules/vmm and make all install
or if you track 13-RELEASE you can just copy it from kernel.old


----------



## tOsYZYny (Jan 6, 2022)

Ah, ok, cool.  I will try that.


----------

