User:FallenAvatar/WSL Notes

From OSDev Wiki
Jump to navigation Jump to search

Random Notes

  • 100% working on my end for Bare Bone and Meaty Skeleton
  • WSL is running Ubuntu 14.04
  • WSL does not have an install of GRUB (use grub-pc-bin)
  • WSL has a rather out of date version of GCC install by default (4.8.2)
  • To build GCC need bison, flex, byacc, as well as the prereqs mentioned on GCC_Cross-Compiler#Downloading_the_Source_Code
  • Need to update pre-built gcc, Server Fault - How do I use the latest GCC on Ubuntu? use gcc-6 instead of gcc-4.9
  • Recommended list of packages to apt-get before starting
    • git
    • bison
    • flex
    • byacc
    • build-essential
    • gcc-7 (After adding PPA: sudo add-apt-repository ppa:ubuntu-toolchain-r/test)
    • libgmp3-dev
    • libmpfr-dev
    • libmpc-dev
    • texinfo
    • grub-pc-bin
    • xorriso
  • Need to come up with steps and test all of the above to make sure it is enough.
  • Optional/Helpful packages to apt-get
    • genisoimage (provides "isoinfo" which can be helpful for sanity checking iso files)
    • nasm (if you prefer Intel syntax over AT&T)
  • Bare_Bones does work with all prereqs mentioned above. Running the kernel (with -kernel) or the iso (with -cdrom) in QEMU works (confirmed by myself +2 on the forums)
  • Meaty_Skeleton works same as the Bare Bones (works for me in qemu, maybe others, though unconfirmed by myself)
  • For cleanup purposes, [1]This is a good way to see all "installed" packages. Adding a "> file.txt" after it will allow you to easily reference and review the list to decide what needs to be removed. And "sudo apt-get autoremove" should be your final command (repeated until nothing shows up if necessary)
[19:52] <Kazinsal> should add something about installing a Windows-based X server like Xming
[19:52] <Kazinsal> you can then set up your bash startup scripts to export DISPLAY=0:0
[19:52] <Kazinsal> and then anything X or SDL inside WSL will be forwarded to Xming or whatever

Step by Step

  1. Prerequisites
    1. A fully up to date Windows 10 x64 install
    2. Required Knowledge
  2. Install WSL
    1. Open Control Panel -> Program and Features -> Turn Windows features on or off
    2. Select "Windows Subsystem for Linux (Beta)"
    3. Hit OK
    4. Let it install
    5. Reboot (Yes, you MUST reboot before continuing)
  3. Installing BASH
    1. Open an elevated command prompt
    2. Run "bash" and follow the instructions/prompts provided
  4. Setup shared folder (Optional)
    1. Create a folder somewhere in your windows filesystem that you will use for easy access (I created a wsl folder in My Documents)
    2. "cd ~"
    3. "ln -s "wsl" "/mnt/c/Users/<WindowsUserName>/Documents/wsl" Replacing paths as you prefer
  5. Installing and Updating software
    1. Updating system GCC
      1. Add PPA for gcc-7: sudo add-apt-repository ppa:ubuntu-toolchain-r/test
      2. Update apt lists so it can find gcc-7: sudo apt-get update
      3. Install GCC 7: sudo apt-get install gcc-7
      4. Point gcc to the new version: sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
        1. You can see here if you want to have multiple copies of gcc installed and be able to switch between them: https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu/581497#581497
    2. Installing/Compiling a cross compiler
      1. Prereqs
        1. sudo apt-get install make bison flex libgmp3-dev libmpfr-dev libmpc-dev texinfo
      2. Follow GCC_Cross-Compiler
    3. Install additional tools
      1. sudo apt-get install git grub-pc-bin xorriso
      2. Optional: sudo apt-get install nasm genisoimage
    4. Clean Up
      1. sudo apt-get autoremove
        1. Repeat til nothing shows up
  6. Bare Bones
    1. See Bare_Bones

ToDo

  1. Finish Step-by-Step
  2. Test Step-by-Step + clean-up
  3. Remove specific version numbers and add instructions to find "current" versions
  4. Test again
  5. Seperate instructions and add to appropriate Wiki Pages
    1. GCC_Cross-Compiler
    2. Building_GCC
    3. Bare_Bones