Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

2023.2 under WSL is currently being evaluated. Documentation for 2023.2 can be changed permanently at the moment.

Instructions

Setup WSL and Install Linux

Expand
titlePrepare PC/OS
  1. Enable CPU virtualisation in BIOS
  2. Open Windows Features
    1. Enable Windows-Subsystem for Linux


Expand
titleChange default WSL version from WSL1 to WSL2
  1. Powershell as Admin:
    1. dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    2. dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  2. Reboot
  3. Download and install: https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
  4. Powershell as Admin:
    1. wsl --set-default-version 2


Expand
titleList of tested WSL Linux distributionen and Xilinx Tools
The list is only a guide that has worked for us, there may still be complications that we cannot help with at this time.
  • Vivado/Vitis/Petalinux 2023.2
    • with WSL Ubuntu 22.04 LTS
  • Archive(was created with older version of this guideline)
    • Vivado/Vitis/Petalinux 2020.2
      • with WSL Ubuntu 18.04 LTS
    • Vivado/Vitis/Petalinux 2021.2/2022.2
      • with WSL Ubuntu 18.04 LTS
      • with WSL Ubuntu 20.04 LTS


Expand
titleLinux Distribution installieren
Install Ubuntu Distribution
  1. Open Powershell as Admin
    1. Show all available distributions wsl.exe --list --online
    2. Install(Need for Multi Distributions): wsl.exe --install -d <linux distribution> or wsl.exe --install <linux distribution>
  2. Start Linux console and follow install instruction
    1. Start Ubuntu App (Windows Start Button → Ubuntu)
  3. (optional) WSL Configuration on linux console:
    1. sudo vim /etc/wsl.conf
      1. [wsl2]
        memory=<size>GB
        processors=<cnt>

    2. Other options: https://docs.microsoft.com/en-us/windows/wsl/wsl-config
  4. Other Install options from MS:https://docs.microsoft.com/de-de/windows/wsl/install-manual

Mount external ext4 drive (optional)

  1. mount ext4 drive (optimal as working drive instead if vhs): https://learn.microsoft.com/en-us/windows/wsl/wsl2-mount-disk
    1. Mounting a partitioned disk
      1. Show drives on powershell: GET-CimInstance -query "SELECT * from Win32_DiskDrive"

      2. Mount drive inside powershell: wsl --mount <DiskPath> -p <partition number>
      3. Linux Console
        1. show available partitions: lsblk -lf
        2. Mount drive inside linux
          1. sudo mkdir /mnt/<name>
          2. sudo mount /dev/sdd<Number> /mnt/<name>/
        3. Change Permission
          1. sudo chown <owner>:<owner> /mnt/<name>/
    2. todo automount (otherwise ex4 is unmounted after wsl shutdown)
      1. https://learn.microsoft.com/de-de/windows/wsl/wsl-config


