Skip to content

Instantly share code, notes, and snippets.

@rajesh-s
Last active September 5, 2022 18:29
Show Gist options
  • Save rajesh-s/bd123ca1e65b95eb38220cd944670e3a to your computer and use it in GitHub Desktop.
Save rajesh-s/bd123ca1e65b95eb38220cd944670e3a to your computer and use it in GitHub Desktop.
Installing gem5 simulator on Windows WSL2 (Windows Subsystem for Linux 2)

Installing gem5 simulator on Windows WSL2

  1. Install WSL2 using PowerShell (Assuming you are on 2004 build else check this
  dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  wsl --set-default-version 2
  1. Install distro, terminal from Microsoft App store
  2. If you see this error Virtual hard disk files must be uncompressed... disable compression using this method
  3. If you see this error Temporary failure resolving 'archive.ubuntu.com' where WSL2 is not able to connect to the host internet. fix
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf

wsl --shutdown (on Powershell)
  1. (OPTIONAL) Install desktop env and GUI on port 3390. I used XRDP instead of VcxSrv because of issues while setting up the latter. Use Windows RDP to connect to the ipaddr of WSL
sudo apt install xrdp xfce4 xfce4-goodies
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
echo xfce4-session > ~/.xsession
sudo nano /etc/xrdp/startwm.sh # Comment out last two lines, add startxfce4
sudo /etc/init.d/xrdp start
  1. Installing gem5 from here
sudo apt install build-essential git m4 scons zlib1g zlib1g-dev libprotobuf-dev protobuf-compiler libprotoc-dev libgoogle-perftools-dev python3-dev python3-six python-is-python3 libboost-all-dev pkg-config
git clone https://gem5.googlesource.com/public/gem5
cd gem5
scons build/X86/gem5.opt -j <NUMBER OF CPUs ON YOUR PLATFORM>
build/X86/gem5.opt configs/learning_gem5/part1/simple.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment