A repository for building WSL2 Linux kernels with Docker compatibility, Android Binder support, and vidtv (virtual DVB test driver). This project provides automated tools and configurations to patch Microsoft's WSL2 kernel source with the necessary kernel options required for these workloads.
- 🐳 Docker Compatibility: Automatically patches WSL2 kernel config with all required options for Docker Engine
- 📱 Android Binder Support: Enables Android Binder IPC and BinderFS kernel options
- 📺 vidtv Support: Enables the virtual DVB test driver (
vidtv) for media testing - 🔧 Automated Scripts: Easy-to-use scripts for fetching and patching kernel configurations
- ☁️ CI/CD Ready: GitHub Actions workflow for automated kernel builds
The default WSL2 kernel provided by Microsoft may not include all the kernel options required for Docker to function properly. This project addresses that by:
- Fetching the latest WSL2 kernel configuration from Microsoft's repository
- Applying patches to enable Docker compatibility options
- Enabling Android Binder IPC support
- Enabling
vidtvtest driver support - Providing automated build workflows via GitHub Actions
- Linux or macOS system
bashshellcurlorwget(for fetching configs)sed(usually pre-installed)- Git
- Build tools:
build-essential,flex,bison,dwarves - Libraries:
libssl-dev,libelf-dev - Utilities:
cpio,qemu-utils - Access to Microsoft's WSL2-Linux-Kernel repository
Download the latest WSL2 kernel configuration from Microsoft's repository:
./scripts/fetch-wsl2-config.sh [output-filename]Example:
./scripts/fetch-wsl2-config.sh config-wsl2.cfgThis will download the config to config/config-wsl2.cfg (default location).
Apply Docker, Android Binder, and vidtv compatibility settings to a kernel configuration file:
./scripts/patch-wsl2-kernel-config.sh <config-file-path>Example:
./scripts/patch-wsl2-kernel-config.sh config/config-wsl2.cfgThe script will:
- Create a backup of the original config file
- Remove existing conflicting configuration entries
- Add all required Docker, Android Binder, and vidtv options
- Go to the Actions tab in your GitHub repository
- Select the Build workflow
- Click Run workflow
- Configure the build parameters:
- kernelBranch: WSL2-Linux-Kernel branch (default:
linux-msft-wsl-6.6.y) - build-modules: Whether to build kernel modules (default:
false) - custom-config: Use custom config from this repository (default:
false)
- kernelBranch: WSL2-Linux-Kernel branch (default:
- Click Run workflow
The workflow will:
- Checkout the specified WSL2 kernel branch
- Optionally apply your custom configuration
- Build the kernel
- Optionally build kernel modules
- Upload the built kernel (
bzImage) and modules (modules.vhdx) as artifacts
After downloading the artifacts from GitHub Actions:
-
Copy
bzImageto your Windows host (e.g.,C:\Users\<YourUsername>\) -
Create or edit
.wslconfigin your Windows user directory:[wsl2] kernel=C:\\Users\\<YourUsername>\\bzImage
-
Restart WSL2:
wsl --shutdown
The following kernel options are enabled for Docker compatibility:
# Bridge networking
CONFIG_BRIDGE=y
CONFIG_BRIDGE_NETFILTER=y
# Netfilter and iptables
CONFIG_NFT_COMPAT=y
CONFIG_NETFILTER_XT_NAT=y
CONFIG_NETFILTER_XT_TARGET_MASQUERADE=y
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
CONFIG_NETFILTER_XT_MATCH_CONNTRACK=y
CONFIG_NETFILTER_XT_MARK=y
# IP tables
CONFIG_IP_NF_IPTABLES=y
CONFIG_IP_NF_FILTER=y
CONFIG_IP_NF_NAT=y
CONFIG_IP_NF_TARGET_MASQUERADE=y
CONFIG_IP_NF_MANGLE=y
# IP Virtual Server
CONFIG_IP_VS=y
CONFIG_NETFILTER_XT_MATCH_IPVS=y
CONFIG_IP_VS_RR=y
# IPsec
CONFIG_XFRM_USER=y
CONFIG_XFRM_ALGO=y
CONFIG_INET_ESP=y
# Network classification
CONFIG_NET_CLS_CGROUP=y
CONFIG_IP_NF_TARGET_REDIRECT=y
# Virtual network interfaces
CONFIG_IPVLAN=y
CONFIG_MACVLAN=y
CONFIG_DUMMY=y
# FTP/TFTP NAT helpers
CONFIG_NF_NAT_FTP=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_NAT_TFTP=y
CONFIG_NF_CONNTRACK_TFTP=y
# Filesystem support
CONFIG_BTRFS_FS=yAndroid Binder support is commonly required for Android container/runtime stacks and userspace components that depend on Binder IPC:
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"vidtv is a virtual DVB driver used for media pipeline and userspace testing without physical tuner hardware:
CONFIG_DVB_TEST_DRIVERS=y
CONFIG_DVB_VIDTV=mwsl2-kernel-build/
├── config/
│ ├── config-wsl2.cfg # Base WSL2 kernel config
│ └── config-wsl2-docker.cfg # Pre-patched config with Docker support
├── scripts/
│ ├── fetch-wsl2-config.sh # Script to fetch latest WSL2 config
│ └── patch-wsl2-kernel-config.sh # Script to patch config with Docker/Android Binder/vidtv options
├── .github/
│ └── workflows/
│ └── build.yml # GitHub Actions build workflow
└── README.md
If Docker still doesn't work after using a patched kernel:
-
Verify the kernel options are present:
zcat /proc/config.gz | grep CONFIG_BRIDGE -
Check Docker's kernel compatibility requirements:
- Ensure all build dependencies are installed
- Check that you have sufficient disk space (kernel builds require several GB)
- Verify the kernel branch exists in Microsoft's repository