Build Automation Script
Relevant source files
The following files were used as context for generating this wiki page:
The Build Automation Script facilitates the automated retrieval, configuration, and compilation of a Linux 7.0 amd64 kernel. This kernel is specifically intended for use within the gokrazy ecosystem to support Tailscale natlab/vmtest environments. A primary objective of this build process is to maintain a specific UDP GSO regression, allowing developers to test mitigation strategies against known kernel defects.
Sources: README.md:1-6, empty.go:5-8
Build Orchestration Logic
The primary build logic resides in build-buggy-linux-7_0.bash. This script manages the lifecycle of the kernel build from source acquisition to final image generation.
Execution Flow
The script executes the following sequential steps:
- Environment Setup: Defines the repository directory, kernel source URL, and local paths.
- Resource Acquisition: Downloads the Linux 7.0 source tarball from the official kernel CDN if it is not already present locally.
- Extraction: Unpacks the tarball into a dedicated source directory.
- Configuration Integration: Copies the project-specific
config.addendum.txtinto the kernel source tree. - Compilation: Invokes the Linux Kbuild system to generate the compressed kernel image (
bzImage). - Artifact Deployment: Copies the resulting
bzImageto the repository root asvmlinuz.
Sources: build-buggy-linux-7_0.bash:1-25
Build Process Visualization
The following diagram illustrates the flow of data and commands during the build execution.
This diagram shows the conditional logic for downloading and extracting sources before entering the kernel compilation phase.
Sources: build-buggy-linux-7_0.bash:7-25
Kernel Configuration Management
The build script utilizes a layered configuration approach. It first applies the default x86 configuration and then appends specific requirements defined in config.addendum.txt.
Key Configuration Categories
The automation script applies specific kernel flags to support the target environment:
| Category | Key Configuration Flags | Purpose |
|---|---|---|
| Networking | CONFIG_IPV6, CONFIG_WIREGUARD, CONFIG_TUN | Enables core networking and VPN support. |
| Virtualization | CONFIG_VIRTIO_PCI, CONFIG_VIRTIO_NET, CONFIG_VIRTIO_BLK | Provides drivers for QEMU and cloud environments. |
| File Systems | CONFIG_SQUASHFS, CONFIG_OVERLAY_FS | Supports gokrazy root file systems. |
| Diagnostics | CONFIG_DYNAMIC_DEBUG, CONFIG_IKCONFIG_PROC | Enables kernel debugging and config inspection. |
| Bug Induction | CONFIG_IGB, CONFIG_NET_VENDOR_INTEL | Enables the Intel igb driver to exercise the UDP GSO regression. |
Sources: config.addendum.txt:1-110, README.md:8-13
Boot Parameters
The build process produces a kernel that utilizes specific boot arguments defined in the project. These parameters control the initial system state and error handling.
root=/dev/sda2 ro init=/gokrazy/init panic=10 oops=panic
Sources: cmdline.txt:1
Integration with Gokrazy
The project is structured as a Go module to allow gokrazy to select it as a KernelPackage. The empty.go file serves as the package entry point for the Go toolchain, even though the primary artifacts are the bash script and the resulting binary kernel.
Usage in Tailscale Environment
To utilize the output of the build script in a gokrazy build, the package path is referenced in the Go configuration.
# Reference for gokrazy KernelPackage
github.com/tailscale/gokrazy-kernel-buggy-linux-7_0
# Local development override in go.mod
replace github.com/tailscale/gokrazy-kernel-buggy-linux-7_0 => ../github.com/tailscale/gokrazy-kernel-buggy-linux-7_0
Sources: README.md:15-23, empty.go:1-8
Summary
The build-buggy-linux-7_0.bash script automates the creation of a specialized Linux 7.0 kernel. By combining standard kernel build tools with a custom configuration addendum, it generates a vmlinuz image compatible with gokrazy and QEMU. This automation ensures consistent reproduction of a specific network regression for testing Tailscale's mitigation logic.