Code Monkey home page Code Monkey logo

wsl2-linux-kernel-config's Introduction

Custom Linux/x86 Kernel Configuration

Merge the last linux kernel configuration from Microsoft for Windows Subsystem for Linux 2 with the upstream torvalds linux sources

Compile Mainline Kernel for WSL2

Steps for compile Kernel Linux 6.1.y. Can use the script build.sh to automate the download, configuration, and compilation of the kernel source code for WSL2

Video Youtube

Compile Linux Kernel in Windows Subsystem for Linux 2

Actual Kernel

uname -a
Linux DESKTOP-ID 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 GNU/Linux

Work dir linux

mkdir -p linux
cd linux

Install requirements for Build

sudo apt install git bc build-essential flex bison libssl-dev libelf-dev dwarves

Download Linux source code

wget https://github.com/torvalds/linux/archive/refs/tags/v5.15.tar.gz -O v5.15.tar.gz

Untar linux sources

tar -xf v5.15.tar.gz

Download config WSL

wget https://github.com/microsoft/WSL2-Linux-Kernel/raw/linux-msft-wsl-5.10.y/Microsoft/config-wsl

Copy config WSL as default config to the linux config dir

cp config-wsl linux-5.15/arch/x86/configs/wsl_defconfig

Generate the Configuration and Build

cd linux-5.15
make KCONFIG_CONFIG=arch/x86/configs/wsl_defconfig -j4

Copy Linux kernel to YOUR_USER

powershell.exe /C 'Copy-Item .\arch\x86\boot\bzImage $env:USERPROFILE'

Point to your custom kernel in .wslconfig:

powershell.exe /C 'Write-Output [wsl2]`nkernel=$env:USERPROFILE\bzImage | % {$_.replace("\","\\")} | Out-File $env:USERPROFILE\.wslconfig -encoding ASCII'
[wsl2]
kernel=C:\\Users\\<YOUR_USER>\\bzImage

Shutdown WSL

wsl --shutdown

Check shutdown the distro WSL

wsl -l -v

Start distro

wsl -d Debian

New Kernel Linux

uname -a
Linux HP450-2 5.15.0-oleksis-microsoft-standard-WSL2 #1 SMP Mon Nov 29 01:14:26 EST 2021 x86_64 x86_64 x86_64 GNU/Linux

wsl2-linux-kernel-config's People

Contributors

oleksis avatar karthik558 avatar

Stargazers

Elisey Shemyakin avatar valorisa avatar  avatar Andrey S. avatar John Cyrill Corsanes avatar R. Mathieu Landvreugd avatar Edwiin Kusuma Jaya avatar  avatar  avatar Troy avatar

Watchers

 avatar

wsl2-linux-kernel-config's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.