Skip to content

Setup tips for Ubuntu 22.04.4 LTS

IvarNilsson edited this page Aug 5, 2024 · 2 revisions

There were various problems to setting up the computers to build the project and use Vivado. This is a list of some of the important and hard to find fixes that were made.

Install zsh and aactivator

zsh

sudo apt install zsh
cat /etc/shells
echo $SHELL
command -v zsh
command -v zsh | sudo tee -a /etc/shells
sudo chsh -s $(which zsh) $USER

curl, git, more

sudo apt install curl wget git
sudo apt install htop

ohmyzsh

sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

Powerline fonts

sudo apt install fonts-powerline

aactivator

install .deb file from github releases
sudo apt install /home/$USER/Downloads/aactivator_2.0.0_all.deb
sudo apt install pip
sudo apt install mlocate
sudo apt autoremove
pip install --upgrade virtualenv
Go to the project directory and run the last command:
virtualenv -p python3 venv

RTL tools

sudo apt install verilog
sudo apt install gtkwave
sudo apt install libcanberra-gtk-module libcanberra-gtk3-module

Configure zsh and aactivator

to be able to run .activate.sh automatically and make configure zsh with some nice features copy the following to .zshrc (located in the home directory):

# Add .local/bin to path (python exec gets stored here)
export PATH=/home/$USER/.local/bin:$PATH

# Add GHDL to path
export PATH=/usr/local/bin:$PATH

# Add FPGA-sampling to path
export PATH=FPGA-sampling:$PATH

# Set umaks to don't allow other user to write to your files
umask 022

# OH-MY-ZSH settings
export ZSH="/home/$USER/.oh-my-zsh"
ZSH_THEME="agnoster"
HIST_STAMPS="yyyy-mm-dd"
HYPHEN_INSENSITIVE="true"
plugins=(git pip zsh-autosuggestions zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh

# Activator
eval "$(aactivator init)"

# Terminal Start picture, just for fun
python3 -c '
from random import randint
from os import get_terminal_size

stripe_piece = "█"
size = 1

# Set colors
rnd0 = randint(0, 255)
rnd1 = randint(0, 255)
color0 = lambda n: f"\033[38;5;{n}m"
color1 = lambda n: f"\033[38;5;{n}m"
stripe0 = [(color0(rnd0 + n % 256)) for n in range(get_terminal_size().columns // size)]
stripe1 = [(color1(rnd1 + n % 256)) for n in range(get_terminal_size().columns // size)]

# Print it
for s in stripe0:
    print(s + stripe_piece * size, end="")

print("\033[0m")  # Reset color at the end

text_to_center = "\033[1m SKRIV NÅGOT ROLIGT HÄR :) \033[0m"
terminal_width = get_terminal_size().columns
padding = (terminal_width - len(text_to_center)) // 2
centered_text = " " * padding + text_to_center
print(centered_text)

for s in stripe1:
    print(s + stripe_piece * size, end="")

print("\033[0m")  # Reset color at the end
'

### ARCHIVE EXTRACTION
# usage: ex <file>
ex ()
{
  if [ -f "$1" ] ; then
    case $1 in
      *.tar.bz2)   tar xjf $1   ;;
      *.tar.gz)    tar xzf $1   ;;
      *.bz2)       bunzip2 $1   ;;
      *.rar)       unrar x $1   ;;
      *.gz)        gunzip $1    ;;
      *.tar)       tar xf $1    ;;
      *.tbz2)      tar xjf $1   ;;
      *.tgz)       tar xzf $1   ;;
      *.zip)       unzip $1     ;;
      *.Z)         uncompress $1;;
      *.7z)        7z x $1      ;;
      *.deb)       ar x $1      ;;
      *.tar.xz)    tar xf $1    ;;
      *.tar.zst)   unzstd $1    ;;
      *)           echo "'$1' cannot be extracted via ex()" ;;
    esac
  else
    echo "'$1' is not a valid file"
  fi
}

Download aactivator from github. When entering the project folder it might say cowardly refucing when trying to run the .activate.sh the run this command:

chmod -R og-w $HOME

To install with pip in venv example:

./.venv/bin/pip install numpy

You can also add them to the requirements.txt, delete the .venv, exit the project from a terminal and then enter it again. This will also install the required package for every one else cloning the project.

Vivado install tips

Vivado should be installed in the /tools directory.

If Vivado downlad gets stuck on device list use the following commands:

apt update
sudo apt upgrade
sudo apt install libncurses5
sudo apt install libtinfo5
sudo apt install libncurses5-dev libncursesw5-dev
sudo apt install ncurses-compat-libs
sudo apt install libfuse2

Remember to install board-files to Vivado this can be found in the user manual. Some folders might need chmod 777 for all of this to work.

Remember to also install cable-drives this too can be found in the user manual.

Install simulation tools

GTK-Wave

sudo apt install gtkwave

GHDL

Download: v4.1.0 ghdl-gha-ubuntu-22.04-mcode.tgz and extract the folder

sudo apt install gnat
mv /home/$USER/Downloads/ghdl-gha-ubuntu-22.04-mcode/ /home/$USER/Downloads/ghdl/
sudo mv /home/$USER/Downloads/ghdl /usr/lib
mkdir /usr/lib/ghdl/mcode
cp /usr/lib/ghdl/lib/ghdl /usr/lib/ghdl/mcode -r
mv /usr/lib/ghdl/mcode/ghdl /usr/lib/ghdl/mcode
mv /usr/lib/ghdl/mcode/ghdl /usr/lib/ghdl/mcode/vhdl

VUNIT

git clone --recurse-submodules https://github.com/VUnit/vunit.git
cd vunit
sudo python3 setup.py install

Docker and tftp

Clone the beamforming_lk repo.

Download Docker using the apt repository.

Start docker:

cd /home/$USER/Projects/beamforming-lk/boot/
sudo docker build -t tftpd .
sudo docker run -it -d --rm --network=host -v /home/$USER/Projects/beamforming-lk/boot/tftp:/var/lib/tftpboot --name tftp-server tftpd

Kill docker:

sudo docker kill tftp-server

Minicom

sudo apt-get install minicom
sudo dmesg | grep tty

To run:

sudo minicom -b 115200 -o -D /dev/ttyUSB1