Expand
titleSetup DNS nameserver
  1. Check that the DNS server is configured on the Linux console:
    1. sudo vim /etc/resolv.conf
  2. In case DNS server is correct, skip this instruction otherwise follow instruction below
  3. Linux console:
    1. sudo vim /etc/wsl.conf
      1. [network]
        generateResolvConf = false
    2. (in case file can't be wrote):
      1. sudo rm /etc/.wsl.conf.swp
  4. Powershell console:
    1. wsl --shutdown
  5. Get DNS Server IP over powershell:
    1. ipconfig -all
  6. Restart Linux (over powershell or win start button → Ubuntu)
  7. Linux console:
    1. sudo vim /etc/resolv.conf
      • nameserver <DNS IP>
    2. (in case file can't be wrote, remove) and try again point a:
      1. sudo rm /etc/.resolv.conf.swp
      2. sudo rm etc/resolv.conf


Expand
titleVirtual WSL drive as network drive in WinOS
  1. Open explore
  2. Right click on PC icon --> Connect network drive
  3. Select drive
  4. Add to folder \\wsl$\Ubuntu-18.04
  5. Click Finish

Prepare Linux for AMD Tools

Expand
titleAdditional Packages
  1. Resize WSL VHD, see  "Resize WSL VHD" on "Notes and Hints and other stuff" section
  2. Install browser
    1. sudo apt-get install firefox

  3. change console from dash to bash

    1. sudo dpkg-reconfigure dash 

      1. Press "No" to disable dash and activate default bash
  4. Enable i386 architecture

    1. sudo dpkg --add-architecture i386
      sudo apt-get update
  5. Download and run plnx-env-setup.sh(optional, not longer recommended from AMD):  https://www.xilinx.com/support/answers/73296.html

    1. chmod 777 ./plnx-env-setup.sh
    2. sudo ./plnx-env-setup.sh

  6. Install packages(see https://support.xilinx.com/s/article/000035572?language=en_US  → PetaLinux_2023.2_OS_Package_List.xlsx)

    1. Note:

      1. From excel  additional to python3 also python was recommended which is not longer possible to install

      2. Additionally bc  and was libtinfo5 added
      3. Add subversion (need only in case svn is used)
      4. Add u-boot-tools (need to generate own boot.scr file instead of petalinux version)
    2. sudo apt-get install iproute2 gawk python3 build-essential gcc git make net-tools libncurses5-dev tftpd zlib1g-dev libssl-dev flex bison libselinux1 gnupg wget git diffstat chrpath socat xterm autoconf libtool tar unzip texinfo zlib1g-dev gcc-multilib automake zlib1g:i386 screen pax gzip cpio python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev pylint bc libtinfo5 subversion u-boot-tools -y


Expand
titleInstall Xilinx Tools
  1. Download AMD Vitis All OS installer Single-File(Includes Vitis, Vivado and Petalinux downloader):
    1. Downloads (xilinx.com)
  2. Extracted Files on linux drive
    1. tar -xvf FPGAs_AdaptiveSoCs_Unified_2023.2_1013_2256.tar.gz
  3. Create Folder /tools/Xilinx
    1. sudo mkdir /tools
    2. sudo mkdir /tools/Xilinx
  4. Change owner to user
    1. sudo chown <owner>:<owner> /tools/Xilinx

  5. Install Vitis

    1. run:$ ./xsetup

    2. select Vitis on default installation path
  6. Vivado License
    1. Open Xilinx License manager and chose Copy License and select your license file
    2. In case license file is node-locked and shared with WinOS:
      1. sudo vim /etc/bash.bashrc
        1. sudo ip link add bond0 type bond
          1. in case bond0 is not available
        2. sudo ip link set dev bond0 address xx:xx:xx:xx:xx:xx
          1. (use MAC from Win OS)
  7. Install petalinux
    1. run:$ ./xsetup
    2. select petalinux on default installation path
  8. Add source environment to auto start of new console :
    1. sudo vim /etc/bash.bashrc
      1. source /tools/Xilinx/PetaLinux/2023.2/tool/settings.sh

Notes and Hints and other stuff

Expand
titleNotes and hints and other stuff


Code Block
languagebash
titlesudo vim /etc/bash.bashrc (complete example)
collapsetrue
#...
#(original part)
#...
#all extensions to setup environment and 
# load petalinux environment, can be overwrite via project scripts
export LM_LICENSE_FILE=<path to license file>
export GLOBAL_VIVADO=2023.2
source /tools/Xilinx/PetaLinux/${GLOBAL_VIVADO}/tool/settings.sh

# additional TE environment variables to change timeout and used jobs

# additional TE envirnmoent variables
export TE_TIMEOUT=200
export TE_RUNNING_JOBS=16
export TE_WSL_USAGE=1
export TE_EDITOR=notepad++.exe
#export TE_SERIAL_PS=<path>
export TE_COM=/mnt/<path to putty on winOS>
export TE_PLX_SSTATE_CACHE_DOWNLOAD=~/design/sstate-cache/downloads_${GLOBAL_VIVADO}/downloads
export TE_PLX_SSTATE_CACHE_AARCH64=~/design/sstate-cache/sstate_aarch64_${GLOBAL_VIVADO}/aarch64
export TE_PLX_SSTATE_CACHE_ARM=~/design/sstate-cache/sstate_arm_${GLOBAL_VIVADO}/arm
export TE_PLX_SSTATE_CACHE_MB_FULL=~/design/sstate-cache/sstate_mb-full_${GLOBAL_VIVADO}/mb-full
# finish
echo "TE Enviroment Variables"
echo "TE_TIMEOUT=${TE_TIMEOUT}"
echo "TE_RUNNING_JOBS=${TE_RUNNING_JOBS}"
echo "TE_WSL_USAGE=${TE_WSL_USAGE}"
echo "TE_EDITOR=${TE_EDITOR}"
echo "TE_SERIAL_PS=${TE_SERIAL_PS}"
echo "TE_COM=${TE_COM}"
echo "TE_PLX_SSTATE_CACHE_DOWNLOAD=${TE_PLX_SSTATE_CACHE_DOWNLOAD}"
echo "TE_PLX_SSTATE_CACHE_AARCH64=${TE_PLX_SSTATE_CACHE_AARCH64}"
echo "TE_PLX_SSTATE_CACHE_ARM=${TE_PLX_SSTATE_CACHE_ARM}"
echo "TE_PLX_SSTATE_CACHE_MB_FULL=${TE_PLX_SSTATE_CACHE_MB_FULL}" # finish

function x_run () {
  sudo ip link add bond0 type bond
  # replace xx:xx:xx:xx:xx:xx with win 10 MAC
  sudo ip link set dev bond0 address xx:xx:xx:xx:xx:xx
}

# xSetup only needed in case wsl is rebooted
echo "Refresh XSetup? y/N"
read xsetup
if [ "${xsetup}" == "y" ]; then x_run; fi 

#show version
lsb_release -a  


Code Block
languagepowershell
titleRelease reserved memory from Vmmem
collapsetrue
#Sometimes Vmmem did not release DDR memory
# ###############
#Solution 1: 
# #######
#shutdown (close all running application before)
wsl --shutdown
#start WSL again
wsl
#Solution 2:
#todo


Code Block
languagepowershell
titleResize WSL VHD
collapsetrue
# Resize VHD
# ###############
# see: https://docs.microsoft.com/en-us/windows/wsl/vhd-size  
#
#1 open powershell as admin
#Terminate WSL
wsl --shutdown
# https://learn.microsoft.com/en-us/windows/wsl/disk-space#how-to-locate-the-vhdx-file-and-disk-path-for-your-linux-distribution
#find your distribution installation.
#replace <distribution-name> with your Ubuntu Version, for example Ubuntu-22.04
(Get-ChildItem -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | Where-Object { $_.GetValue("DistributionName") -eq '<distribution-name>' }).GetValue("BasePath") + "\ext4.vhdx"

#Copy the path to that file, it should look something like %LOCALAPPDATA%\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79xxxx\LocalState\ext4.vhdx
# This path will be called "<pathToVHD>" below
# -------------------------#start diskpartdiskpart# ----------
diskpart
#inside diskpart console
#select disk
DISKPART> Select vdisk file="<pathToVHD>"
#check details
DISKPART> detail vdisk
#(optional) shrink size
DISKPART> compact vdisk
#expand for example to 512GB  <sizeInMegaBytes>=512000
#Note: WSL2 and Ubuntu 22.04 has default maximum size from harddisk
DISKPART> expand vdisk maximum=512000 
#exit
DISKPART> exit
# ----------
#start WSL from powershell
sudo mount -t devtmpfs none /dev
#  "/dev: none already mounted on /dev." warning can be ignored
mount | grep ext4
#resize fs to 512GB <sizeInMegaBytes>=512000M
sudo resize2fs /dev/sdb 512000M


Code Block
languagebash
titleWarning "/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
collapsetrue
#change manually with
sudo dpkg-reconfigure locales



Scroll Only


HTML
<style>
.wiki-content .columnLayout .cell.aside {
width: 0%;
}</style>



Scroll pdf ignore


Custom_fix_page_content

Table of contents

Table of Contents
outlinetrue






Preview Screenshots

Vivado Linux GUI on  XServer in WinOS Desktop

Vivado Linux GUI Linux Desktop in RDP

Linux Console on Win OS with Petalinux

Virtual Linux EXT4 Drive on  Win Explorer


Obsolete Notes

Expand
titleGUI Option 1: GUI with X-Server (not longer needed))
Note

VCXsrv is not longer needed with newest WSL und Ubuntu 22.04


  1. Install VcXsrv
  2. Start VcXsrv (XLaunch)




    1. (optional) Save Configuration and run XLaunch  directly with "XLaunch -run <config.xlaunch>"
  3. Linux console:
    1. sudo apt update && sudo apt upgrade
    2. sudo apt install xfce4
    3. sudo apt install build-essential

    4. sudo apt install net-tools

    5. sudo apt install xrdp -y && sudo systemctl enable xrdp
  4. Add environment to auto start of new console :
    1. sudo vim /etc/bash.bashrc
      1. export DISPLAY=<host IP>:0.0

      2. export LIBGL_ALWAYS_INDIRECT=1

      3. sudo /etc/init.d/dbus start
      4. sudo /etc/init.d/xrdp start

Expand
titleGUI Option 2: Ubuntu Desktop Modus over RDP (not longer tested with 22.3 and newer))
Note

Currently not tested with newest WSL und Ubuntu 22.04


  1. Start Ubuntu App (Windows Start Button → Ubuntu)
  2. Add username and password
  3. Update packet manager:
    1. sudo apt update && sudo apt upgrade
  4. Install:
    1. sudo apt install xfce4 xrdp
  5. Modify Remote Port
    1. sudo sed -i 's/3389/3388/g' /etc/xrdp/xrdp.ini
  6. Start XRDP Server 
    1. sudo /etc/init.d/xrdp start
  7. (optional) XRDP autostart :
    1. sudo vim /etc/bash.bashrc
      1. sudo /etc/init.d/xrdp start
  8. Connect via RDP (Win10 Remote Desktop Connection):
    1. localhost:3388

Expand
titleolder version of bash.bashcr
Code Block
languagebash
titlesudo vim /etc/bash.bashrc (complete example)
collapsetrue
#...
#(original part)
#...
#all extensions to setup environment and 
# load petalinux environment, can be overwrite via project scripts
export GLOBAL_VIVADO=2021.2
source /tools/Xilinx/PetaLinux/${GLOBAL_VIVADO}/tool/settings.sh

# additional TE environment variables to change timeout and used jobs

# additional TE envirnmoent variables
export TE_TIMEOUT=200
export TE_RUNNING_JOBS=16
export TE_WSL_USAGE=1
export TE_EDITOR=notepad++.exe
#export TE_SERIAL_PS=<path>
export TE_COM=/mnt/<path to putty on winOS>
export TE_PLX_SSTATE_CACHE_DOWNLOAD=~/design/sstate-cache/downloads_${GLOBAL_VIVADO}/downloads
export TE_PLX_SSTATE_CACHE_AARCH64=~/design/sstate-cache/sstate_aarch64_${GLOBAL_VIVADO}/aarch64
export TE_PLX_SSTATE_CACHE_ARM=~/design/sstate-cache/sstate_arm_${GLOBAL_VIVADO}/arm
export TE_PLX_SSTATE_CACHE_MB_FULL=~/design/sstate-cache/sstate_mb-full_${GLOBAL_VIVADO}/mb-full
# finish
echo "TE Enviroment Variables"
echo "TE_TIMEOUT=${TE_TIMEOUT}"
echo "TE_RUNNING_JOBS=${TE_RUNNING_JOBS}"
echo "TE_WSL_USAGE=${TE_WSL_USAGE}"
echo "TE_EDITOR=${TE_EDITOR}"
echo "TE_SERIAL_PS=${TE_SERIAL_PS}"
echo "TE_COM=${TE_COM}"
echo "TE_PLX_SSTATE_CACHE_DOWNLOAD=${TE_PLX_SSTATE_CACHE_DOWNLOAD}"
echo "TE_PLX_SSTATE_CACHE_AARCH64=${TE_PLX_SSTATE_CACHE_AARCH64}"
echo "TE_PLX_SSTATE_CACHE_ARM=${TE_PLX_SSTATE_CACHE_ARM}"
echo "TE_PLX_SSTATE_CACHE_MB_FULL=${TE_PLX_SSTATE_CACHE_MB_FULL}" # finish

function x_run () {
  #XServer Display
  export DISPLAY=xxx.xxx.xxx.xxx:0.0
  # replace xxx.xxx.xxx.xxx with your win 10 host IP
  export LIBGL_ALWAYS_INDIRECT=1

  sudo /etc/init.d/dbus start
  sudo /etc/init.d/xrdp start
  # replace xx:xx:xx:xx:xx:xx with win 10 MAC
  sudo ip link set dev bond0 address xx:xx:xx:xx:xx:xx
}

# x-server Setup only needed in case wsl is rebooted
echo "Refresh XSetup? y/N"
read xsetup
if [ "${xsetup}" == "y" ]; then x_run; fi 

#show version
lsb_release -a