This is the updated "work in progress" (WIP) WSL-Tutorial for 2020/2021!
This tutorial will guide you through the installation of VARIOUS SDKs for different platforms (PS1, PS2, PS3, PSVita/PSTV, etc.), within WSL(1)/WSL2!
Please read the "Intro"-Tab, to understand how this tutorial is structured and how you get to where you want to!
Have fun compiling apps for various systems and hopefully you can contribute something!
This tutorial will guide you through the installation of VARIOUS SDKs for different platforms (PS1, PS2, PS3, PSVita/PSTV, etc.), within WSL(1)/WSL2!
Please read the "Intro"-Tab, to understand how this tutorial is structured and how you get to where you want to!
Intro
Requirements
WSL&"bash" (Part A)
SDKs&Toolchains&Ports (Part B)
Optional stuff
Compiling Apps
Update SDK&Toolchain&Ports
Tipps & Tricks
Troubleshooting
Suggestions&ToDo
Videos
Creditz&Co.
-
How did it came to be?
I wrote a tutorial about this topic for the PS2SDK, back when WSL was a beta-feature and updated it with some things, but unfortunately psx-scene.com - including some of the additional things from the old tutorial - are lost and/or outdated.
This and the fact that WSL2 got released, made me update/rewrite this tutorial!
Don't worry! It works with WSL(1) as well as WSL2!
This will take less than an hour usually (if you use WSL2 and consider the hardware needed for it)!
What is this all about?
It is here for those who neither want to install Linux (as mainOS, or 2nd OS); a VM; an artificial userspace/subsystem, which interpretes the Bash-Commands (MinGW, Cygwin); etc., but still want to be able to compile Apps for various platforms.
On a side-note: If you do it on Windows anyway, then 'WSL' should work quite more performant, than a VM or stuff like MinGW...
I also hope, this will get some more people into developing and Linux at all!
How to read this tutorial?
There are spoilers for different consoles (Currently planned and right now, only the PlayStation2 and PlayStation3 are included!)!
Go from "Intro" to "SDKs&Toolchains&Ports (Part B)", choose the appropriate spoiler for the console/tools you want to work with and you can read further, if you want to use/learn some handy things or have any problems.
-
You need:
- Windows 10 x64 (1607 or newer for WSL[1] or 2004 or newer for WSL2)
- For x64 systems: Version 1903 or higher, with Build 18362 or higher.
- For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.
- A 64Bit CPU (obviously)!
- For WSL2 you need Virtualization-Support, but this tutorial works with WSL(1) as well!
- Internet (to download the stuff, etc.) with a stable connection
- etc.
- Windows 10 x64 (1607 or newer for WSL[1] or 2004 or newer for WSL2)
-
Skipping Part A of the guide:
You can skip part A of the guide, which guides you in very few steps through the installation of 'WSL'. However,... This guide assumes, that you're using a clean install of 'Bash on Ubuntu on Windows' (and 'Windows Subsystem for Linux (WSL)'). If you modified your WSL-Ubuntu-Userspace in any way, I can not guarantee, that this guide will work for you.
Part A is a quick 'run-through' to install WSL/bash, which looks more complex or longwinded, than it is.
-- Skip Part A if you want and are certain, about what you are doing.
Part A: Installing 'Windows Subsystem for Linux' and 'Bash on Ubuntu on Windows'
Search for 'features' (right next to the windows-button) and it will show a text with 'Windows-Features'.
Click on the feature "Windows Subsystem for Linux" and "Virtual Machine Platform" and then "o.k." to activate it (I chose to also install PowerShell and Windows-Terminal as well and was doing all the following stuff, using PowerShell 64bit-Version in Admin-Mode [when I wrote the old tutorial].)
It will download and install it.
You can also use the following commands, to install the featues via command-line.
Code:dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartCode:dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartDownload the kernel-Update and install it! --> https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msiExecute the following command via cmd/PowerShell/Windows Terminal/etc.
Code:wsl --set-default-version 2Start the 'Microsoft Store', search for your distribution, click install! Done!
This tutorial has been tried with "Ubuntu" and "Debian".
After that:
- start CMD with admin-priviledges (just to be sure), by right-clicking on the Windows/Start-Button...
- type 'bash' (without quotes) into CMD
- verify the download-request and let it download and install
That's it for the 'WSL'-Feature and 'bash'. Now let's move on to install an SDK 'into' it.
-
Part B: Installing an SDK and toolchain
Before we continue. You might want to insert one code-line at once, to avoid problems.
PlayStation
IMPORTANT: The following example uses "/usr/local/psn00bsdk" as the PSN00BSDK_TC-Folder, which requires manual creation of the folder + chmod, if you intend to use the paths which are in the example on the psn00bsdk-repo!
You can adapt this path to (for example) "$HOME/psn00bsdk" or another folder, which doesn't need this!
If you want to use another folder than "/usr/local/psn00bsdk", keep in mind that you have to adapt the strings you have to enter, so instead of "export PSN00BSDK_TC=/usr/local/psn00bsdk", you have to adapt the paths (temporary and/or permanently) to your choice (like "export PSN00BSDK_TC=$HOME/psn00bsdk" or etc.)!
Temporary:
Code:export PSN00BSDK_TC=/usr/local/psn00bsdk export PATH=$PATH:$PSN00BSDK_TC/psn00bsdk/tools/bin
Permanently:
Code:cd $HOME && nano .profile
Then manually copy this to the end of the file:
...and if you use another GCC-version than 7.4.0, also addCode:export PSN00BSDK_TC=/usr/local/psn00bsdk export PATH=$PATH:$PSN00BSDK_TC/psn00bsdk/tools/bin
...and adapt your version-string.Code:export GCC_VERSION=9.3.0
Then press Ctrl+X, confirm with "y" and press "Return/Enter" on the name-confirmation.
Re-loading the profile: Use the command
after the last step of permanently setting it!Code:source ~/.profileFirst off, update your distro and tools. You don't have to, but it is recommented.
Code:sudo apt update sudo apt upgrade
Install the libs:
Code:sudo apt-get -y install gcc make git texinfo libgmp-dev libgmp3-dev libmpfr-dev libmpc-dev libisl-dev libtinyxml2-devIf you use "/usr/local/psn00bsdk" as PSN00BSDK_TC-Path-Variable, you will have to execute the following commands now.
First off... If you already have the folder "psn00bsdk", remove it via the following command:
If you don't have it or if you executed the previous command, jump right to this command:Code:sudo rm -rf $PSN00BSDK_TC
Now clone and install the PSN00BSDK along some other things.Code:sudo mkdir -p /usr/local/psn00bsdk && sudo chmod -R 777 /usr/local/psn00bsdk
Code:cd $PSN00BSDK_TC && git clone https://github.com/lameguy64/psn00bsdk.git && cd psn00bsdk && cd tools && make && make install~Placeholder~
PlayStation 2
IMPORTANT: The following example uses "/usr/local/ps2dev" as the PS2DEV-Folder, which requires manual creation of the folder + chmod, if you intend to use the paths which are in the example on the ps2dev-repo!
You can adapt this path to (for example) "$HOME/ps2dev" or another folder, which doesn't need this!
If you want to use another folder than "/usr/local/ps2dev", keep in mind that you have to adapt the strings you have to enter, so instead of "export PS2DEV=/usr/local/ps2dev", you have to adapt the paths (temporary and/or permanently) to your choice (like "export PS2DEV=$HOME/ps2dev" or etc.)!
Temporary:
Code:export PS2DEV=/usr/local/ps2dev export PS2SDK=$PS2DEV/ps2sdk export GSKIT=$PS2DEV/gsKit export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
Permanently:
Code:cd $HOME && nano .profile
Then manually copy this to the end of the file:
Then press Ctrl+X, confirm with "y" and press "Return/Enter" on the name-confirmation.Code:export PS2DEV=/usr/local/ps2dev export PS2SDK=/usr/local/ps2dev/ps2sdk export GSKIT=/usr/local/ps2dev/gsKit export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
Re-loading the profile: Use the command
after the last step of permanently setting it!Code:source ~/.profileFirst off, update your distro and tools. You don't have to, but it is recommented.
Code:sudo apt update sudo apt upgrade
Install the libs: WARNING! If it mongers about not being able to find either ucl OR upx-ucl (depending on the distro you use), just remove it from the command!
Code:sudo apt-get -y install build-essential git mercurial libc6-dev zlib1g zlib1g-dev libucl1 libucl-dev autoconf gcc clang cmake make patch git texinfo flex bison gettext wget libgsl-dev libgslcblas0 libgsl23 gsl-bin libgmp-dev libmpfr-doc libgmp3-dev libmpfr-dev libmpc-dev mpc ucl upx-ucl zip unzipIf you use "/usr/local/ps2dev" as PS2DEV-Path-Variable, you will have to execute the following commands now.
First off... If you already have the folder "ps2dev", remove it via the following command:
If you don't have it or if you executed the previous command, jump right to this command:Code:sudo rm -rf $PS2DEV
Now clone and install the PS2SDK along some other things.Code:sudo mkdir -p /usr/local/ps2dev/ps2sdk && sudo chmod -R 777 /usr/local/ps2dev
Code:cd $PS2DEV && git clone https://github.com/ps2dev/ps2dev.git && cd ps2dev && ./build-all.shWhen this is done, install "ps2eth"...
Code:cd $PS2DEV && git clone git://github.com/ps2dev/ps2eth && cd ps2eth && make && tar c `find . -name \*irx` | tar x -C /usr/local/ps2dev/ps2eth && make clean && cd $HOME && . .profile~WIP~
~WIP~
PlayStation 3
IMPORTANT: The following example uses "/usr/local/ps3dev" as the PS3DEV-Folder, which requires manual creation of the folder + chmod, if you intend to use the paths which are in the example on the ps3dev-repo!
You can adapt this path to (for example) "$HOME/ps3dev" or another folder, which doesn't need this!
If you want to use another folder than "/usr/local/ps3dev", keep in mind that you have to adapt the strings you have to enter, so instead of "export PS3DEV=/usr/local/ps3dev", you have to adapt the paths (temporary and/or permanently) to your choice (like "export PS3DEV=$HOME/ps3dev" or etc.)!
Temporary:
Code:export PS3DEV=/usr/local/ps3dev export PSL1GHT=$PS3DEV export PATH=$PATH:$PS3DEV/bin export PATH=$PATH:$PS3DEV/ppu/bin export PATH=$PATH:$PS3DEV/spu/bin
Permanently:
Code:cd $HOME && nano .profile
Then manually copy this to the end of the file:
Then press Ctrl+X, confirm with "y" and press "Return/Enter" on the name-confirmation.Code:export PS3DEV=/usr/local/ps3dev export PSL1GHT=$PS3DEV export PATH=$PATH:$PS3DEV/bin export PATH=$PATH:$PS3DEV/ppu/bin export PATH=$PATH:$PS3DEV/spu/bin
Re-loading the profile: Use the command
after the last step of permanently setting it!Code:source ~/.profileFirst off, update your distro and tools. You don't have to, but it is recommented.
Code:sudo apt update sudo apt upgrade
Install the libs:
Code:sudo apt-get -y install autoconf automake bison flex gcc libelf-dev make texinfo libncurses5-dev patch python subversion wget zlib1g-dev libtool libtool-bin python-dev bzip2 libgmp3-dev pkg-config g++ libssl-dev clangIf you use "/usr/local/ps3dev" as PS3DEV-Path-Variable, you will have to execute the following commands now.
First off... If you already have the folder "ps2dev", remove it via the following command:
If you don't have it or if you executed the previous command, jump right to this command:Code:sudo rm -rf $PS3DEV
Code:sudo mkdir -p /usr/local/ps3dev/ps3sdk && sudo chmod -R 777 /usr/local/ps3dev
Now clone and install the PS3SDK along some other things.
Code:cd $PS3DEV && git clone https://github.com/ps3dev/ps3toolchain && cd ps3toolchain && ./toolchain.shWhen this is done, install "additional stuff"...
Code:~Placeholder~
PlayStation Vita / TV:
IMPORTANT: The following example uses "/usr/local/vitasdk" as the VITASDK-Folder, which requires manual creation of the folder + chmod, if you intend to use the paths which are in the example on the ps2dev-repo!
You can adapt this path to (for example) "$HOME/vitasdk" or another folder, which doesn't need this!
If you want to use another folder than "/usr/local/vitasdk", keep in mind that you have to adapt the strings you have to enter, so instead of "export VITASDK=/usr/local/vitasdk", you have to adapt the paths (temporary and/or permanently) to your choice (like "export VITASDK=$HOME/vitasdk" or etc.)!
Temporary:
Code:export VITASDK=/usr/local/vitasdk export PATH=$VITASDK/bin:$PATH
Permanently:
Code:cd $HOME && nano .profile
Then manually copy this to the end of the file:
Then press Ctrl+X, confirm with "y" and press "Return/Enter" on the name-confirmation.Code:export VITASDK=/usr/local/vitasdk export PATH=$VITASDK/bin:$PATH
Re-loading the profile: Use the command
after the last step of permanently setting it!Code:source ~/.profileFirst off, update your distro and tools. You don't have to, but it is recommented.
Code:sudo apt update sudo apt upgrade
Install the libs: WARNING! If it mongers about not being able to find either ucl OR upx-ucl (depending on the distro you use), just remove it from the command!
Code:sudo apt-get -y install make git-core cmake pythonIf you use "/usr/local/vitasdk" as VITASDK-Path-Variable, you will have to execute the following commands now.
First off... If you already have the folder "vitasdk", remove it via the following command:
If you don't have it or if you executed the previous command, jump right to this command:Code:sudo rm -rf $VITASDK
Now clone and install the VITASDK along some other things.Code:sudo mkdir -p /usr/local/vitasdk && sudo chmod -R 777 /usr/local/vitasdk
Code:cd $HOME && git clone https://github.com/vitasdk/vdpm && cd vdpm && ./bootstrap-vitasdk.sh && ./install-all.shCode:~Placeholder~ -
Note:
These are optional (additional) things, which you might want to use on WSL and which might be useful for using WSL as your "daily driver" for development and anything Linux-related!
Start the 'Microsoft Store', search for "Windows Terminal", or follow this link --> https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?activetab=pivot:overviewtabDownload "Docker-Desktop" from here --> https://hub.docker.com/editions/community/docker-ce-desktop-windows/Download the "VS-Code Remote-WSL-Extention" from here, if you have VS istalled --> https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wslDownload MS "Powertoys" from the GitHub-Repo --> https://github.com/microsoft/PowerToys~WIP~
Microsoft is currently working on a Wayland Display-Driver for WSL called "WSLG". It has been presented, but is not yet available. Once it is available, I will add it to this tutorial!
Meanwhile, you can also just use an X-Server on Windows and use that, or install an RDP-Server instead.
~WIP~
Download "vcxsrv" from here --> https://sourceforge.net/projects/vcxsrv/
and install it!
You need to set environment-variables in your ".profile", using either the temporary or permanent method.
~WIP~Type into your distr:Connect to your Distro via Windows' Remote Dektop Client andCode:sudo apt install xrdp(Port-Number might differ!)Code:localhost:3349
You can install a Desktop-Environment like "xfce4" (which is rather light-weight) or something like "KDE Neon".
xfce4:
Install it via:Launch it via:Code:sudo apt install xfce4Code:xfce4-session
kUbuntu Desktop:
Install it from within your distro via:Launch it via:Code:sudo apt install -y kubuntu-desktopCode:~Placeholder~
KDE Neon (Distro):
Install it via: (executed from CMD and as Administrator)and follow the instructions.Code:PowerShell -executionpolicy bypass -command "wget https://github.com/DesktopECHO/kWSL/raw/master/kWSL.cmd -UseBasicParsing -OutFile kWSL.cmd ; .\kWSL.cmd"
After installing it, it is flagged as a WSL(1)-Instance (even if you set your config to default any distro to be WSL2), which you can change by entering the following in cmd/PowerShell/Windows Terminal...Code:wsl --set-version Name_you_gave 2
Launch it via the cmd and the rdp, which are created on your Desktop!
If you run into issues, just go into the install-folder (usually C:\"Distroname_you_entered") and execute the "Uninstall 'Distroname_you_entered'.cmd" and start over, or use another mehtod!
~WIP~You must partially follow the "Installing a Desktop-Environment"-Spoiler, for example how to setup an X-Server.
~Placeholder~~Placeholder~ -
Let's compile an app!
(Not all of these work right now!)
GitHub:
Code:cd $HOME && rm -rf Open-PS2-Loader && git clone https://github.com/ps2homebrew/Open-PS2-Loader.git Open-PS2-Loader && cd Open-PS2-Loader && make clean && make IGS=1 PADEMU=1Code:cd $HOME && rm -rf wLaunchELF && git clone https://github.com/ps2homebrew/wLaunchELF.git && cd wLaunchELF && make rebuildCode:cd $HOME && rm -rf hdl-dump && git clone https://github.com/ps2homebrew/hdl-dump.git && cd hdl-dump && makeCode:cd $HOME && rm -rf gsm && git clone https://github.com/doctorxyz/gsm.git && cd gsm && makeCode:cd $HOME && rm -rf SMS && git clone https://github.com/ps2homebrew/SMS.git && cd SMS && make rebuildCode:cd $HOME && rm -rf 3d-cube && git clone https://github.com/doctorxyz/3d-cube.git && cd 3d-cube && make rebuildCode:cd $HOME && rm -rf myPS2 && git clone https://github.com/ps2homebrew/myPS2.git && cd myPS2 && make clean
Downloaded Sources:
Other projects compile successfully too, like HDL-GameInstaller, HDL-GameUpdater or PS2Ident for example...
These are some examples, which you can't pull from git (SP193 only has them on his page, not on his git) so you download the sources (it is the same for other apps, from other sources), put them in a directory simply with the 'Windows-Explorer'...
i.e. copy the source-folder (I'm using 'HDLGI' here) of your project to D: and type this use this:
Code:cd /mnt/d/HDLGI && make
The toolchain&sdk comes with some samples.
Use this code, to compile the "Blitting"-sample:
Code:cd build/psl1ght/samples/graphics/blitting/ && make -
Once a newer build is published you can update the things, instead of reinstalling everything from the beginning.
~Placeholder~
-
Use Windows-Explorer (or another programm, like the Editor/Notpad), with the Distro/bash/WSL:
Open the folder you are currently in, via
in Windows!Code:explorer.exe .
If you want to use another app, you have to call that exe instead!
When this doesn't work:
For some weird reason that didn't work for me in "Debian", but it worked well in "Ubuntu (20.04)"!
HOWEVER... There is a workaround which worked, see the next tipp!
Shortcuts to folders within a distro (like the home-folder of a user):
Creating a "shortcut" to "wsl$". From there you can go into your distribution (when it is running) and you can also set the shortcut directly to your user-home-folder!
Set/Default all distributions to a specific WSL-Version!
Code:wsl --set-default-version 2
~Placeholder~
-
Corrupted setup/install:
If you "corrupted" the distribution too much, just uninstall it and start from the beginning.
You can uninstall and re-install "bash" via the following commands.
Uninstall bash viaReinstall bash viaCode:lxrun /uninstall /fullCode:bash
Forcing WSL-Version upon a distro:
Sometimes things don't work out as planned, or you want to test something with another WSL-Version. You can do that by executing the following line in cmd/Powershell/Windows-Terminal.
Find installed distributions:
Set WSL-Version for a specific distribution!Code:wsl --list --verbose
Code:wsl --set-version <distribution name> <versionNumber>
Fixing a folder-issue by removal:
If it fails somewhere and you need to delete a folder, use
...for example...Code:sudo rm -rf "folder you want to delete"
to get rid of the folder.Code:sudo rm -rf $PS3DEV
Limiting RAM-Usage:
On some PCs the WSL-"Window" crashes, for example when an SSD is used (without a Swap-File) and the RAM is limited (happened to me on 5.7GB out of 6GB usable RAM).
Here is a tip/trick, to force wsl into using less RAM!
First off...
Open a CMD and enter
...and then...Code:bash
to see how many you currently use (it showed me "4.5GB").Code:free --giga -h
Now make sure that wsl is being terminated!
Enter
and maybe repeat it a few times (to make sure, it really terminated WSL!)!Code:wsl --shutdown
Then create a file named ".wslconfig" (yes, with a leading dot) and enter the following with a text-editor:
...or use any amount of memory you want to...Code:[wsl2] memory=3GB
Save the file to "c:\Users\%username%\" with the name ".wslconfig".
Now open a CMD and enter
...and then...Code:bash
again, to see if the "fix" worked!Code:free --giga -h
~Placeholder~
-
Here I will list some of your and my suggestions and/or the status of things.
- Linux-Desktop-Install and usage (Partially done! WIP!)
- Installation, Linking and Usage of Linux-GUI-Apps
- Performance-Tweaks
- Fixing some commands for app-compilation
- adding more SDKs&toolchains
- Update-Section has to be written
- related videos need to be linked
- More ideas for the "Tips&Tricks"- and the "Troubleshooting"-Tab
- Adding more references
- etc.
Suggestions are welcome!
- Linux-Desktop-Install and usage (Partially done! WIP!)
-
~Placeholder~PS2SDK - English:
~Placeholder~
PS2SDK - PT-BR:
~Placeholder~~Placeholder~ -
Creditz:
- The Scene: Thanks to all those who have contributed to the various platforms, SDKs&Toolchain, Tutorials&Scripts to install them and The Scene in general, in any way...
- Microsoft for WSL(1)&WSL2 + additional support
- Linus Torvalds for his work and the creation of the Linux-Kernel (etc.) and everyone who contributed to Linux.
- Various people for their ideas surrounding WSL(1)/WSL2.
- No copyright for the tutorial/guide/HowTo intended.
References:
PS1SDK ("PSn00bSDK) - GitHub:
https://github.com/Lameguy64/PSn00bSDK
PS2SDK - GitHub:
https://github.com/ps2dev/ps2dev
PS3SDK ("PSL1ght") - GitHub:
https://github.com/ps3dev/ps3toolchain
PSVita/PSTV-SDK - GitHub:
https://github.com/vitasdk/vdpm
MS-WSL(1)/WSL2-Guide:
https://docs.microsoft.com/en-us/windows/wsl/install-win10
https://docs.microsoft.com/en-us/windows/wsl/wsl-config
Windows Terminal - Guide:
https://docs.microsoft.com/en-us/windows/terminal/
Docker-Guide:
https://docs.docker.com/docker-for-windows/wsl/
https://docs.docker.com/
Visual-Studio-Guide:
https://code.visualstudio.com/blogs/2020/03/02/docker-in-wsl2
PowerToys:
https://github.com/microsoft/PowerToys
Microsoft Development-Environment-Guide:
https://docs.microsoft.com/en-us/windows/dev-environment/overview
"KDE Neon"/kWSL:
https://www.reddit.com/r/bashonubuntuonwindows/comments/k1m6n5/kde_neon_for_windows_wsl1/
~Placeholder~
Notes:
Share however you want to, but it would be cool if you refer to this thread/tutorial.
The same should be possible on the various subsystems (like POSIX, NetBSD/FreeBSD[?]) of various Windows-Versions, although it might need some adaptions.
Have fun compiling apps for various systems and hopefully you can contribute something!
Last edited: