Skip to content

Simple script and config to build custom Linux kernels for Firecracker MicroVMs

License

tsirysndr/vmlinux-builder

vmlinux-builder

release

📦 vmlinux-builder is a lightweight TypeScript/Deno-based tool to fetch, configure, and build the Linux kernel vmlinux image for a given version — ideal for use with Firecracker microVMs or other kernel-related debugging/testing tasks.

✨ Features

  • Builds any stable Linux kernel version (e.g., 6.1, 6.1.12, 6.1.y)
  • Uses a custom .config for reproducible builds
  • Outputs a ready-to-use vmlinux-X.Y file
  • Written in TypeScript with Deno for better type safety and cross-platform compatibility
  • Colored output using Chalk for improved readability
  • Easily integrated into CI pipelines (e.g., GitHub Actions)

🛠 Prerequisites

System Dependencies

Ensure you have the following dependencies installed:

sudo apt-get install -y git build-essential flex bison libncurses5-dev \
libssl-dev gcc bc libelf-dev pahole

Deno Runtime

Install Deno if you haven't already:

curl -fsSL https://deno.land/install.sh | sh

Or follow the official Deno installation guide.

🚀 Usage

Clone the repo and provide a kernel version:

# Make the script executable
chmod +x build.ts

# Run with a kernel version
./build.ts 6.16.y

# Or run directly with Deno
deno run --allow-run --allow-read --allow-write --allow-env --allow-net build.ts 6.16.y

Note: Ensure a valid .config file is present in the root directory before running.

Supported Version Formats

  • 6.1 - Major.Minor version
  • 6.1.12 - Specific patch version
  • 6.1.y - Latest from maintenance branch
  • v6.1.12 - Version with 'v' prefix (automatically normalized)

Example output

Building vmlinux for Linux kernel 6.16
vmlinux built successfully!
You can find the vmlinux file in /path/to/linux-stable/vmlinux-6.16.x86_64

📦 GitHub Actions

This repo includes a GitHub Actions workflow (.github/workflows/ci.yml) that:

  • Triggers on tag push (e.g. git tag 6.16.y && git push origin 6.16.y)
  • Builds the vmlinux for that version
  • Publishes the resulting vmlinux-X.Y as a GitHub Release asset

🔧 Development

The script is written in TypeScript and runs on Deno. Key features:

  • Type-safe: Full TypeScript support with type checking
  • Cross-platform: Works on Linux, macOS, and Windows (WSL)
  • Modern: Uses Deno's native APIs for file operations and process management
  • Colored output: Enhanced user experience with Chalk

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Simple script and config to build custom Linux kernels for Firecracker MicroVMs

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published