Locietta / xanmod-kernel-WSL2

Xanmod kernel for WSL2, built by clang with ThinLTO enabled. Build & Release are automated by Github Action.
GNU General Public License v2.0
81 stars 12 forks source link

Help: Installing Linux kernel headers #26

Open ayushbindlish opened 1 year ago

ayushbindlish commented 1 year ago

The kernel headers are missing. How can I get the kernel headers? And how do I install them? I know how to do it on Ubuntu but not too sure about wsl.

Locietta commented 1 year ago

Since we're using custom kernels on WSL, there's no corresponding linux-headers-* package on Debian or Ubuntu (this is the same situation for MS's official WSL2 kernel). AFAIK we have to build kernel from source and do make headers_install to get kernel headers installed.

But I'm not sure whether enabling CONFIG_IKHEADERS=y is helpful (mentioned at microsoft/WSL#5526). I've attached a bzImage built with the option enabled, can you try it?

👉 bzImage.txt (github doesn't allow to upload files without extension, so I just add .txt)

ayushbindlish commented 1 year ago

Let me give it a try and I'll get back to you.

ayushbindlish commented 1 year ago

I am not too sure how to verify this. A lot of packages are trying to access: linux-headers-6.1.8-locietta-WSL2-xanmod1

dpkg gives the following output:

 dpkg -l | grep linux-                                                                                                                                                                                 130 ↵
ii  binutils-x86-64-linux-gnu         2.38-4ubuntu2.1                         amd64        GNU binary utilities, for x86-64-linux-gnu target
ii  linux-libc-dev:amd64              5.15.0-71.78                            amd64        Linux Kernel Headers for development
ii  linux-tools-5.15.0-71             5.15.0-71.78                            amd64        Linux kernel version specific tools for version 5.15.0-71
ii  linux-tools-5.15.0-71-generic     5.15.0-71.78                            amd64        Linux kernel version specific tools for version 5.15.0-71
ii  linux-tools-common                5.15.0-71.78                            all          Linux kernel version specific tools for version 5.15.0
ii  linux-tools-generic               5.15.0.71.69                            amd64        Generic Linux kernel tools
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy

uname -r
6.1.8-locietta-WSL2-xanmod1

@Locietta

4-FLOSS-Free-Libre-Open-Source-Software commented 1 week ago

Seems another custom Kernel project solved it this way:

https://github.com/Nevuly/WSL2-Linux-Kernel-Rolling/wiki#kernel-modules-and-kernel-headers-installation-guide

Could add build of and distribute xanmod-kernel-WSL2 headers with release?