Skip to content

Commit c07e1d3

Browse files
committed
Merge product/wsl/readme/6.6 into v6.6.75
* commit 'b585a63f164e826c87e21b83cf9c4e97d3cc222e': (23 commits) Suggest using sudo to run the script Fix having the wrong quote mark Fix sequencing Quote $lo_dev Add script Quote the loopback device name Sequence commands with `&&` where it makes sense Add quotes Add shell prompts Fix instructions Move modules_install into its own command Fix spacing Include a suggestion to build in parallel First draft of changes README.md: Include more details for modules with custom kernels Update build dependencies README.md: include building step for modifying configs README.md: Add dwarves to list of build dependencies README.md: Improve the structure of the file README.md: Consolidate WSL specific instructions ...
2 parents c226e75 + b585a63 commit c07e1d3

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed

README-Microsoft.WSL2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
README.md

README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Introduction
2+
3+
The [WSL2-Linux-Kernel][wsl2-kernel] repo contains the kernel source code and
4+
configuration files for the [WSL2][about-wsl2] kernel.
5+
6+
# Reporting Bugs
7+
8+
If you discover an issue relating to WSL or the WSL2 kernel, please report it on
9+
the [WSL GitHub project][wsl-issue]. It is not possible to report issues on the
10+
[WSL2-Linux-Kernel][wsl2-kernel] project.
11+
12+
If you're able to determine that the bug is present in the upstream Linux
13+
kernel, you may want to work directly with the upstream developers. Please note
14+
that there are separate processes for reporting a [normal bug][normal-bug] and
15+
a [security bug][security-bug].
16+
17+
# Feature Requests
18+
19+
Is there a missing feature that you'd like to see? Please request it on the
20+
[WSL GitHub project][wsl-issue].
21+
22+
If you're able and interested in contributing kernel code for your feature
23+
request, we encourage you to [submit the change upstream][submit-patch].
24+
25+
# Build Instructions
26+
27+
Instructions for building an x86_64 WSL2 kernel with an Ubuntu distribution using bash are
28+
as follows:
29+
30+
1. Install the build dependencies:
31+
`$ sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev cpio qemu-utils`
32+
33+
2. Modify WSL2 kernel configs (optional):
34+
`$ make menuconfig KCONFIG_CONFIG=Microsoft/config-wsl`
35+
36+
3. Build the kernel using the WSL2 kernel configuration and put the modules in a `modules`
37+
folder under the current working directory:
38+
`$ make KCONFIG_CONFIG=Microsoft/config-wsl && make INSTALL_MOD_PATH="$PWD/modules" modules_install`
39+
40+
You may wish to include `-j$(nproc)` on the first `make` command to build in parallel.
41+
42+
Then, you can use a provided script to create a VHDX containing the modules:
43+
`$ sudo ./Microsoft/scripts/gen_modules_vhdx.sh "$PWD/modules" modules.vhdx`
44+
45+
To save space, you can now delete the compilation artifacts:
46+
`$ make clean && rm -r "$PWD/modules"`
47+
48+
If you prefer, you can also build the modules VHDX manually as follows:
49+
50+
1. Calculate the modules size (plus 1024 bytes for slack):
51+
`modules_size=$(du -s "$PWD/modules" | awk '{print $1;}'); modules_size=$((modules_size + 1024));`
52+
53+
2. Create a blank image file for the modules:
54+
`dd if=/dev/zero of="$PWD/modules.img" bs=1 count=$modules_size`
55+
56+
3. Setup filesystem and mount img file:
57+
`lo_dev=$(losetup --find --show "$PWD/modules.img") && mkfs -t ext4 "$lo_dev" && sudo mount "$lo_dev" "$PWD/modules_img"`
58+
59+
4. Copy over the modules, unmount the img now that we're done with it:
60+
`cp -r "$PWD/modules" "$PWD/modules_img" && sudo umount "$PWD/modules_img"`
61+
62+
5. Convert the img to VHDX:
63+
`qemu-img convert -O VHDX "$PWD/modules.img" "$PWD/modules.vhdx"`
64+
65+
6. Clean up:
66+
`rm modules.img # optionally $PWD/modules dir too`
67+
68+
# Install Instructions
69+
70+
Please see the documentation on the [.wslconfig configuration
71+
file][install-inst] for information on using a custom built kernel.
72+
73+
[wsl2-kernel]: https://github.com/microsoft/WSL2-Linux-Kernel
74+
[about-wsl2]: https://docs.microsoft.com/en-us/windows/wsl/about#what-is-wsl-2
75+
[wsl-issue]: https://github.com/microsoft/WSL/issues/new/choose
76+
[normal-bug]: https://www.kernel.org/doc/html/latest/admin-guide/bug-hunting.html#reporting-the-bug
77+
[security-bug]: https://www.kernel.org/doc/html/latest/admin-guide/security-bugs.html
78+
[submit-patch]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html
79+
[install-inst]: https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig

0 commit comments

Comments
 (0)