Adding PXE Support for FreeBSD Guests to bhyve
Student: Steven Douglas (sdouglas@freebsd.org)
- Mentor: Rui Paulo
Project description
My project will add basic PXE support to bhyve for FreeBSD guests. Though PXE is the most accurate term to describe the idea, it is slightly misleading. My work will take place in bhyveload, the bhyve userspace loader, which is a fork of FreeBSD's standard boot loader. I will add support for basic DHCP, and loading the kernel, loader.conf (boot time configuration), and modules from a remote TFTP server specified either in the DHCP “next-server” field, or in a bhyve tunable. Once the kernel and modules are loaded bhyve may simply start execution of the kernel as usual.
This project would be benefit bhyve users in a number of ways. First it would allow running a centralized kernel build across a host's FreeBSD virtual machines. If you run a custom kernel, only a single rebuild would be required. If you run the generic one, you only need to patch a single kernel. This project also opens the door to running VM's without virtual hard drives. It could also allow for using a previous GSOC project for PXE automated installations in bhyve.
The feature would make it possible to deliver a common set of kernels to all of the virtual machines across multiple bhyve instances as they boot. For example, if I had a "Web Server" and a "Database server", I could specify in DHCP that they require a different kernel or different modules loaded at boot. All my kernels are still in one place though, I don't have to rebuild the kernels on each bhyve host, just once on the TFTP server.
Approach to solving the problem
I think that the problem can be broken into its individual pieces fairly easily:
- Successfull DHCP lease with access to "next-server" and "filename"
- Fetch loader.conf via TFTP
- Fetch Kernel via TFTP
- Fetch Modules via TFTP
- Load everything into memory and pass the location of the kernel and modules to bhyve.
After these parts are working individually, I think it should be much easier to introduce it into bhyve.
Deliverables
The following features will be implemented:
- Successfull PXE-like boot loading loader.conf, kernel, and modules via TFTP.
- Alternative configuration file option to load from static next-server / filename without the need for DHCP.
If there is time:
- Sucessfull PXE-like boot loading loader.conf, kernel, and moduels via HTTP.
Milestones
Here are my milestones for the project. I hope to get alot done in the hackers lounge at BSDCan.
- (May 25: Start of Coding)
- June 8: Successful DHCP Leaseing
- (June 9-13: BSDCan)
- June 14: Successful loader.conf via TFTP
- June 18: Successfull kernel via TFTP
- July 23: Successfull modules via TFTP
- (June 26 - July 3: Midterm Evaluations)
- July 10: First successful complete boot
- July 29: First successful complet http boot
- August 5: Code cleaned up
- August 15: Documentation finished, Wiki up to date
- (August 17: Coding stops (soft))
- (August 21: Coding stops (hard))
Test Plan
It is fairly easy to test the final product. When we can can boot a FreeBSD VM in bhyve via a tftp loader.conf / kernel / modules, it is working.
This section is still in flux.
The Code
https://socsvn.freebsd.org/socsvn/soc2015/sdouglas/