@@ -24,7 +24,7 @@ request, we encourage you to [submit the change upstream][submit-patch].
2424
2525# Build Instructions
2626
27- Instructions for building an x86_64 WSL2 kernel with an Ubuntu distribution are
27+ Instructions for building an x86_64 WSL2 kernel with an Ubuntu distribution using bash are
2828as follows:
2929
30301 . Install the build dependencies:
@@ -39,23 +39,23 @@ as follows:
3939
4040 You may wish to include ` -j$(nproc) ` on the first ` make ` command to build in parallel.
4141
42- 4 . Calculate the modules size (plus 1024 bytes for slack):
43- ` modules_size=$(du -s "$PWD/modules" | awk '{print $1;}'); modules_size=$((modules_size + 1024 )); `
42+ 4 . Calculate the modules size (plus 256 MB for slack):
43+ ` modules_size=$(du -bs "$PWD/modules" | awk '{print $1;}'); modules_size=$((modules_size + (256*(1<<20)) )); `
4444
45455 . Create a blank image file for the modules:
46- ` dd if=/dev/zero of="$PWD/modules.img" bs=1 count=$modules_size `
46+ ` dd if=/dev/zero of="$PWD/modules.img" bs=1024 count=$(( modules_size / 1024)) `
4747
48486 . Setup filesystem and mount img file:
49- ` lo_dev=$(losetup --find --show "$PWD/modules.img"); mkfs -t ext4 $lo_dev; sudo mount $lo_dev "$PWD/modules_img" `
49+ ` lo_dev=$(sudo losetup --find --show "$PWD/modules.img"); sudo mkfs -t ext4 $lo_dev; mkdir $PWD/modules_img; sudo mount $lo_dev "$PWD/modules_img"; sudo chmod a+w "$PWD/modules_img" `
5050
51517 . Copy over the modules, unmount the img now that we're done with it:
52- ` cp -r "$PWD/modules/lib/modules/$(make -s kernelrelease)" "$PWD/modules_img"; sudo umount "$PWD/modules_img" `
52+ ` cp -r "$PWD/modules/lib/modules/$(make -s kernelrelease)"/* "$PWD/modules_img"; sudo umount "$PWD/modules_img" `
5353
54548 . Convert the img to VHDX:
55- ` qemu-img convert -O VHDX "$PWD/modules.img" "$PWD/modules.vhdx" `
55+ ` qemu-img convert -O vhdx "$PWD/modules.img" "$PWD/modules.vhdx" `
5656
57579 . Clean up:
58- ` rm modules.img # optionally $PWD/modules dir too `
58+ ` rm -r modules.img modules_img # optionally $PWD/modules dir too `
5959
6060# Install Instructions
6161
0 commit comments