This guide explains how the kernel build works and how to customize it.
mvirt-one uses a minimal Linux kernel optimized for virtualization. The kernel configuration uses a fragment-based approach rather than a full .config file.
Instead of maintaining a full kernel config (~8000+ lines), we use a small fragment (kernel.config, ~200 lines) that contains only our customizations.
Build process:
make tinyconfig- Start with the smallest possible kernelmerge_config.sh- Merge our fragment on topmake olddefconfig- Fill in remaining options with defaults
Benefits:
- Easy to see what options we actually need
- Survives kernel upgrades better
- Clear documentation of requirements
The mvirt-one/kernel.config fragment includes:
| Category | Options |
|---|---|
| Virtio | virtio-blk, virtio-net, virtio-console, virtio-vsock |
| Filesystems | ext4, tmpfs, proc, sysfs, devtmpfs |
| Networking | IPv4, IPv6, Unix sockets |
| Serial | 8250 UART for console |
The kernel is optimized for MicroVMs - no hardware drivers needed.
# Download and extract kernel source (if not already done)
make os-download
# Open interactive config menu
make menuconfigNavigate the menus to find the option you need. Press / to search by name.
Changes made in menuconfig are saved to .config and can be tested immediately:
make menuconfig # Enable option, save to .config
make kernel # Build kernel
make iso # Build ISO for testingIf the option works, add it to the fragment:
# Add to kernel.config
echo "CONFIG_MY_DRIVER=y" >> mvirt-one/kernel.configOr edit mvirt-one/kernel.config directly.
Important: Changes only in .config are lost after make clean or when kernel.config is modified, because .config is regenerated from the fragment.
To explicitly disable an option:
# In kernel.config
# CONFIG_WIRELESS is not set- Find the driver name (e.g., from
lspci -kon target hardware) - Search in menuconfig:
/then search for driver name - Note the config option (e.g.,
CONFIG_IXGBE) - Add to
kernel.config:# Intel 10GbE (ixgbe) CONFIG_IXGBE=y
Same process - find the driver, add the config option:
# Example: Add support for specific RAID controller
CONFIG_MEGARAID_SAS=y
Some drivers have dependencies. menuconfig shows these - look for options marked with --- or [*] that appear when you enable something.
Common dependencies to check:
CONFIG_PCI=y- Required for most hardwareCONFIG_SCSI=y- Required for storage driversCONFIG_PHYLIB=y- Required for some network drivers
The kernel version is specified in mvirt-one/kernel.version:
cat mvirt-one/kernel.versionTo update the kernel:
- Edit
kernel.versionwith new version number - Run
make distcleanto remove old source - Run
make osto download and build new version - Test thoroughly - config options may have changed
Check if the option has unmet dependencies:
cd mvirt-one/kernel
./scripts/config --state CONFIG_MY_OPTIONReview enabled options. Common space savings:
- Disable unused network drivers
- Disable debug options (
CONFIG_DEBUG_*) - Disable unused filesystems
Ensure these core options are enabled:
CONFIG_BLK_DEV_INITRD=y- Initramfs supportCONFIG_RD_GZIP=y- Gzip decompressionCONFIG_DEVTMPFS=y- Device filesystemCONFIG_TTY=y- Terminal support