项目作者: HsingYun

项目描述 :
linux-wsl kernel for ArchLinux
高级语言: Shell
项目地址: git://github.com/HsingYun/ArchLinux-wsl.git
创建时间: 2020-08-09T07:50:03Z
项目社区:https://github.com/HsingYun/ArchLinux-wsl

开源协议:The Unlicense

下载


ArchLinux Kernel for Microsoft WSL

Require

# pacman -S asp pacman-contrib

Build Kernel

  1. $ updpkgsums
  2. $ makepkg -s -f

Config

  1. 1. support network block device (nbd) `CONFIG_BLK_DEV_NBD`
  2. 2. support systemd Hash API `CONFIG_CRYPTO_USER_API_HASH`
  3. 3. support systemd-oomd `CONFIG_PSI`
  4. 4. support qemu-nbd with io_uring `CONFIG_IO_URING`

Mount microsoft VHDX

  1. $ sudo qemu-nbd -c /dev/nbd0 /mnt/d/test/ext4-extra.vhdx
  2. $ sudo mount -t ext4 -o rw /dev/nbd0 /mnt/media

Windows Insiders preview build 20211 support wsl.exe --mount for mounting physical or virtual disks, see Access Linux filesystems in Windows and WSL 2

Compress VHDX

Optimize-VHD works by trimming empty blocks, but “empty” doesn’t always mean what you might think because ext4fs is not NTFS.
So the first thing we need to do is to clean up the file system on the linux file system environment.

On WSL2

  1. # create block device with vhdk, do not mount
  2. sudo qemu-nbd --aio=io_uring -c /dev/nbd0 /mnt/d/test/ext4-extra.vhdx
  3. # cleanup block
  4. sudo zerofree /dev/nbd0

On Windows

  1. # compress VHDK
  2. PS C:\> Optimize-VHD -Path c:\test\dynamic.vhdx -Mode Full

Use Systemd

  1. see genie-systemd for more details
  2. https://github.com/arkane-systems/genie
  3. https://github.com/sorah/subsystemctl

see: Systemd support is now available in WSL!

Mount Boot from NTFS (drvfs with fstab)

  1. # <file system> <dir> <type> <options> <dump> <pass>
  2. D:\Develop\ArchLinux\kernel /boot drvfs rw,noatime

Use custom Kernel (WSL2)

  1. # .wslconfig
  2. [wsl2]
  3. kernel=D:\\Develop\\ArchLinux\\kernel\\vmlinuz-linux-wsl2

screenfetch

  1. # hsingyun @ HsingYun-PC-wsl in ~
  2. $ uname -a
  3. Linux HsingYun-PC-wsl 5.8.0-arch1-2-wsl-microsoft #3 SMP Sun, 09 Aug 2020 09:13:15 +0000 x86_64 GNU/Linux
  4. # hsingyun @ HsingYun-PC-wsl in ~
  5. $ screenfetch
  6. -`
  7. .o+` hsingyun@HsingYun-PC-wsl
  8. `ooo/ OS: Arch Linux (on the Windows Subsystem for Linux)
  9. `+oooo: Kernel: x86_64 Linux 5.8.0-arch1-2-wsl-microsoft
  10. `+oooooo: Uptime: 0m
  11. -+oooooo+: Packages: 307
  12. `/:-:++oooo+: Shell: zsh 5.8
  13. `/++++/+++++++: Disk: 1.8T / 5.9T (30%)
  14. `/++++++++++++++: CPU: AMD Ryzen 9 3900X 12-Core @ 24x 3.793GHz
  15. `/+++ooooooooooooo/` RAM: 649MiB / 51345MiB
  16. ./ooosssso++osssssso+`
  17. .oossssso-````/ossssss+`
  18. -osssssso. :ssssssso.
  19. :osssssss/ osssso+++.
  20. /ossssssss/ +ssssooo/-
  21. `/ossssso+/:- -:/+osssso+-
  22. `+sso+:-` `.-/+oso:
  23. `++:. `-/+/
  24. .` `/
  25. # hsingyun @ HsingYun-PC-wsl in ~
  26. $ systemctl status
  27. HsingYun-PC-wsl
  28. State: running
  29. Jobs: 0 queued
  30. Failed: 0 units
  31. Since: Sun 2020-08-09 17:19:31 CST; 27s ago
  32. CGroup: /
  33. ├─user.slice
  34. └─user-1000.slice
  35. ├─user@1000.service
  36. └─init.scope
  37. ├─80 /usr/lib/systemd/systemd --user
  38. └─81 (sd-pam)
  39. └─session-c1.scope
  40. ├─ 78 /sbin/runuser -l hsingyun -w INSIDE_GENIE,WSL_DISTRO_NAME,WSL_INTEROP,WSLENV
  41. ├─ 87 -zsh
  42. ├─312 systemctl status
  43. └─313 less
  44. ├─init.scope
  45. └─1 /lib/systemd/systemd
  46. └─system.slice
  47. ├─systemd-udevd.service
  48. └─33 /usr/lib/systemd/systemd-udevd
  49. ├─systemd-journald.service
  50. └─23 /usr/lib/systemd/systemd-journald
  51. ├─sshd.service
  52. └─71 sshd: /usr/bin/sshd -D [listener] 0 of 10-100 startups
  53. ├─dbus.service
  54. └─67 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog> └─systemd-logind.service
  55. └─72 /usr/lib/systemd/systemd-logind