Last active
May 3, 2022 07:13
-
-
Save gamunu/e5cbd6252a1a88449d20e62fc55bea0c to your computer and use it in GitHub Desktop.
WSL kernel build instructions to include xt_recent module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --name wsl-kernel-builder --rm -it ubuntu:latest bash | |
WSL_COMMIT_REF=linux-msft-wsl-5.10.16.3 # change this line to the version you want to build | |
# Install dependencies | |
apt update | |
apt install -y git build-essential flex bison libssl-dev libelf-dev bc | |
# Checkout WSL2 Kernel repo | |
mkdir src | |
cd src | |
git init | |
git remote add origin https://github.com/microsoft/WSL2-Linux-Kernel.git | |
git config --local gc.auto 0 | |
git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +${WSL_COMMIT_REF}:refs/remotes/origin/build/linux-msft-wsl-5.10.y | |
git checkout --progress --force -B build/linux-msft-wsl-5.4.y refs/remotes/origin/build/linux-msft-wsl-5.10.y | |
# Enable xt_recent kernel module | |
sed -i 's/# CONFIG_NETFILTER_XT_MATCH_RECENT is not set/CONFIG_NETFILTER_XT_MATCH_RECENT=y/' Microsoft/config-wsl | |
# Compile the kernel | |
make -j2 KCONFIG_CONFIG=Microsoft/config-wsl | |
# From the host terminal copy the newly built kernel | |
docker cp wsl-kernel-builder:/src/arch/x86/boot/bzImage . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment