Adding Additional Emulation Drivers
Relevant source files
The following files were used as context for generating this wiki page:
The gokrazy-kernel-buggy-linux-7_0 package provides a Linux 7.0 amd64 kernel specifically tailored for Tailscale natlab/vmtest environments. This kernel intentionally preserves a UDP GSO regression to facilitate mitigation testing in virtualized environments, such as QEMU q35 instances.
Adding additional emulation drivers involves modifying the kernel configuration addendum and rebuilding the kernel image. The kernel must include specific drivers for PCI, virtio block devices, and network interfaces to operate correctly within these emulated testbeds.
Sources: README.md:1-12, empty.go:5-9
Driver Configuration Architecture
Drivers are managed through a configuration addendum file that supplements the default Linux kernel configuration. The project uses a specific set of flags to enable support for virtualized hardware components frequently used in testing.
Supported Emulation Components
The kernel configuration prioritizes drivers required for stable execution under QEMU and similar hypervisors.
| Component | Driver/Flag | Purpose |
|---|---|---|
| Virtio Storage | CONFIG_VIRTIO_BLK | Enables block device support for virtual disks. |
| Virtio Networking | CONFIG_VIRTIO_NET | Provides high-performance virtual networking. |
| Intel Network | CONFIG_IGB | Supports emulated Intel igb NICs for UDP GSO testing. |
| Random Number Gen | HW_RANDOM_VIRTIO | Provides entropy from the host to the guest. |
| Framebuffer | CONFIG_FB_SIMPLE | Enables basic display output for the console. |
Sources: config.addendum.txt:19-24, config.addendum.txt:69-83, README.md:12-16
Configuration Data Flow
The following diagram illustrates how driver configurations are merged into the final kernel build process.
This diagram shows the sequence where the project-specific driver requirements are injected into the standard kernel configuration workflow.
Sources: build-buggy-linux-7_0.bash:17-21
Adding New Drivers
To add a new emulation driver, you must append the corresponding CONFIG_* symbol to the addendum file and execute the build script.
Driver Addition Procedure
- Identify the required kernel configuration symbols for the driver.
- Add the symbols to
config.addendum.txtusing the formatCONFIG_DRIVER_NAME=y. - Run the build script:
./build-buggy-linux-7_0.bash. - Verify the resulting
vmlinuzbinary contains the new driver support.
Sources: build-buggy-linux-7_0.bash:20-25, config.addendum.txt:1-5
Network and Infrastructure Drivers
The kernel includes advanced networking support necessary for container-like plumbing and diagnostic testing.
- Virtio Infrastructure: Supports
CONFIG_VIRTIO_PCIandCONFIG_VIRTIO_MMIOfor various virtual bus types. - Networking Tests: Includes
CONFIG_BRIDGEandCONFIG_VETHfor bridge/veth-based networking tests. - Security/Firewall: Enables
CONFIG_NF_TABLES(nftables) andCONFIG_BPF_SYSCALLfor sophisticated network filtering.
Sources: config.addendum.txt:30-65, config.addendum.txt:75-76, config.addendum.txt:86-87
Implementation Details
The build system automates the retrieval and patching of the kernel source.
The script ensures that the config.addendum.txt is always applied after the default configuration to override or add specific emulation drivers.
Sources: build-buggy-linux-7_0.bash:7-22
Boot Requirements
The kernel requires specific command-line parameters to identify the root filesystem and initialization process.
root=/dev/sda2 ro init=/gokrazy/init panic=10 oops=panic
This configuration ensures the kernel uses the second partition of the first SCSI/SATA/Virtio-Block device as the root, which is standard for gokrazy deployments.
Sources: cmdline.txt:1